aboutsummaryrefslogtreecommitdiffstats
path: root/src/i_host.go
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/i_host.go61
1 files changed, 29 insertions, 32 deletions
diff --git a/src/i_host.go b/src/i_host.go
index 72f9564..7d3fd57 100644
--- a/src/i_host.go
+++ b/src/i_host.go
@@ -117,12 +117,15 @@ func i_draw_host_panel(ui HardUI, icons bool,
if litems == nil || litems.head == nil {
return
}
- if ui.mode == FUZZ_MODE && data.lfuzz != nil {
- i_draw_host_panel_fuzzy(ui, icons, data.lfuzz, data)
- // TODO: draw fuzz list
- return
- }
+ // if ui.mode == FUZZ_MODE && data.lfuzz != nil {
+ // i_draw_host_panel_fuzzy(ui, icons, data.lfuzz, data)
+ // // TODO: draw fuzz list
+ // return
+ // }
for ptr := litems.draw; ptr != nil && line < ui.dim[H] - 2; ptr = ptr.next {
+ if ui.mode == FUZZ_MODE && i_fuzz_check(ptr, &ui) == false {
+ continue
+ }
if ptr.is_dir() == false && ptr.Host != nil {
i_host_panel_host(ui,
icons,
@@ -147,35 +150,29 @@ func i_draw_host_panel(ui HardUI, icons bool,
}
}
-func i_draw_host_panel_fuzzy(ui HardUI, icons bool,
- lfuzz *FuzzList, data *HardData) {
- line := 1
- if lfuzz == nil || lfuzz.head == nil {
- return
+func i_fuzz_check(ptr *ItemsNode, ui *HardUI) bool {
+ name := ""
+ var name_runes []rune
+ var end_runes []rune
+
+ if len(ui.buff.data) == 0 {
+ return true
}
- // TODO: find a way
- for ptr := lfuzz.draw; ptr != nil && line < ui.dim[H] - 2; ptr = ptr.next {
- item := ptr.ptr
- if item.is_dir() == false && item.Host != nil {
- i_host_panel_host(ui,
- icons,
- 0,
- item.Host,
- lfuzz.curr.ptr.Host,
- data.yank,
- line)
- line++
- } else if item.Dirs != nil {
- var dir_icon uint8
- if data.folds[item.Dirs] != nil {
- dir_icon = 1
+ if ptr.is_dir() == false && ptr.Host != nil {
+ name = ptr.Host.Name
+ } else if ptr.Dirs != nil {
+ name = ptr.Dirs.Name
+ }
+ name_runes = []rune(name)
+ for _, buff_ptr := range ui.buff.data {
+ for _, name_ptr := range name_runes {
+ if buff_ptr == name_ptr {
+ end_runes = append(end_runes, buff_ptr)
}
- i_host_panel_dirs(ui, icons, dir_icon,
- 0,
- item.Dirs,
- lfuzz.curr.ptr.Dirs,
- line)
- line++
}
}
+ if len(end_runes) == 0 {
+ return false
+ }
+ return true
}