diff --git a/src/tui/mode/input/flow.zig b/src/tui/mode/input/flow.zig index c9356d0..8e3e9f3 100644 --- a/src/tui/mode/input/flow.zig +++ b/src/tui/mode/input/flow.zig @@ -70,6 +70,11 @@ fn mapEvent(self: *Self, evtype: u32, keypress: u32, egc: u32, modifiers: u32) t fn mapPress(self: *Self, keypress: u32, egc: u32, modifiers: u32) tp.result { const keynormal = if ('a' <= keypress and keypress <= 'z') keypress - ('a' - 'A') else keypress; if (self.leader) |_| return self.mapFollower(keynormal, egc, modifiers); + switch (keypress) { + key.LCTRL, key.RCTRL => return self.cmd("enable_fast_scroll", .{}), + key.LALT, key.RALT => return self.cmd("enable_fast_scroll", .{}), + else => {}, + } return switch (modifiers) { mod.CTRL => switch (keynormal) { 'E' => self.cmd("enter_overlay_mode", command.fmt(.{"open_recent"})), @@ -200,8 +205,6 @@ fn mapPress(self: *Self, keypress: u32, egc: u32, modifiers: u32) tp.result { key.END => self.cmd("move_end", .{}), key.PGUP => self.cmd("move_page_up", .{}), key.PGDOWN => self.cmd("move_page_down", .{}), - key.LCTRL, key.RCTRL => self.cmd("enable_fast_scroll", .{}), - key.LALT, key.RALT => self.cmd("enable_fast_scroll", .{}), key.TAB => self.cmd("indent", .{}), else => if (!key.synthesized_p(keypress)) self.insert_code_point(egc) diff --git a/src/tui/mode/input/vim/insert.zig b/src/tui/mode/input/vim/insert.zig index b61ecc3..e793548 100644 --- a/src/tui/mode/input/vim/insert.zig +++ b/src/tui/mode/input/vim/insert.zig @@ -73,6 +73,11 @@ fn mapEvent(self: *Self, evtype: u32, keypress: u32, egc: u32, modifiers: u32) t fn mapPress(self: *Self, keypress: u32, egc: u32, modifiers: u32) tp.result { const keynormal = if ('a' <= keypress and keypress <= 'z') keypress - ('a' - 'A') else keypress; if (self.leader) |_| return self.mapFollower(keynormal, egc, modifiers); + switch (keypress) { + key.LCTRL, key.RCTRL => return self.cmd("enable_fast_scroll", .{}), + key.LALT, key.RALT => return self.cmd("enable_fast_scroll", .{}), + else => {}, + } return switch (modifiers) { mod.CTRL => switch (keynormal) { 'U' => self.cmd("move_scroll_page_up", .{}), @@ -200,8 +205,6 @@ fn mapPress(self: *Self, keypress: u32, egc: u32, modifiers: u32) tp.result { key.END => self.cmd("move_end", .{}), key.PGUP => self.cmd("move_page_up", .{}), key.PGDOWN => self.cmd("move_page_down", .{}), - key.LCTRL, key.RCTRL => self.cmd("enable_fast_scroll", .{}), - key.LALT, key.RALT => self.cmd("enable_fast_scroll", .{}), key.TAB => self.cmd("indent", .{}), else => if (!key.synthesized_p(keypress)) self.insert_code_point(egc) diff --git a/src/tui/mode/input/vim/normal.zig b/src/tui/mode/input/vim/normal.zig index 0217810..b006d31 100644 --- a/src/tui/mode/input/vim/normal.zig +++ b/src/tui/mode/input/vim/normal.zig @@ -74,6 +74,11 @@ fn mapEvent(self: *Self, evtype: u32, keypress: u32, egc: u32, modifiers: u32) t fn mapPress(self: *Self, keypress: u32, egc: u32, modifiers: u32) tp.result { const keynormal = if ('a' <= keypress and keypress <= 'z') keypress - ('a' - 'A') else keypress; if (self.leader) |_| return self.mapFollower(keynormal, egc, modifiers); + switch (keypress) { + key.LCTRL, key.RCTRL => return self.cmd("enable_fast_scroll", .{}), + key.LALT, key.RALT => return self.cmd("enable_fast_scroll", .{}), + else => {}, + } return switch (modifiers) { mod.CTRL => switch (keynormal) { 'U' => self.cmd("move_scroll_page_up", .{}), @@ -263,8 +268,6 @@ fn mapPress(self: *Self, keypress: u32, egc: u32, modifiers: u32) tp.result { key.END => self.cmd("move_end", .{}), key.PGUP => self.cmd("move_page_up", .{}), key.PGDOWN => self.cmd("move_page_down", .{}), - key.LCTRL, key.RCTRL => self.cmd("enable_fast_scroll", .{}), - key.LALT, key.RALT => self.cmd("enable_fast_scroll", .{}), key.TAB => self.cmd("indent", .{}), else => {}, }, diff --git a/src/tui/mode/input/vim/visual.zig b/src/tui/mode/input/vim/visual.zig index 3ce67a8..7b60d9d 100644 --- a/src/tui/mode/input/vim/visual.zig +++ b/src/tui/mode/input/vim/visual.zig @@ -74,6 +74,11 @@ fn mapEvent(self: *Self, evtype: u32, keypress: u32, egc: u32, modifiers: u32) t fn mapPress(self: *Self, keypress: u32, egc: u32, modifiers: u32) tp.result { const keynormal = if ('a' <= keypress and keypress <= 'z') keypress - ('a' - 'A') else keypress; if (self.leader) |_| return self.mapFollower(keynormal, egc, modifiers); + switch (keypress) { + key.LCTRL, key.RCTRL => return self.cmd("enable_fast_scroll", .{}), + key.LALT, key.RALT => return self.cmd("enable_fast_scroll", .{}), + else => {}, + } return switch (modifiers) { mod.CTRL => switch (keynormal) { 'U' => self.cmd("move_scroll_page_up", .{}), @@ -259,8 +264,6 @@ fn mapPress(self: *Self, keypress: u32, egc: u32, modifiers: u32) tp.result { key.END => self.cmd("select_end", .{}), key.PGUP => self.cmd("select_page_up", .{}), key.PGDOWN => self.cmd("select_page_down", .{}), - key.LCTRL, key.RCTRL => self.cmd("enable_fast_scroll", .{}), - key.LALT, key.RALT => self.cmd("enable_fast_scroll", .{}), key.TAB => self.cmd("indent", .{}), else => {}, },