From 8e340dabbca2c43eb29a69c264033fbd7513faa3 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Wed, 15 Jul 2026 18:23:08 +0900 Subject: [PATCH] Use CHA for absolute horizontal cursor movement Related: - #4858 - https://github.com/zellij-org/zellij/issues/5370 --- src/tui/light.go | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/tui/light.go b/src/tui/light.go index 3e618079..593b2be6 100644 --- a/src/tui/light.go +++ b/src/tui/light.go @@ -256,9 +256,12 @@ func (r *LightRenderer) move(y int, x int) { } else if r.y > y { r.csi(fmt.Sprintf("%dA", r.y-y)) } - r.stderr("\r") - if x > 0 { - r.csi(fmt.Sprintf("%dC", x)) + // Use CHA instead of CR+CUF; Zellij misplaces the next character when + // CUF moves the cursor over cells that have not been written to yet. + if x == 0 { + r.stderr("\r") + } else { + r.csi(fmt.Sprintf("%dG", x+1)) } r.y = y r.x = x