diff options
Diffstat (limited to '')
-rw-r--r-- | src/e_keys.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/e_keys.go b/src/e_keys.go index b386ba4..5396572 100644 --- a/src/e_keys.go +++ b/src/e_keys.go @@ -175,6 +175,7 @@ func e_normal_events(data *HardData, ui *HardUI, event tcell.EventKey) bool { ui.insert_method = INSERT_ADD ui.insert_sel = 0 ui.insert_sel_ok = false + ui.insert_scroll = 0 } else if event.Rune() == 'e' && data.litems.curr != nil && data.litems.curr.is_dir() == false { @@ -395,6 +396,10 @@ func e_insert_events(data *HardData, ui *HardUI, event tcell.EventKey) bool { } else if ui.insert_sel < ui.insert_sel_max { ui.insert_sel += 1 } + if ui.insert_sel < ui.insert_sel_max && + ui.insert_line + 2 >= ui.insert_win.B - ui.insert_win.T { + ui.insert_scroll += 1 + } } else if event.Rune() == 'k' || event.Key() == tcell.KeyUp { if data.insert.Protocol == PROTOCOL_RDP && @@ -418,6 +423,12 @@ func e_insert_events(data *HardData, ui *HardUI, event tcell.EventKey) bool { } else if ui.insert_sel > INS_PROTOCOL { ui.insert_sel -= 1 } + if ui.insert_sel > INS_PROTOCOL { + ui.insert_scroll -= 1 + if ui.insert_scroll < 0 { + ui.insert_scroll = 0 + } + } } else if event.Rune() == 'g' || event.Rune() == 'h' || event.Key() == tcell.KeyLeft { |