Skip to content

Commit 05ed129

Browse files
committed
fix: scroll cursor to top after paste into empty editor
1 parent 9f1ebbe commit 05ed129

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

internal/tui/editor_panel.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@ func (p *editorPanel) update(msg tea.Msg) tea.Cmd {
8989
// Remove the path from textarea — it's now an object.
9090
p.textarea.SetValue(prevValue)
9191
}
92+
93+
// Paste into empty editor: scroll cursor to top so text is visible.
94+
if prevValue == "" && len(newValue) > 1 {
95+
for range p.estimateVisualLines() + 10 {
96+
p.textarea.CursorUp()
97+
}
98+
p.textarea.CursorStart()
99+
}
92100
}
93101

94102
p.reclassify()

0 commit comments

Comments
 (0)