Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions cursed_renderer.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,11 @@ func (s *cursedRenderer) setOptimizations(hardTabs, backspace, mapnl bool) {
s.hardTabs = hardTabs
s.backspace = backspace
s.mapnl = mapnl
s.scr.SetTabStops(s.width)
if s.hardTabs {
s.scr.SetTabStops(s.width)
} else {
s.scr.SetTabStops(-1)
}
s.scr.SetBackspace(s.backspace)
s.scr.SetMapNewline(s.mapnl)
s.mu.Unlock()
Expand Down Expand Up @@ -275,6 +279,11 @@ func (s *cursedRenderer) flush(closing bool) error {
}
}

// Restore tab stops if we have tab optimizations enabled.
if s.starting && s.hardTabs {
_, _ = s.scr.WriteString(ansi.SetTabEvery8Columns)
}

if !s.starting && !closing && s.lastView != nil && viewEquals(s.lastView, &view) && frameArea == s.cellbuf.Bounds() {
// No changes, nothing to do.
return nil
Expand Down Expand Up @@ -587,7 +596,11 @@ func reset(s *cursedRenderer) {
scr.SetColorProfile(s.profile)
scr.SetRelativeCursor(true) // Always start in inline mode
scr.SetFullscreen(false) // Always start in inline mode
scr.SetTabStops(s.width)
if s.hardTabs {
scr.SetTabStops(s.width)
} else {
scr.SetTabStops(-1)
}
scr.SetBackspace(s.backspace)
scr.SetMapNewline(s.mapnl)
scr.SetScrollOptim(runtime.GOOS != "windows") // disable scroll optimization on Windows due to bugs in some terminals
Expand Down
2 changes: 1 addition & 1 deletion testdata/TestViewModel/altscreen_autoexit.golden
Original file line number Diff line number Diff line change
@@ -1 +1 @@
[>4m[=0;1u[?1049h[?25l[?2004h[>4;2m[=1;1usuccess[>4m[=0;1u[?1049l[?25h[?2004l[?2026$p[?2027$p
[>4m[=0;1u[?1049h[?25l[?2004h[>4;2m[=1;1usuccess[>4m[=0;1u[?1049l[?25h[?2004l[?2026$p[?2027$p
Loading