diff options
Diffstat (limited to 'src/Surface.zig')
| -rw-r--r-- | src/Surface.zig | 29 |
1 files changed, 24 insertions, 5 deletions
diff --git a/src/Surface.zig b/src/Surface.zig index 770c2daef..330d25102 100644 --- a/src/Surface.zig +++ b/src/Surface.zig @@ -272,6 +272,7 @@ const DerivedConfig = struct { title_report: bool, links: []Link, link_previews: configpkg.LinkPreviews, + scroll_to_bottom: configpkg.Config.ScrollToBottom, const Link = struct { regex: oni.Regex, @@ -340,6 +341,7 @@ const DerivedConfig = struct { .title_report = config.@"title-report", .links = links, .link_previews = config.@"link-previews", + .scroll_to_bottom = config.@"scroll-to-bottom", // Assignments happen sequentially so we have to do this last // so that the memory is captured from allocs above. @@ -2280,7 +2282,8 @@ pub fn keyCallback( try self.setSelection(null); } - try self.io.terminal.scrollViewport(.{ .bottom = {} }); + if (self.config.scroll_to_bottom.keystroke) try self.io.terminal.scrollViewport(.bottom); + try self.queueRender(); } @@ -2766,8 +2769,21 @@ pub fn scrollCallback( // that a wheel tick of 1 results in single scroll event. const yoff_adjusted: f64 = if (scroll_mods.precision) yoff - else - yoff * cell_size * self.config.mouse_scroll_multiplier; + else yoff_adjusted: { + // Round out the yoff to an absolute minimum of 1. macos tries to + // simulate precision scrolling with non precision events by + // ramping up the magnitude of the offsets as it detects faster + // scrolling. Single click (very slow) scrolls are reported with a + // magnitude of 0.1 which would normally require a few clicks + // before we register an actual scroll event (depending on cell + // height and the mouse_scroll_multiplier setting). + const yoff_max: f64 = if (yoff > 0) + @max(yoff, 1) + else + @min(yoff, -1); + + break :yoff_adjusted yoff_max * cell_size * self.config.mouse_scroll_multiplier; + }; // Add our previously saved pending amount to the offset to get the // new offset value. The signs of the pending and yoff should match @@ -4701,10 +4717,13 @@ pub fn performBindingAction(self: *Surface, action: input.Binding.Action) !bool {}, ), - .close_tab => return try self.rt_app.performAction( + .close_tab => |v| return try self.rt_app.performAction( .{ .surface = self }, .close_tab, - {}, + switch (v) { + .this => .this, + .other => .other, + }, ), inline .previous_tab, |
