1
0
mirror of https://github.com/jesseduffield/lazygit.git synced 2025-07-05 00:59:19 +02:00

force cursor to be at end of line when opening confirmation panel

This commit is contained in:
Jesse Duffield
2021-04-17 20:53:36 +10:00
parent 9e5f031553
commit b28b2d05bd
9 changed files with 89 additions and 26 deletions

View File

@ -86,6 +86,24 @@ func (v *View) EditWrite(ch rune) {
v.moveCursor(w, 0, true)
}
func (v *View) EditWriteString(str string) {
for _, ch := range str {
v.EditWrite(ch)
}
}
func (v *View) SetEditorContent(content string) error {
v.Clear()
if err := v.SetOrigin(0, 0); err != nil {
return err
}
if err := v.SetCursor(0, 0); err != nil {
return err
}
v.EditWriteString(content)
return nil
}
// EditDeleteToStartOfLine is the equivalent of pressing ctrl+U in your terminal, it deletes to the start of the line. Or if you are already at the start of the line, it deletes the newline character
func (v *View) EditDeleteToStartOfLine() {
x, _ := v.Cursor()