1
0
mirror of https://github.com/gdamore/tcell.git synced 2025-04-29 13:49:10 +08:00

Fix for writing in last column of last line for automargin terminals.

This commit is contained in:
Garrett D'Amore 2021-05-18 23:17:00 -07:00
parent a3de596932
commit c43eafe245
34 changed files with 593 additions and 575 deletions

View File

@ -78,5 +78,6 @@ func init() {
KeyF36: "\x1b[036q", KeyF36: "\x1b[036q",
KeyClear: "\x1b[144q", KeyClear: "\x1b[144q",
KeyBacktab: "\x1b[Z", KeyBacktab: "\x1b[Z",
AutoMargin: true,
}) })
} }

View File

@ -34,7 +34,7 @@ func init() {
AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~",
EnterAcs: "\x1b(0", EnterAcs: "\x1b(0",
ExitAcs: "\x1b(B", ExitAcs: "\x1b(B",
StrikeThrough:"\x1b[9m", StrikeThrough: "\x1b[9m",
Mouse: "\x1b[<", Mouse: "\x1b[<",
SetCursor: "\x1b[%i%p1%d;%p2%dH", SetCursor: "\x1b[%i%p1%d;%p2%dH",
CursorBack1: "\b", CursorBack1: "\b",
@ -64,5 +64,6 @@ func init() {
KeyF12: "\x1b[24~", KeyF12: "\x1b[24~",
KeyBacktab: "\x1b[Z", KeyBacktab: "\x1b[Z",
Modifiers: 1, Modifiers: 1,
AutoMargin: true,
}) })
} }

View File

@ -38,5 +38,6 @@ func init() {
KeyBackspace: "\b", KeyBackspace: "\b",
KeyHome: "\x1b[H", KeyHome: "\x1b[H",
KeyBacktab: "\x1b[Z", KeyBacktab: "\x1b[Z",
AutoMargin: true,
}) })
} }

View File

@ -51,5 +51,7 @@ func init() {
KeyF10: "\x1b[20~", KeyF10: "\x1b[20~",
KeyF11: "\x1b[21~", KeyF11: "\x1b[21~",
KeyF12: "\x1b[22~", KeyF12: "\x1b[22~",
AutoMargin: true,
InsertChar: "\x1b[@",
}) })
} }

View File

@ -60,5 +60,7 @@ func init() {
KeyF18: "\x1b[32~", KeyF18: "\x1b[32~",
KeyF19: "\x1b[33~", KeyF19: "\x1b[33~",
KeyF20: "\x1b[34~", KeyF20: "\x1b[34~",
AutoMargin: true,
InsertChar: "\x1b[@",
}) })
} }

View File

@ -64,5 +64,6 @@ func init() {
KeyF19: "\x1b[33~", KeyF19: "\x1b[33~",
KeyF20: "\x1b[34~", KeyF20: "\x1b[34~",
KeyHelp: "\x1b[28~", KeyHelp: "\x1b[28~",
AutoMargin: true,
}) })
} }

View File

@ -23,6 +23,7 @@ func init() {
SetCursor: "\x1b[%i%p1%d;%p2%dH", SetCursor: "\x1b[%i%p1%d;%p2%dH",
CursorBack1: "\b", CursorBack1: "\b",
CursorUp1: "\x1b[A", CursorUp1: "\x1b[A",
AutoMargin: true,
}) })
// Emacs term.el terminal emulator term-protocol-version 0.96 // Emacs term.el terminal emulator term-protocol-version 0.96
@ -57,5 +58,6 @@ func init() {
KeyEnd: "\x1b[4~", KeyEnd: "\x1b[4~",
KeyPgUp: "\x1b[5~", KeyPgUp: "\x1b[5~",
KeyPgDn: "\x1b[6~", KeyPgDn: "\x1b[6~",
AutoMargin: true,
}) })
} }

View File

@ -64,6 +64,7 @@ func init() {
KeyF12: "\x1b[24~", KeyF12: "\x1b[24~",
KeyBacktab: "\x1b[Z", KeyBacktab: "\x1b[Z",
Modifiers: 1, Modifiers: 1,
AutoMargin: true,
}) })
// GNOME Terminal with xterm 256-colors // GNOME Terminal with xterm 256-colors
@ -124,5 +125,6 @@ func init() {
KeyF12: "\x1b[24~", KeyF12: "\x1b[24~",
KeyBacktab: "\x1b[Z", KeyBacktab: "\x1b[Z",
Modifiers: 1, Modifiers: 1,
AutoMargin: true,
}) })
} }

View File

@ -46,5 +46,6 @@ func init() {
KeyF7: "\x1bv", KeyF7: "\x1bv",
KeyF8: "\x1bw", KeyF8: "\x1bw",
KeyClear: "\x1bJ", KeyClear: "\x1bJ",
AutoMargin: true,
}) })
} }

View File

@ -34,7 +34,7 @@ func init() {
EnterAcs: "\x0e", EnterAcs: "\x0e",
ExitAcs: "\x0f", ExitAcs: "\x0f",
EnableAcs: "\x1b)0", EnableAcs: "\x1b)0",
StrikeThrough:"\x1b[9m", StrikeThrough: "\x1b[9m",
Mouse: "\x1b[<", Mouse: "\x1b[<",
SetCursor: "\x1b[%i%p1%d;%p2%dH", SetCursor: "\x1b[%i%p1%d;%p2%dH",
CursorBack1: "\b", CursorBack1: "\b",
@ -64,6 +64,7 @@ func init() {
KeyF12: "\x1b[24~", KeyF12: "\x1b[24~",
KeyBacktab: "\x1b[Z", KeyBacktab: "\x1b[Z",
Modifiers: 1, Modifiers: 1,
AutoMargin: true,
}) })
// KDE console window with xterm 256-colors // KDE console window with xterm 256-colors
@ -94,7 +95,7 @@ func init() {
EnterAcs: "\x0e", EnterAcs: "\x0e",
ExitAcs: "\x0f", ExitAcs: "\x0f",
EnableAcs: "\x1b)0", EnableAcs: "\x1b)0",
StrikeThrough:"\x1b[9m", StrikeThrough: "\x1b[9m",
Mouse: "\x1b[<", Mouse: "\x1b[<",
SetCursor: "\x1b[%i%p1%d;%p2%dH", SetCursor: "\x1b[%i%p1%d;%p2%dH",
CursorBack1: "\b", CursorBack1: "\b",
@ -124,5 +125,6 @@ func init() {
KeyF12: "\x1b[24~", KeyF12: "\x1b[24~",
KeyBacktab: "\x1b[Z", KeyBacktab: "\x1b[Z",
Modifiers: 1, Modifiers: 1,
AutoMargin: true,
}) })
} }

View File

@ -63,5 +63,6 @@ func init() {
KeyF18: "\x1b[32~", KeyF18: "\x1b[32~",
KeyF19: "\x1b[33~", KeyF19: "\x1b[33~",
KeyF20: "\x1b[34~", KeyF20: "\x1b[34~",
AutoMargin: true,
}) })
} }

View File

@ -65,5 +65,7 @@ func init() {
KeyF19: "\x1b[33~", KeyF19: "\x1b[33~",
KeyF20: "\x1b[34~", KeyF20: "\x1b[34~",
KeyBacktab: "\x1b[Z", KeyBacktab: "\x1b[Z",
AutoMargin: true,
InsertChar: "\x1b[@",
}) })
} }

View File

@ -238,6 +238,8 @@ func getinfo(name string) (*terminfo.Terminfo, string, error) {
t.SetCursor = tc.getstr("cup") t.SetCursor = tc.getstr("cup")
t.CursorBack1 = tc.getstr("cub1") t.CursorBack1 = tc.getstr("cub1")
t.CursorUp1 = tc.getstr("cuu1") t.CursorUp1 = tc.getstr("cuu1")
t.InsertChar = tc.getstr("ich1")
t.AutoMargin = tc.getflag("am")
t.KeyF1 = tc.getstr("kf1") t.KeyF1 = tc.getstr("kf1")
t.KeyF2 = tc.getstr("kf2") t.KeyF2 = tc.getstr("kf2")
t.KeyF3 = tc.getstr("kf3") t.KeyF3 = tc.getstr("kf3")
@ -605,6 +607,8 @@ func dotGoInfo(w io.Writer, terms []*TData) {
dotGoAddStr(w, "KeyCtrlEnd", t.KeyCtrlEnd) dotGoAddStr(w, "KeyCtrlEnd", t.KeyCtrlEnd)
dotGoAddInt(w, "Modifiers", t.Modifiers) dotGoAddInt(w, "Modifiers", t.Modifiers)
dotGoAddFlag(w, "TrueColor", t.TrueColor) dotGoAddFlag(w, "TrueColor", t.TrueColor)
dotGoAddFlag(w, "AutoMargin", t.AutoMargin)
dotGoAddStr(w, "InsertChar", t.InsertChar)
fmt.Fprintln(w, "\t})") fmt.Fprintln(w, "\t})")
} }
fmt.Fprintln(w, "}") fmt.Fprintln(w, "}")

View File

@ -36,5 +36,6 @@ func init() {
KeyLeft: "\x1b[D", KeyLeft: "\x1b[D",
KeyBackspace: "\b", KeyBackspace: "\b",
KeyHome: "\x1b[H", KeyHome: "\x1b[H",
AutoMargin: true,
}) })
} }

View File

@ -107,6 +107,8 @@ func init() {
KeyCtrlLeft: "\x1b[Od", KeyCtrlLeft: "\x1b[Od",
KeyCtrlHome: "\x1b[7^", KeyCtrlHome: "\x1b[7^",
KeyCtrlEnd: "\x1b[8^", KeyCtrlEnd: "\x1b[8^",
AutoMargin: true,
InsertChar: "\x1b[@",
}) })
// rxvt 2.7.9 with xterm 256-colors // rxvt 2.7.9 with xterm 256-colors
@ -210,6 +212,8 @@ func init() {
KeyCtrlLeft: "\x1b[Od", KeyCtrlLeft: "\x1b[Od",
KeyCtrlHome: "\x1b[7^", KeyCtrlHome: "\x1b[7^",
KeyCtrlEnd: "\x1b[8^", KeyCtrlEnd: "\x1b[8^",
AutoMargin: true,
InsertChar: "\x1b[@",
}) })
// rxvt 2.7.9 with xterm 88-colors // rxvt 2.7.9 with xterm 88-colors
@ -313,6 +317,8 @@ func init() {
KeyCtrlLeft: "\x1b[Od", KeyCtrlLeft: "\x1b[Od",
KeyCtrlHome: "\x1b[7^", KeyCtrlHome: "\x1b[7^",
KeyCtrlEnd: "\x1b[8^", KeyCtrlEnd: "\x1b[8^",
AutoMargin: true,
InsertChar: "\x1b[@",
}) })
// rxvt-unicode terminal (X Window System) // rxvt-unicode terminal (X Window System)
@ -392,6 +398,8 @@ func init() {
KeyCtrlLeft: "\x1b[Od", KeyCtrlLeft: "\x1b[Od",
KeyCtrlHome: "\x1b[7^", KeyCtrlHome: "\x1b[7^",
KeyCtrlEnd: "\x1b[8^", KeyCtrlEnd: "\x1b[8^",
AutoMargin: true,
InsertChar: "\x1b[@",
}) })
// rxvt-unicode terminal with 256 colors (X Window System) // rxvt-unicode terminal with 256 colors (X Window System)
@ -471,5 +479,7 @@ func init() {
KeyCtrlLeft: "\x1b[Od", KeyCtrlLeft: "\x1b[Od",
KeyCtrlHome: "\x1b[7^", KeyCtrlHome: "\x1b[7^",
KeyCtrlEnd: "\x1b[8^", KeyCtrlEnd: "\x1b[8^",
AutoMargin: true,
InsertChar: "\x1b[@",
}) })
} }

View File

@ -63,6 +63,7 @@ func init() {
KeyF11: "\x1b[23~", KeyF11: "\x1b[23~",
KeyF12: "\x1b[24~", KeyF12: "\x1b[24~",
KeyBacktab: "\x1b[Z", KeyBacktab: "\x1b[Z",
AutoMargin: true,
}) })
// GNU Screen with 256 colors // GNU Screen with 256 colors
@ -122,5 +123,6 @@ func init() {
KeyF11: "\x1b[23~", KeyF11: "\x1b[23~",
KeyF12: "\x1b[24~", KeyF12: "\x1b[24~",
KeyBacktab: "\x1b[Z", KeyBacktab: "\x1b[Z",
AutoMargin: true,
}) })
} }

View File

@ -35,7 +35,7 @@ func init() {
EnterAcs: "\x1b(0", EnterAcs: "\x1b(0",
ExitAcs: "\x1b(B", ExitAcs: "\x1b(B",
EnableAcs: "\x1b)0", EnableAcs: "\x1b)0",
StrikeThrough:"\x1b[9m", StrikeThrough: "\x1b[9m",
Mouse: "\x1b[M", Mouse: "\x1b[M",
SetCursor: "\x1b[%i%p1%d;%p2%dH", SetCursor: "\x1b[%i%p1%d;%p2%dH",
CursorBack1: "\b", CursorBack1: "\b",
@ -67,6 +67,7 @@ func init() {
KeyBacktab: "\x1b[Z", KeyBacktab: "\x1b[Z",
Modifiers: 1, Modifiers: 1,
TrueColor: true, TrueColor: true,
AutoMargin: true,
}) })
// simpleterm with 256 colors // simpleterm with 256 colors
@ -98,7 +99,7 @@ func init() {
EnterAcs: "\x1b(0", EnterAcs: "\x1b(0",
ExitAcs: "\x1b(B", ExitAcs: "\x1b(B",
EnableAcs: "\x1b)0", EnableAcs: "\x1b)0",
StrikeThrough:"\x1b[9m", StrikeThrough: "\x1b[9m",
Mouse: "\x1b[M", Mouse: "\x1b[M",
SetCursor: "\x1b[%i%p1%d;%p2%dH", SetCursor: "\x1b[%i%p1%d;%p2%dH",
CursorBack1: "\b", CursorBack1: "\b",
@ -130,5 +131,6 @@ func init() {
KeyBacktab: "\x1b[Z", KeyBacktab: "\x1b[Z",
Modifiers: 1, Modifiers: 1,
TrueColor: true, TrueColor: true,
AutoMargin: true,
}) })
} }

View File

@ -43,6 +43,8 @@ func init() {
KeyF10: "\x1b[233z", KeyF10: "\x1b[233z",
KeyF11: "\x1b[234z", KeyF11: "\x1b[234z",
KeyF12: "\x1b[235z", KeyF12: "\x1b[235z",
AutoMargin: true,
InsertChar: "\x1b[@",
}) })
// Sun Microsystems Workstation console with color support (IA systems) // Sun Microsystems Workstation console with color support (IA systems)
@ -87,5 +89,7 @@ func init() {
KeyF10: "\x1b[233z", KeyF10: "\x1b[233z",
KeyF11: "\x1b[234z", KeyF11: "\x1b[234z",
KeyF12: "\x1b[235z", KeyF12: "\x1b[235z",
AutoMargin: true,
InsertChar: "\x1b[@",
}) })
} }

View File

@ -61,5 +61,7 @@ func init() {
KeyF12: "\x1b[24~", KeyF12: "\x1b[24~",
KeyBacktab: "\x1b[Z", KeyBacktab: "\x1b[Z",
Modifiers: 1, Modifiers: 1,
AutoMargin: true,
InsertChar: "\x1b[@",
}) })
} }

View File

@ -66,67 +66,6 @@ func init() {
KeyF12: "\x1b[24~", KeyF12: "\x1b[24~",
KeyBacktab: "\x1b[Z", KeyBacktab: "\x1b[Z",
Modifiers: 1, Modifiers: 1,
}) AutoMargin: true,
// tmux with 256 colors
terminfo.AddTerminfo(&terminfo.Terminfo{
Name: "tmux-256color",
Columns: 80,
Lines: 24,
Colors: 256,
Bell: "\a",
Clear: "\x1b[H\x1b[J",
EnterCA: "\x1b[?1049h",
ExitCA: "\x1b[?1049l",
ShowCursor: "\x1b[34h\x1b[?25h",
HideCursor: "\x1b[?25l",
AttrOff: "\x1b[m\x0f",
Underline: "\x1b[4m",
Bold: "\x1b[1m",
Dim: "\x1b[2m",
Italic: "\x1b[3m",
Blink: "\x1b[5m",
Reverse: "\x1b[7m",
EnterKeypad: "\x1b[?1h\x1b=",
ExitKeypad: "\x1b[?1l\x1b>",
SetFg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;m",
SetBg: "\x1b[%?%p1%{8}%<%t4%p1%d%e%p1%{16}%<%t10%p1%{8}%-%d%e48;5;%p1%d%;m",
SetFgBg: "\x1b[%?%p1%{8}%<%t3%p1%d%e%p1%{16}%<%t9%p1%{8}%-%d%e38;5;%p1%d%;;%?%p2%{8}%<%t4%p2%d%e%p2%{16}%<%t10%p2%{8}%-%d%e48;5;%p2%d%;m",
ResetFgBg: "\x1b[39;49m",
PadChar: "\x00",
AltChars: "++,,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~",
EnterAcs: "\x0e",
ExitAcs: "\x0f",
EnableAcs: "\x1b(B\x1b)0",
StrikeThrough: "\x1b[9m",
Mouse: "\x1b[M",
SetCursor: "\x1b[%i%p1%d;%p2%dH",
CursorBack1: "\b",
CursorUp1: "\x1bM",
KeyUp: "\x1bOA",
KeyDown: "\x1bOB",
KeyRight: "\x1bOC",
KeyLeft: "\x1bOD",
KeyInsert: "\x1b[2~",
KeyDelete: "\x1b[3~",
KeyBackspace: "\u007f",
KeyHome: "\x1b[1~",
KeyEnd: "\x1b[4~",
KeyPgUp: "\x1b[5~",
KeyPgDn: "\x1b[6~",
KeyF1: "\x1bOP",
KeyF2: "\x1bOQ",
KeyF3: "\x1bOR",
KeyF4: "\x1bOS",
KeyF5: "\x1b[15~",
KeyF6: "\x1b[17~",
KeyF7: "\x1b[18~",
KeyF8: "\x1b[19~",
KeyF9: "\x1b[20~",
KeyF10: "\x1b[21~",
KeyF11: "\x1b[23~",
KeyF12: "\x1b[24~",
KeyBacktab: "\x1b[Z",
Modifiers: 1,
}) })
} }

View File

@ -1,4 +1,5 @@
// Copyright 2020 The TCell Authors // Copyright 2020 The TCell Authors
// Copyright 2020 The TCell Authors
// //
// Licensed under the Apache License, Version 2.0 (the "License"); // Licensed under the Apache License, Version 2.0 (the "License");
// you may not use file except in compliance with the License. // you may not use file except in compliance with the License.
@ -217,6 +218,8 @@ type Terminfo struct {
PasteStart string PasteStart string
PasteEnd string PasteEnd string
Modifiers int Modifiers int
InsertChar string // string to insert a character (ich1)
AutoMargin bool // true if writing to last cell in line advances
TrueColor bool // true if the terminal supports direct color TrueColor bool // true if the terminal supports direct color
} }

View File

@ -44,5 +44,6 @@ func init() {
KeyF8: "\x1bOl", KeyF8: "\x1bOl",
KeyF9: "\x1bOw", KeyF9: "\x1bOw",
KeyF10: "\x1bOx", KeyF10: "\x1bOx",
AutoMargin: true,
}) })
} }

View File

@ -43,5 +43,6 @@ func init() {
KeyF8: "\x1bOl", KeyF8: "\x1bOl",
KeyF9: "\x1bOw", KeyF9: "\x1bOw",
KeyF10: "\x1bOx", KeyF10: "\x1bOx",
AutoMargin: true,
}) })
} }

View File

@ -54,5 +54,6 @@ func init() {
KeyF19: "\x1b[33~", KeyF19: "\x1b[33~",
KeyF20: "\x1b[34~", KeyF20: "\x1b[34~",
KeyHelp: "\x1b[28~", KeyHelp: "\x1b[28~",
AutoMargin: true,
}) })
} }

View File

@ -59,5 +59,6 @@ func init() {
KeyF18: "\x1b[32~", KeyF18: "\x1b[32~",
KeyF19: "\x1b[33~", KeyF19: "\x1b[33~",
KeyF20: "\x1b[34~", KeyF20: "\x1b[34~",
AutoMargin: true,
}) })
} }

View File

@ -42,5 +42,7 @@ func init() {
KeyF7: "\x1b[18~", KeyF7: "\x1b[18~",
KeyF8: "\x1b[19~", KeyF8: "\x1b[19~",
KeyF9: "\x1b[20~", KeyF9: "\x1b[20~",
AutoMargin: true,
InsertChar: "\x1b[@",
}) })
} }

View File

@ -49,5 +49,6 @@ func init() {
KeyF8: "\x1b[20~", KeyF8: "\x1b[20~",
KeyF9: "\x1b[21~", KeyF9: "\x1b[21~",
KeyF10: "\x1b[29~", KeyF10: "\x1b[29~",
AutoMargin: true,
}) })
} }

View File

@ -55,5 +55,6 @@ func init() {
KeyPrint: "\x1bP", KeyPrint: "\x1bP",
KeyBacktab: "\x1bI", KeyBacktab: "\x1bI",
KeyShfHome: "\x1b{", KeyShfHome: "\x1b{",
AutoMargin: true,
}) })
} }

View File

@ -59,5 +59,6 @@ func init() {
KeyPrint: "\x1bP", KeyPrint: "\x1bP",
KeyBacktab: "\x1bI", KeyBacktab: "\x1bI",
KeyShfHome: "\x1b{", KeyShfHome: "\x1b{",
AutoMargin: true,
}) })
} }

View File

@ -57,6 +57,7 @@ func init() {
KeyF23: "\x1b[1~", KeyF23: "\x1b[1~",
KeyF24: "\x1b[2~", KeyF24: "\x1b[2~",
KeyBacktab: "\x1b[z", KeyBacktab: "\x1b[z",
AutoMargin: true,
}) })
// Wyse WY-99GT in ansi mode (US PC keyboard) // Wyse WY-99GT in ansi mode (US PC keyboard)
@ -110,5 +111,6 @@ func init() {
KeyF23: "\x1b[1~", KeyF23: "\x1b[1~",
KeyF24: "\x1b[2~", KeyF24: "\x1b[2~",
KeyBacktab: "\x1b[z", KeyBacktab: "\x1b[z",
AutoMargin: true,
}) })
} }

View File

@ -62,5 +62,6 @@ func init() {
KeyF12: "\x1b[24~", KeyF12: "\x1b[24~",
KeyBacktab: "\x1b[Z", KeyBacktab: "\x1b[Z",
Modifiers: 1, Modifiers: 1,
AutoMargin: true,
}) })
} }

View File

@ -35,7 +35,7 @@ func init() {
AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~",
EnterAcs: "\x1b(0", EnterAcs: "\x1b(0",
ExitAcs: "\x1b(B", ExitAcs: "\x1b(B",
StrikeThrough:"\x1b[9m", StrikeThrough: "\x1b[9m",
Mouse: "\x1b[M", Mouse: "\x1b[M",
SetCursor: "\x1b[%i%p1%d;%p2%dH", SetCursor: "\x1b[%i%p1%d;%p2%dH",
CursorBack1: "\b", CursorBack1: "\b",
@ -65,6 +65,7 @@ func init() {
KeyF12: "\x1b[24~", KeyF12: "\x1b[24~",
KeyBacktab: "\x1b[Z", KeyBacktab: "\x1b[Z",
Modifiers: 1, Modifiers: 1,
AutoMargin: true,
}) })
// xterm with 88 colors // xterm with 88 colors
@ -95,7 +96,7 @@ func init() {
AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~",
EnterAcs: "\x1b(0", EnterAcs: "\x1b(0",
ExitAcs: "\x1b(B", ExitAcs: "\x1b(B",
StrikeThrough:"\x1b[9m", StrikeThrough: "\x1b[9m",
Mouse: "\x1b[M", Mouse: "\x1b[M",
SetCursor: "\x1b[%i%p1%d;%p2%dH", SetCursor: "\x1b[%i%p1%d;%p2%dH",
CursorBack1: "\b", CursorBack1: "\b",
@ -125,6 +126,7 @@ func init() {
KeyF12: "\x1b[24~", KeyF12: "\x1b[24~",
KeyBacktab: "\x1b[Z", KeyBacktab: "\x1b[Z",
Modifiers: 1, Modifiers: 1,
AutoMargin: true,
}) })
// xterm with 256 colors // xterm with 256 colors
@ -155,7 +157,7 @@ func init() {
AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", AltChars: "``aaffggiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~",
EnterAcs: "\x1b(0", EnterAcs: "\x1b(0",
ExitAcs: "\x1b(B", ExitAcs: "\x1b(B",
StrikeThrough:"\x1b[9m", StrikeThrough: "\x1b[9m",
Mouse: "\x1b[M", Mouse: "\x1b[M",
SetCursor: "\x1b[%i%p1%d;%p2%dH", SetCursor: "\x1b[%i%p1%d;%p2%dH",
CursorBack1: "\b", CursorBack1: "\b",
@ -185,5 +187,6 @@ func init() {
KeyF12: "\x1b[24~", KeyF12: "\x1b[24~",
KeyBacktab: "\x1b[Z", KeyBacktab: "\x1b[Z",
Modifiers: 1, Modifiers: 1,
AutoMargin: true,
}) })
} }

View File

@ -33,7 +33,7 @@ func init() {
AltChars: "++,,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~", AltChars: "++,,--..00``aaffgghhiijjkkllmmnnooppqqrrssttuuvvwwxxyyzz{{||}}~~",
EnterAcs: "\x1b(0", EnterAcs: "\x1b(0",
ExitAcs: "\x1b(B", ExitAcs: "\x1b(B",
StrikeThrough:"\x1b[9m", StrikeThrough: "\x1b[9m",
Mouse: "\x1b[M", Mouse: "\x1b[M",
SetCursor: "\x1b[%i%p1%d;%p2%dH", SetCursor: "\x1b[%i%p1%d;%p2%dH",
CursorBack1: "\b", CursorBack1: "\b",
@ -64,5 +64,6 @@ func init() {
KeyBacktab: "\x1b[Z", KeyBacktab: "\x1b[Z",
Modifiers: 1, Modifiers: 1,
TrueColor: true, TrueColor: true,
AutoMargin: true,
}) })
} }

View File

@ -628,7 +628,24 @@ func (t *tScreen) drawCell(x, y int) int {
return width return width
} }
if t.cy != y || t.cx != x { if y == t.h-1 && x == t.w-1 && t.ti.AutoMargin && ti.InsertChar != "" {
// our solution is somewhat goofy.
// we write to the second to the last cell what we want in the last cell, then we
// insert a character at that 2nd to last position to shift the last column into
// place, then we rewrite that 2nd to last cell. Old terminals suck.
t.TPuts(ti.TGoto(x-1, y))
defer func() {
t.TPuts(ti.TGoto(x-1, y))
t.TPuts(ti.InsertChar)
t.cy = y
t.cx = x-1
t.cells.SetDirty(x-1, y, true)
_ = t.drawCell(x-1, y)
t.TPuts(t.ti.TGoto(0, 0))
t.cy = 0
t.cx = 0
}()
} else if t.cy != y || t.cx != x {
t.TPuts(ti.TGoto(x, y)) t.TPuts(ti.TGoto(x, y))
t.cx = x t.cx = x
t.cy = y t.cy = y