From 3b374a1955975ae91534b5300f2e5c6112cb7299 Mon Sep 17 00:00:00 2001 From: "Matthew R. Wilson" Date: Fri, 2 Jan 2026 14:45:25 -0800 Subject: [PATCH] Add PositionOnly field attribute --- example1/example1.go | 5 +++++ screen.go | 10 +++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/example1/example1.go b/example1/example1.go index 637fd69..fb0c760 100644 --- a/example1/example1.go +++ b/example1/example1.go @@ -55,6 +55,11 @@ var screen1 = go3270.Screen{ {Row: 16, Col: 0, Content: "The following should be left and right square brackets: [ ]"}, {Row: 17, Col: 0, Content: "Graphic escape support:"}, {Row: 17, Col: 24, Name: "gesupport"}, + + // Can use PositionOnly attribute to place text beginning at a specific + // position without introducing a new attribute byte. + {Row: 19, Col: 0, PositionOnly: true, Content: "This text starts in first column"}, + {Row: 22, Col: 0, Content: "PF3 Exit"}, } diff --git a/screen.go b/screen.go index 57bb82e..c0db5c8 100644 --- a/screen.go +++ b/screen.go @@ -27,6 +27,12 @@ type Field struct { // Text is the content of the field to display. Content string + // PositionOnly will use a Set Buffer Address (SBA) command to move the + // cursor to the position, but not insert a new attribute byte. The only + // properties of the Field that will apply if PositionOnly is true are: + // Row, Col, Content, Name. Others will be silently ignored. + PositionOnly bool + // Write allows the user to edit the value of the field. Write bool @@ -316,7 +322,9 @@ func showScreenInternal(screen Screen, values map[string]string, } b.Write(sba(fld.Row, fld.Col, cols)) - b.Write(buildField(fld)) + if !fld.PositionOnly { + b.Write(buildField(fld)) + } // Use fld.Content, unless the field is named and appears in the // value map.