mirror of
https://github.com/charmbracelet/glow.git
synced 2026-08-21 15:44:17 +02:00
Don't set a note if the note didn't actually change
This commit is contained in:
parent
8695bffa2e
commit
1219d22834
1 changed files with 6 additions and 2 deletions
|
|
@ -120,10 +120,14 @@ func pagerUpdate(msg boba.Msg, m pagerModel) (pagerModel, boba.Cmd) {
|
|||
m.state = pagerStateBrowse
|
||||
return m, nil
|
||||
case "enter":
|
||||
m.currentDocument.Note = m.textInput.Value() // update optimistically
|
||||
var cmd boba.Cmd
|
||||
if m.textInput.Value() != m.currentDocument.Note { // don't update if the note didn't change
|
||||
m.currentDocument.Note = m.textInput.Value() // update optimistically
|
||||
cmd = saveDocumentNote(m.cc, m.currentDocument.ID, m.currentDocument.Note)
|
||||
}
|
||||
m.state = pagerStateBrowse
|
||||
m.textInput.Reset()
|
||||
return m, saveDocumentNote(m.cc, m.currentDocument.ID, m.currentDocument.Note)
|
||||
return m, cmd
|
||||
}
|
||||
default:
|
||||
switch msg.String() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue