summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--man/man1/fzf.14
-rw-r--r--src/options.go4
-rw-r--r--src/tui/light.go14
-rw-r--r--src/tui/tcell.go6
-rw-r--r--src/tui/tui.go2
-rwxr-xr-xtest/test_go.rb9
6 files changed, 38 insertions, 1 deletions
diff --git a/man/man1/fzf.1 b/man/man1/fzf.1
index 1dcbc550..ac208ecd 100644
--- a/man/man1/fzf.1
+++ b/man/man1/fzf.1
@@ -873,6 +873,8 @@ e.g.
.br
\fIctrl-space\fR
.br
+\fIctrl-delete\fR
+.br
\fIctrl-\\\fR
.br
\fIctrl-]\fR
@@ -941,6 +943,8 @@ e.g.
.br
\fIshift-right\fR
.br
+\fIshift-delete\fR
+.br
\fIalt-shift-up\fR
.br
\fIalt-shift-down\fR
diff --git a/src/options.go b/src/options.go
index 6e3040b3..4db34640 100644
--- a/src/options.go
+++ b/src/options.go
@@ -614,6 +614,8 @@ func parseKeyChordsImpl(str string, message string, exit func(string)) map[tui.E
add(tui.BSpace)
case "ctrl-space":
add(tui.CtrlSpace)
+ case "ctrl-delete":
+ add(tui.CtrlDelete)
case "ctrl-^", "ctrl-6":
add(tui.CtrlCaret)
case "ctrl-/", "ctrl-_":
@@ -684,6 +686,8 @@ func parseKeyChordsImpl(str string, message string, exit func(string)) map[tui.E
add(tui.SLeft)
case "shift-right":
add(tui.SRight)
+ case "shift-delete":
+ add(tui.SDelete)
case "left-click":
add(tui.LeftClick)
case "right-click":
diff --git a/src/tui/light.go b/src/tui/light.go
index bc44b4f8..8356eb50 100644
--- a/src/tui/light.go
+++ b/src/tui/light.go
@@ -430,7 +430,19 @@ func (r *LightRenderer) escSequence(sz *int) Event {
}
return Event{Invalid, 0, nil} // INS
case '3':
- return Event{Del, 0, nil}
+ if r.buffer[3] == '~' {
+ return Event{Del, 0, nil}
+ }
+ if len(r.buffer) == 6 && r.buffer[5] == '~' {
+ *sz = 6
+ switch r.buffer[4] {
+ case '5':
+ return Event{CtrlDelete, 0, nil}
+ case '2':
+ return Event{SDelete, 0, nil}
+ }
+ }
+ return Event{Invalid, 0, nil}
case '4':
return Event{End, 0, nil}
case '5':
diff --git a/src/tui/tcell.go b/src/tui/tcell.go
index f82482d7..f815df07 100644
--- a/src/tui/tcell.go
+++ b/src/tui/tcell.go
@@ -413,6 +413,12 @@ func (r *FullscreenRenderer) GetChar() Event {
case tcell.KeyHome:
return Event{Home, 0, nil}
case tcell.KeyDelete:
+ if ctrl {
+ return Event{CtrlDelete, 0, nil}
+ }
+ if shift {
+ return Event{SDelete, 0, nil}
+ }
return Event{Del, 0, nil}
case tcell.KeyEnd:
return Event{End, 0, nil}
diff --git a/src/tui/tui.go b/src/tui/tui.go
index 63bdfa83..55fbe771 100644
--- a/src/tui/tui.go
+++ b/src/tui/tui.go
@@ -41,6 +41,7 @@ const (
CtrlZ
ESC
CtrlSpace
+ CtrlDelete
// https://apple.stackexchange.com/questions/24261/how-do-i-send-c-that-is-control-slash-to-the-terminal
CtrlBackSlash
@@ -74,6 +75,7 @@ const (
SDown
SLeft
SRight
+ SDelete
F1
F2
diff --git a/test/test_go.rb b/test/test_go.rb
index f7dcfe6e..469d007e 100755
--- a/test/test_go.rb
+++ b/test/test_go.rb
@@ -2922,6 +2922,15 @@ class TestGoFZF < TestBase
tmux.until { assert_block(expected, _1) }
end
+ def test_delete_with_modifiers
+ tmux.send_keys "seq 100 | #{FZF} --bind 'ctrl-delete:up+up,shift-delete:down,focus:transform-prompt:echo [{}]'", :Enter
+ tmux.until { |lines| assert_equal 100, lines.item_count }
+ tmux.send_keys 'C-Delete'
+ tmux.until { |lines| assert_equal '[3]', lines[-1] }
+ tmux.send_keys 'S-Delete'
+ tmux.until { |lines| assert_equal '[2]', lines[-1] }
+ end
+
def test_become_tty
tmux.send_keys "sleep 0.5 | #{FZF} --bind 'start:reload:ls' --bind 'load:become:tty'", :Enter
tmux.until { |lines| assert_includes lines, '/dev/tty' }