detached c56e04a

fix(tui): correct btw cursor offset

Only count the dialog frame padding row when padDialogFrame actually inserts it, so the btw editor cursor stays on the input row after a turn.

Co-authored-by: mi-skam <40042054+mi-skam@users.noreply.github.com>
commit
c56e04afd51f6351f86851f7ac9d46fe7020702a
author
patriceckhart · · 2026-06-22 05:47 UTC
parent
ab3d4c5
signature
unsigned
1 file · +6 -4
M packages/agent/modes/btw_dialog.go +6 -4
@@ -378,12 +378,14 @@ func (d *btwDialog) CursorPos(width int) (row, col int) {
378378 }
379379 // Reproduce render's structure to find where the editor sits.
380380 // Note: the parent (interactive.go) wraps every dialog with
381- // padDialogFrame, which injects a blank row right after the
382- // frame header. We have to count that injected row here too;
383- // otherwise the reported cursor lands one row above the editor.
381+ // padDialogFrame. It only injects a blank row after the frame
382+ // header when Render did not already put one there. With existing
383+ // turns or a loading spinner, Render's first body row is already
384+ // blank, so counting an extra pad row would place the cursor one
385+ // row too low.
384386 editorOffset := 1 // header
385- editorOffset++ // padDialogFrame's post-header blank
386387 if len(d.turns) == 0 && !d.loading {
388+ editorOffset++ // padDialogFrame's post-header blank
387389 editorOffset++ // muted "ask anything..." line
388390 }
389391 for _, t := range d.turns {
@@ -378,12 +378,14 @@ func (d *btwDialog) CursorPos(width int) (row, col int) {
378 }378 }
379 // Reproduce render's structure to find where the editor sits.379 // Reproduce render's structure to find where the editor sits.
380 // Note: the parent (interactive.go) wraps every dialog with380 // Note: the parent (interactive.go) wraps every dialog with
381- // padDialogFrame, which injects a blank row right after the381+ // padDialogFrame. It only injects a blank row after the frame
382- // frame header. We have to count that injected row here too;382+ // header when Render did not already put one there. With existing
383- // otherwise the reported cursor lands one row above the editor.383+ // turns or a loading spinner, Render's first body row is already
384+ // blank, so counting an extra pad row would place the cursor one
385+ // row too low.
384 editorOffset := 1 // header386 editorOffset := 1 // header
385- editorOffset++ // padDialogFrame's post-header blank
386 if len(d.turns) == 0 && !d.loading {387 if len(d.turns) == 0 && !d.loading {
388+ editorOffset++ // padDialogFrame's post-header blank
387 editorOffset++ // muted "ask anything..." line389 editorOffset++ // muted "ask anything..." line
388 }390 }
389 for _, t := range d.turns {391 for _, t := range d.turns {

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 1

Tags 476

↑↓ moveenter openesc close