From d8473a3e00cece41bc66c3bb75d1d63e897f2383 Mon Sep 17 00:00:00 2001 From: Adam Harrison Date: Sun, 14 Nov 2021 15:44:54 -0500 Subject: [PATCH] Changed click prefixes to be numbers, as Takase suggested. --- data/core/config.lua | 1 + data/core/keymap-macos.lua | 10 +++++----- data/core/keymap.lua | 13 ++++++------- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/data/core/config.lua b/data/core/config.lua index 7cf23925..faffc27e 100644 --- a/data/core/config.lua +++ b/data/core/config.lua @@ -28,6 +28,7 @@ config.disable_blink = false config.draw_whitespace = false config.borderless = false config.tab_close_button = true +config.max_clicks = 3 -- Disable plugin loading setting to false the config entry -- of the same name. diff --git a/data/core/keymap-macos.lua b/data/core/keymap-macos.lua index c6564310..b0bd41a5 100644 --- a/data/core/keymap-macos.lua +++ b/data/core/keymap-macos.lua @@ -95,11 +95,11 @@ local function keymap_macos(keymap) ["pageup"] = "doc:move-to-previous-page", ["pagedown"] = "doc:move-to-next-page", - ["shift+slclick"] = "doc:select-to-cursor", - ["ctrl+slclick"] = "doc:split-cursor", - ["slclick"] = "doc:set-cursor", - ["dlclick"] = "doc:set-cursor-word", - ["tlclick"] = "doc:set-cursor-line", + ["shift+1lclick"] = "doc:select-to-cursor", + ["ctrl+1lclick"] = "doc:split-cursor", + ["1lclick"] = "doc:set-cursor", + ["2lclick"] = "doc:set-cursor-word", + ["3lclick"] = "doc:set-cursor-line", ["shift+left"] = "doc:select-to-previous-char", ["shift+right"] = "doc:select-to-next-char", ["shift+up"] = "doc:select-to-previous-line", diff --git a/data/core/keymap.lua b/data/core/keymap.lua index 2c60f8d9..d643242f 100644 --- a/data/core/keymap.lua +++ b/data/core/keymap.lua @@ -90,9 +90,8 @@ function keymap.on_mouse_wheel(delta, ...) and keymap.on_key_pressed("wheel", delta, ...) end -local click_prefixes = { "s", "d", "t" } function keymap.on_mouse_pressed(button, x, y, clicks) - return not keymap.on_key_pressed(click_prefixes[((clicks - 1) % 3) + 1] .. button:sub(1,1) .. "click", x, y, clicks) and + return not keymap.on_key_pressed((((clicks - 1) % config.max_clicks) + 1) .. button:sub(1,1) .. "click", x, y, clicks) and keymap.on_key_pressed(button:sub(1,1) .. "click", x, y, clicks) end @@ -204,11 +203,11 @@ keymap.add_direct { ["pageup"] = "doc:move-to-previous-page", ["pagedown"] = "doc:move-to-next-page", - ["shift+slclick"] = "doc:select-to-cursor", - ["ctrl+slclick"] = "doc:split-cursor", - ["slclick"] = "doc:set-cursor", - ["dlclick"] = "doc:set-cursor-word", - ["tlclick"] = "doc:set-cursor-line", + ["shift+1lclick"] = "doc:select-to-cursor", + ["ctrl+1lclick"] = "doc:split-cursor", + ["1lclick"] = "doc:set-cursor", + ["2lclick"] = "doc:set-cursor-word", + ["3lclick"] = "doc:set-cursor-line", ["shift+left"] = "doc:select-to-previous-char", ["shift+right"] = "doc:select-to-next-char", ["shift+up"] = "doc:select-to-previous-line",