aboutsummaryrefslogtreecommitdiffstats
path: root/src/e_keys.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/e_keys.go')
-rw-r--r--src/e_keys.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/src/e_keys.go b/src/e_keys.go
index 484feea..6c5ac09 100644
--- a/src/e_keys.go
+++ b/src/e_keys.go
@@ -261,6 +261,7 @@ func e_normal_events(data *HardData, ui *HardUI, event tcell.EventKey) bool {
} else if (event.Rune() == '/' ||
event.Key() == tcell.KeyCtrlF) &&
data.litems.curr != nil {
+ data.lfuzz = data.litems
ui.mode = FUZZ_MODE
} else if event.Rune() == '?' {
ui.mode = HELP_MODE
@@ -920,8 +921,44 @@ func e_fuzz_events(data *HardData, ui *HardUI, event tcell.EventKey) bool {
ui.s.HideCursor()
ui.mode = NORMAL_MODE
ui.buff.empty()
+ data.lfuzz = nil
return true
+ } else if event.Key() == tcell.KeyEnter {
+ // TODO: select fuzzed item
+ ui.s.HideCursor()
+ ui.mode = NORMAL_MODE
+ ui.buff.empty()
+ data.lfuzz = nil
+ } else {
+ e_readline(event, &ui.buff, ui, data.home_dir)
+ e_update_lfuzz(ui.buff, data.lfuzz)
}
// TODO: here
return false
}
+
+func e_update_lfuzz(buff Buffer, lfuzz *ItemsList) {
+ if lfuzz.head == nil {
+ return
+ }
+ for ptr := lfuzz.head; ptr != nil; ptr = ptr.next {
+ var name_runes []rune
+ if ptr.is_dir() == false {
+ name_runes = []rune(ptr.Host.Name)
+ } else {
+ name_runes = []rune(ptr.Dirs.Name)
+ }
+ var end_runes []rune
+ for _, buff_ptr := range buff.data {
+ for _, name_ptr := range name_runes {
+ if buff_ptr == name_ptr {
+ end_runes = append(end_runes, buff_ptr)
+ continue
+ }
+ }
+ }
+ if len(end_runes) == 0 {
+ lfuzz.del(ptr)
+ }
+ }
+}