mirror of
https://github.com/charmbracelet/glow
synced 2024-11-10 06:04:18 +00:00
Pre-populate note field with exisiting note
This commit is contained in:
parent
04f1ebfa23
commit
8695bffa2e
1 changed files with 6 additions and 1 deletions
|
@ -120,7 +120,7 @@ func pagerUpdate(msg boba.Msg, m pagerModel) (pagerModel, boba.Cmd) {
|
|||
m.state = pagerStateBrowse
|
||||
return m, nil
|
||||
case "enter":
|
||||
m.currentDocument.Note = m.textInput.Value // set optimistically
|
||||
m.currentDocument.Note = m.textInput.Value() // update optimistically
|
||||
m.state = pagerStateBrowse
|
||||
m.textInput.Reset()
|
||||
return m, saveDocumentNote(m.cc, m.currentDocument.ID, m.currentDocument.Note)
|
||||
|
@ -136,6 +136,11 @@ func pagerUpdate(msg boba.Msg, m pagerModel) (pagerModel, boba.Cmd) {
|
|||
}
|
||||
case "n":
|
||||
m.state = pagerStateSetNote
|
||||
if m.textInput.Value() == "" {
|
||||
// Pre-populate with existing value
|
||||
m.textInput.SetValue(m.currentDocument.Note)
|
||||
m.textInput.CursorEnd()
|
||||
}
|
||||
return m, textinput.Blink(m.textInput)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue