Using a Unique Function
Previously the bug that I mentioned here `https://github.com/aditya-K2/gomp/blob/f7c22833553e99634e032bd389eae6cf1311fd1c/utils/utils.go#L147` was caused due to the replication of matched Indexes. Hence using the utils.Unique function to only get the unique elements in the slice.
This commit is contained in:
@@ -16,14 +16,14 @@ func UpdateBuffSearchView(inputTable *tview.Table, m fuzzy.Matches, f []FileNode
|
||||
} else {
|
||||
for k, v := range m {
|
||||
if len(f[v.Index].Children) != 0 {
|
||||
inputTable.SetCell(k, 0, tview.NewTableCell(utils.GetMatchedString(v.MatchedIndexes, f[v.Index].Path, "[#0000ff:-:bi]")).
|
||||
inputTable.SetCell(k, 0, tview.NewTableCell(utils.GetMatchedString(utils.Unique(v.MatchedIndexes), f[v.Index].Path, "[#0000ff:-:bi]")).
|
||||
SetAlign(tview.AlignLeft).
|
||||
SetStyle(tcell.StyleDefault.
|
||||
Foreground(tcell.ColorYellow).
|
||||
Background(tcell.ColorBlack).
|
||||
Bold(true)))
|
||||
} else {
|
||||
inputTable.SetCell(k, 0, tview.NewTableCell(utils.GetMatchedString(v.MatchedIndexes, f[v.Index].Title, "[#fbff00:-:bi]")).
|
||||
inputTable.SetCell(k, 0, tview.NewTableCell(utils.GetMatchedString(utils.Unique(v.MatchedIndexes), f[v.Index].Title, "[#fbff00:-:bi]")).
|
||||
SetAlign(tview.AlignLeft).
|
||||
SetStyle(tcell.StyleDefault.
|
||||
Foreground(tcell.ColorGreen).
|
||||
|
||||
Reference in New Issue
Block a user