Skip to content

Commit

Permalink
Fix line wrap toggle when switching between screens
Browse files Browse the repository at this point in the history
Fix #4099
  • Loading branch information
junegunn committed Dec 2, 2024
1 parent 3e6e052 commit e182d3d
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/tui/light.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,15 @@ func (r *LightRenderer) csi(code string) string {

func (r *LightRenderer) flush() {
if r.queued.Len() > 0 {
fmt.Fprint(r.ttyout, "\x1b[?7l\x1b[?25l"+r.queued.String()+"\x1b[?25h\x1b[?7h")
r.flushRaw("\x1b[?7l\x1b[?25l" + r.queued.String() + "\x1b[?25h\x1b[?7h")
r.queued.Reset()
}
}

func (r *LightRenderer) flushRaw(sequence string) {
fmt.Fprint(r.ttyout, sequence)
}

// Light renderer
type LightRenderer struct {
closed *util.AtomicBool
Expand Down Expand Up @@ -655,11 +659,13 @@ func (r *LightRenderer) mouseSequence(sz *int) Event {
}

func (r *LightRenderer) smcup() {
r.csi("?1049h")
r.flush()
r.flushRaw("\x1b[?1049h")
}

func (r *LightRenderer) rmcup() {
r.csi("?1049l")
r.flush()
r.flushRaw("\x1b[?1049l")
}

func (r *LightRenderer) Pause(clear bool) {
Expand Down

0 comments on commit e182d3d

Please sign in to comment.