summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDylan Araps <dylan.araps@gmail.com>2019-01-14 21:12:56 +0200
committerDylan Araps <dylan.araps@gmail.com>2019-01-14 21:12:56 +0200
commit98a24ed209762882aee4512b7f99c6f7e9d99d2c (patch)
tree85e030091f30adf5ec45cf6d3595608b170ae37c
parentc2d93616dd36c742d2a424f4e3c0cdd16e788d0b (diff)
general: don't allow user to rebind quit
-rwxr-xr-xfff8
1 files changed, 5 insertions, 3 deletions
diff --git a/fff b/fff
index 72bc635..d75e58e 100755
--- a/fff
+++ b/fff
@@ -651,7 +651,9 @@ key() {
;;
# Quit and store current directory in a file for CD on exit.
- "${FFF_KEY_QUIT:=q}")
+ # Don't allow user to redefine 'q' so a bad keybinding doesn't
+ # remove the option to quit.
+ q)
: "${FFF_CD_FILE:=${XDG_CACHE_HOME:=${HOME}/.cache}/fff/.fff_d}"
printf '%s\n' "$PWD" > "$FFF_CD_FILE"
exit
@@ -707,9 +709,9 @@ main() {
# '\e[?1049l': Restore saved terminal screen.
trap 'reset_terminal; printf "\e[?1049l"' EXIT
- # Trap 'Ctrl+c' and exit by mimicking the 'exit' keypress.
+ # Trap 'Ctrl+c' and exit by mimicking the 'q' keypress.
# This allow us to run the same plumbing on exit for both.
- trap 'key ${FFF_KEY_QUIT}' INT
+ trap 'key q' INT
# Trap the window resize signal (handle window resize events).
trap 'get_term_size; redraw' WINCH