1
0
mirror of https://github.com/makew0rld/amfora.git synced 2024-06-13 19:10:42 +00:00

adding resetSearch helper function

This commit is contained in:
Robin Schubert 2024-03-28 14:43:53 +01:00
parent 1a59487098
commit 88caea0808

View File

@ -148,9 +148,7 @@ func Init(version, commit, builtBy string) {
// Use for errors.
reset := func() {
if searchMode {
tabs[tab].mode = tabModeDone
searchMode = false
bottomBar.SetText(bottomBarText)
resetSearch()
}
bottomBar.SetLabel("")
tabs[tab].applyAll()
@ -399,11 +397,7 @@ func Init(version, commit, builtBy string) {
return nil
case config.CmdInvalid:
if event.Key() == tcell.KeyEsc {
tabs[curTab].mode = tabModeDone
tabs[curTab].view.SetBytes(originalText)
searchMode = false
bottomBar.SetText(bottomBarText)
bottomBar.SetLabel("")
resetSearch()
return nil
}
}
@ -690,3 +684,11 @@ func renderPageFromString(str string) *structs.Page {
func NumTabs() int {
return len(tabs)
}
func resetSearch() {
tabs[curTab].view.SetBytes(originalText)
tabs[curTab].mode = tabModeDone
searchMode = false
bottomBar.SetLabel("")
bottomBar.SetText(bottomBarText)
}