Skip to content

Commit

Permalink
[add] unchange guard
Browse files Browse the repository at this point in the history
  • Loading branch information
yumafuu committed Jul 26, 2024
1 parent f8ef531 commit cc4b0ec
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion tui/vbox/workflow.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,18 @@ func (v *ValueBox) WorkflowUpdateParam(param ssm.Parameter) {
v.TextArea.SetText(*param.Value, true)
v.TextArea.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey {
s := v.GetText()
prev := v.GetPrev().Value

v.param.Value = &s

if event.Key() == tcell.KeyESC {
v.TextArea.SetBorderColor(tcell.ColorDefault)
v.pubsub.Pub(nil, pubsub.TopicAppDraw)
v.pubsub.Pub(v.param, pubsub.TopicUpdateParamSubmit)
if *prev != s {
v.pubsub.Pub(v.param, pubsub.TopicUpdateParamSubmit)
} else {
v.pubsub.Pub(nil, pubsub.TopicFocusTree)
}
}
return event
})
Expand Down

0 comments on commit cc4b0ec

Please sign in to comment.