detached fb3e1af

fix btw cursor row and column alignment

commit
fb3e1afa802373c7a6149287ba492eaccbdb59b9
author
patriceckhart · · 2026-05-26 16:55 UTC
parent
d55af26
signature
unsigned
refs
tag: v0.1.99
1 file · +10 -3
M internal/agent/modes/btw_dialog.go +10 -3
@@ -348,7 +348,10 @@ func (d *btwDialog) Render(th tui.Theme, width int) []string {
348348
349349 out = append(out, "")
350350 if d.editor != nil {
351- edLines, _, _ := d.editor.Render(width)
351+ // Render at width-2 to match the two-cell left indent applied
352+ // below. CursorPos uses the same width so the reported cursor
353+ // column matches the wrapped layout shown on screen.
354+ edLines, _, _ := d.editor.Render(width - 2)
352355 for _, l := range edLines {
353356 // Indent the editor body so it lines up with the side-chat
354357 // content column. Editor's prompt already includes a left
@@ -371,9 +374,13 @@ func (d *btwDialog) CursorPos(width int) (row, col int) {
371374 if !d.active || d.editor == nil {
372375 return -1, -1
373376 }
374- // Reproduce render's structure to find where the editor sits:
375- // header (1) + (turns_section_lines) + (loading?) + blank (1) + editor
377+ // Reproduce render's structure to find where the editor sits.
378+ // Note: the parent (interactive.go) wraps every dialog with
379+ // padDialogFrame, which injects a blank row right after the
380+ // frame header. We have to count that injected row here too;
381+ // otherwise the reported cursor lands one row above the editor.
376382 editorOffset := 1 // header
383+ editorOffset++ // padDialogFrame's post-header blank
377384 if len(d.turns) == 0 && !d.loading {
378385 editorOffset++ // muted "ask anything..." line
379386 }
@@ -348,7 +348,10 @@ func (d *btwDialog) Render(th tui.Theme, width int) []string {
348 348
349 out = append(out, "")349 out = append(out, "")
350 if d.editor != nil {350 if d.editor != nil {
351- edLines, _, _ := d.editor.Render(width)351+ // Render at width-2 to match the two-cell left indent applied
352+ // below. CursorPos uses the same width so the reported cursor
353+ // column matches the wrapped layout shown on screen.
354+ edLines, _, _ := d.editor.Render(width - 2)
352 for _, l := range edLines {355 for _, l := range edLines {
353 // Indent the editor body so it lines up with the side-chat356 // Indent the editor body so it lines up with the side-chat
354 // content column. Editor's prompt already includes a left357 // content column. Editor's prompt already includes a left
@@ -371,9 +374,13 @@ func (d *btwDialog) CursorPos(width int) (row, col int) {
371 if !d.active || d.editor == nil {374 if !d.active || d.editor == nil {
372 return -1, -1375 return -1, -1
373 }376 }
374- // Reproduce render's structure to find where the editor sits:377+ // Reproduce render's structure to find where the editor sits.
375- // header (1) + (turns_section_lines) + (loading?) + blank (1) + editor378+ // Note: the parent (interactive.go) wraps every dialog with
379+ // padDialogFrame, which injects a blank row right after the
380+ // frame header. We have to count that injected row here too;
381+ // otherwise the reported cursor lands one row above the editor.
376 editorOffset := 1 // header382 editorOffset := 1 // header
383+ editorOffset++ // padDialogFrame's post-header blank
377 if len(d.turns) == 0 && !d.loading {384 if len(d.turns) == 0 && !d.loading {
378 editorOffset++ // muted "ask anything..." line385 editorOffset++ // muted "ask anything..." line
379 }386 }

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