C-j fix; tool doc upd

This commit is contained in:
Luxferre
2026-09-09 20:33:07 +03:00
parent 4ed12ed213
commit ed5eb88ba9
2 changed files with 8 additions and 5 deletions
+4 -1
View File
@@ -1598,7 +1598,10 @@ func (e *editor) draw() {
er, _ := textPos(P, W, s, len([]rune(s)))
pr, pc := textPos(P, W, s, e.pos)
if e.crow > 0 { fmt.Printf("\033[%dA", e.crow) }
fmt.Print("\r\033[J" + e.prompt + s)
// In raw mode OPOST is off, so a bare \n only moves down without
// returning to column 0. Emit \r\n so each logical line starts at
// column 0, matching the column-reset assumption in textPos().
fmt.Print("\r\033[J" + e.prompt + strings.ReplaceAll(s, "\n", "\r\n"))
if up := er - pr; up > 0 { fmt.Printf("\033[%dA", up) }
fmt.Print("\r")
if pc > 0 { fmt.Printf("\033[%dC", pc) }