diff: Only scroll one line with arrow keys
336c12d909a09deade4fc119bc4a23da1a9d1ce2
1 parent
de199e36
crates/diff/src/renderer.rs
+6 -4
| 54 | 54 | const DEFAULT_HIGHLIGHT_LOOKAHEAD: usize = 4; |
|
| 55 | 55 | /// Default syntax theme selection stored in highlight keys. |
|
| 56 | 56 | const DEFAULT_THEME: &str = "auto"; |
|
| 57 | 57 | /// Number of rows in a sticky file header. |
|
| 58 | 58 | const STICKY_HEADER_ROWS: usize = 3; |
|
| 59 | - | /// Number of body rows moved by line-scroll inputs. |
|
| 60 | - | const LINE_SCROLL_ROWS: isize = 3; |
|
| 59 | + | /// Number of body rows moved by keyboard line-scroll inputs. |
|
| 60 | + | const LINE_SCROLL_ROWS: isize = 1; |
|
| 61 | + | /// Number of body rows moved by mouse-wheel inputs. |
|
| 62 | + | const WHEEL_SCROLL_ROWS: isize = 3; |
|
| 61 | 63 | /// Local row of a file card's top border. |
|
| 62 | 64 | const FILE_TOP_ROW: usize = 0; |
|
| 63 | 65 | /// Local row of a file card's header. |
|
| 64 | 66 | const FILE_HEADER_ROW: usize = 1; |
|
| 65 | 67 | /// Local row of the divider between a file header and its hunk body. |
| 534 | 536 | Event::Key(Key::Char('q')) => return Control::Quit, |
|
| 535 | 537 | Event::Resize(_) => DiffAction::Resize, |
|
| 536 | 538 | Event::Mouse(Mouse::Press { |
|
| 537 | 539 | button: MouseButton::WheelDown, |
|
| 538 | 540 | .. |
|
| 539 | - | }) => DiffAction::Scroll(Scroll::Lines(LINE_SCROLL_ROWS)), |
|
| 541 | + | }) => DiffAction::Scroll(Scroll::Lines(WHEEL_SCROLL_ROWS)), |
|
| 540 | 542 | Event::Mouse(Mouse::Press { |
|
| 541 | 543 | button: MouseButton::WheelUp, |
|
| 542 | 544 | .. |
|
| 543 | - | }) => DiffAction::Scroll(Scroll::Lines(-LINE_SCROLL_ROWS)), |
|
| 545 | + | }) => DiffAction::Scroll(Scroll::Lines(-WHEEL_SCROLL_ROWS)), |
|
| 544 | 546 | Event::Mouse(Mouse::Press { |
|
| 545 | 547 | button: MouseButton::Left, |
|
| 546 | 548 | at, |
|
| 547 | 549 | modifiers, |
|
| 548 | 550 | }) => return self.handle_click(at, modifiers, area), |
a.rs
+0 -0
a.rs
+0 -0
b.rs
+0 -0
a.rs
+0 -0
a.rs
+0 -0
a.rs
+0 -0
b.rs
+0 -0
src/a.rs
+0 -0
src/b.rs
+0 -0
README.md
+0 -0
a.rs
+0 -0