update review tab UX/introduce shift+mousewheel for scrolling
This commit is contained in:
parent
860d690090
commit
14f55afb28
3 changed files with 912 additions and 267 deletions
20
src/tui.zig
20
src/tui.zig
|
|
@ -593,11 +593,27 @@ pub const App = struct {
|
||||||
|
|
||||||
switch (mouse.button) {
|
switch (mouse.button) {
|
||||||
.wheel_up => {
|
.wheel_up => {
|
||||||
self.wheelBy(-3);
|
// shift+wheel scrolls the viewport (look-around,
|
||||||
|
// no cursor change). Plain wheel routes through
|
||||||
|
// `wheelBy` which prefers the active tab's
|
||||||
|
// `onCursorMove`/`onWheelMove`. We pick shift
|
||||||
|
// (not ctrl) because ctrl+wheel is the
|
||||||
|
// near-universal "zoom" gesture in browsers and
|
||||||
|
// editors — bending that to "scroll" would
|
||||||
|
// confuse muscle memory.
|
||||||
|
if (mouse.mods.shift) {
|
||||||
|
self.scrollViewportBy(-3);
|
||||||
|
} else {
|
||||||
|
self.wheelBy(-3);
|
||||||
|
}
|
||||||
return ctx.consumeAndRedraw();
|
return ctx.consumeAndRedraw();
|
||||||
},
|
},
|
||||||
.wheel_down => {
|
.wheel_down => {
|
||||||
self.wheelBy(3);
|
if (mouse.mods.shift) {
|
||||||
|
self.scrollViewportBy(3);
|
||||||
|
} else {
|
||||||
|
self.wheelBy(3);
|
||||||
|
}
|
||||||
return ctx.consumeAndRedraw();
|
return ctx.consumeAndRedraw();
|
||||||
},
|
},
|
||||||
.left => {
|
.left => {
|
||||||
|
|
|
||||||
|
|
@ -456,16 +456,10 @@ pub const tab = struct {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Mouse wheel: always scroll the viewport, never move the
|
// No `onWheelMove`: by omitting it, wheel events fall through
|
||||||
/// cursor. Keeps wheel-as-look-around and cursor-as-pointer
|
// to the framework's `onCursorMove` path. Wheel moves the
|
||||||
/// distinct. The framework falls through to viewport scroll
|
// cursor like j/k. PageUp / PageDown / Home / End scroll the
|
||||||
/// when this returns false.
|
// viewport.
|
||||||
pub fn onWheelMove(state: *State, app: *App, delta: isize) bool {
|
|
||||||
_ = state;
|
|
||||||
_ = app;
|
|
||||||
_ = delta;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Pre-empt key handler. Called by the framework BEFORE
|
/// Pre-empt key handler. Called by the framework BEFORE
|
||||||
/// global keymap matching runs. When portfolio is in a
|
/// global keymap matching runs. When portfolio is in a
|
||||||
|
|
|
||||||
File diff suppressed because it is too large
Load diff
Loading…
Add table
Reference in a new issue