zot/internal/tui
patriceckhart 1be3f85a47 fix(tui): cursor after multi-line paste lands in wrong column
wrapLine()'s internal newLine() toggled the firstLine flag BEFORE
checking it, so the very first wrap continuation flushed to the
output WITHOUT the cont indent. Second and later continuations
were fine. Visible as:

  0: '▌ this is a very long first line that'
  1: 'will wrap around terminal boundaries'       <- no indent
  2: '  still wrapping further past this point'   <- indented

Downstream, locateCursor() in the editor assumed continuation rows
always start with cont and stripped its width when counting runes.
When the first continuation didn't actually have it, the stripping
was a no-op but the leadW was still added, so the reported visual
column for the cursor drifted by cont-width (2 cells) to the right.

Effect for the user: after drag-dropping a multi-line payload (or
pasting any text where the first paragraph wraps), the terminal
cursor rendered mid-text instead of at the end of the pasted
content. Typing still appended at the correct logical position,
so keystrokes landed in the right place in the buffer, it was
purely visual drift.

Fix: in newLine(), always write cont to cur after flushing (and
after setting firstLine = false). That makes the second row, and
every subsequent wrap continuation, carry the indent consistently.

Added three regression tests:
  - wrapLine directly: every row >= 1 has cont prefix
  - editor multi-line paste: cursor lands at logical end with
    correct visual (row, col)
  - editor long-paste-with-wrap: wrap continuations all indented
    AND cursor still lands at correct column
2026-04-19 19:50:19 +02:00
..
editor.go fix(tui): cursor after multi-line paste lands in wrong column 2026-04-19 19:50:19 +02:00
highlight.go chore: scrub stray "pi" references from source comments 2026-04-19 17:06:45 +02:00
image.go fix ci: portable syscall.Select via x/sys/unix; gofmt pass 2026-04-18 10:55:42 +02:00
input.go add collapsible code blocks 2026-04-18 10:30:29 +02:00
markdown.go fix code highlighting 2026-04-18 10:16:06 +02:00
quote_paste_test.go tui: quote drag-dropped file paths in the input editor 2026-04-19 13:01:37 +02:00
render.go tui: quote drag-dropped file paths in the input editor 2026-04-19 13:01:37 +02:00
resize_unix.go fix ci: portable syscall.Select via x/sys/unix; gofmt pass 2026-04-18 10:55:42 +02:00
resize_windows.go initial commit 2026-04-17 20:36:38 +02:00
statusbar_test.go feat(ext): phase 4 - full-event interception, arg rewrites, /reload-ext 2026-04-19 17:02:04 +02:00
terminal.go initial commit 2026-04-17 20:36:38 +02:00
theme.go fix ci: portable syscall.Select via x/sys/unix; gofmt pass 2026-04-18 10:55:42 +02:00
view.go perf(read): drop line numbers from model-facing output 2026-04-19 17:33:05 +02:00
wrap_test.go fix(tui): cursor after multi-line paste lands in wrong column 2026-04-19 19:50:19 +02:00