Add PositionOnly field attribute

This commit is contained in:
Matthew R. Wilson committed 2026-01-02 14:45:25 -08:00
1 parent bdc1d714d2
commit 3b374a1955
2 files changed
+14 -1

No files matched your search

+5
View File
@@ -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"},
}
+9 -1
View File
@@ -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.