Fix: update tview on change (app.draw)
This commit is contained in:
12
tui.go
12
tui.go
@@ -312,8 +312,6 @@ var searchIndex int
|
|||||||
var searchText string
|
var searchText string
|
||||||
var originalTextForSearch string
|
var originalTextForSearch string
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// performSearch searches for the given term in the textView content and highlights matches
|
// performSearch searches for the given term in the textView content and highlights matches
|
||||||
func performSearch(term string) {
|
func performSearch(term string) {
|
||||||
searchText = term
|
searchText = term
|
||||||
@@ -388,8 +386,6 @@ func highlightCurrentMatch() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// showSearchBar shows the search input field as an overlay
|
// showSearchBar shows the search input field as an overlay
|
||||||
func showSearchBar() {
|
func showSearchBar() {
|
||||||
// Create a temporary flex to combine search and main content
|
// Create a temporary flex to combine search and main content
|
||||||
@@ -451,9 +447,6 @@ func addRegionTags(text string, positions []int, lengths []int, currentIdx int,
|
|||||||
return result.String()
|
return result.String()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// searchNext finds the next occurrence of the search term
|
// searchNext finds the next occurrence of the search term
|
||||||
func searchNext() {
|
func searchNext() {
|
||||||
if len(searchResults) == 0 {
|
if len(searchResults) == 0 {
|
||||||
@@ -491,7 +484,10 @@ func init() {
|
|||||||
textArea.SetBorder(true).SetTitle("input")
|
textArea.SetBorder(true).SetTitle("input")
|
||||||
textView = tview.NewTextView().
|
textView = tview.NewTextView().
|
||||||
SetDynamicColors(true).
|
SetDynamicColors(true).
|
||||||
SetRegions(true)
|
SetRegions(true).
|
||||||
|
SetChangedFunc(func() {
|
||||||
|
app.Draw()
|
||||||
|
})
|
||||||
//
|
//
|
||||||
flex = tview.NewFlex().SetDirection(tview.FlexRow).
|
flex = tview.NewFlex().SetDirection(tview.FlexRow).
|
||||||
AddItem(textView, 0, 40, false).
|
AddItem(textView, 0, 40, false).
|
||||||
|
|||||||
Reference in New Issue
Block a user