mirror of
https://github.com/kovidgoyal/kitty
synced 2026-07-18 22:44:50 +02:00
Implement shift+tab to move up a level
This commit is contained in:
@@ -55,6 +55,11 @@ func (s *State) SetSearchText(val string) {
|
||||
}
|
||||
}
|
||||
func (s *State) SetCurrentDir(val string) {
|
||||
if val == "." {
|
||||
if q, err := os.Getwd(); err == nil {
|
||||
val = q
|
||||
}
|
||||
}
|
||||
if s.CurrentDir() != val {
|
||||
s.search_text = ""
|
||||
s.current_idx = 0
|
||||
@@ -152,6 +157,20 @@ func (h *Handler) OnKeyEvent(ev *loop.KeyEvent) (err error) {
|
||||
}
|
||||
}
|
||||
h.lp.Beep()
|
||||
case ev.MatchesPressOrRepeat("shift+tab"):
|
||||
curr := h.state.CurrentDir()
|
||||
switch curr {
|
||||
case "/":
|
||||
case ".":
|
||||
if curr, err = os.Getwd(); err == nil && curr != "/" {
|
||||
h.state.SetCurrentDir(filepath.Dir(curr))
|
||||
return h.draw_screen()
|
||||
}
|
||||
default:
|
||||
h.state.SetCurrentDir(filepath.Dir(curr))
|
||||
return h.draw_screen()
|
||||
}
|
||||
h.lp.Beep()
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user