Use CHA for absolute horizontal cursor movement

Related:
- #4858
- https://github.com/zellij-org/zellij/issues/5370
This commit is contained in:
Junegunn Choi
2026-07-15 18:23:08 +09:00
parent 4dcedc01df
commit 8e340dabbc
+6 -3
View File
@@ -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