Fix scrolling with cursor
This commit is contained in:
parent
c031944b45
commit
e53956cb2d
4 changed files with 29 additions and 24 deletions
|
|
@ -157,7 +157,12 @@ where
|
|||
let mut buffer = self.buffer.lock().unwrap();
|
||||
let mut cache = self.cache.lock().unwrap();
|
||||
|
||||
buffer.shape_until_cursor();
|
||||
if buffer.cursor_moved {
|
||||
buffer.shape_until_cursor();
|
||||
buffer.cursor_moved = false;
|
||||
} else {
|
||||
buffer.shape_until_scroll();
|
||||
}
|
||||
|
||||
let buffer_x = layout.bounds().x;
|
||||
let buffer_y = layout.bounds().y;
|
||||
|
|
|
|||
|
|
@ -73,13 +73,15 @@ fn main() {
|
|||
let mut mouse_y = -1;
|
||||
let mut mouse_left = false;
|
||||
|
||||
//Lets do this once and rely on events for the rest.
|
||||
buffer.shape_until_cursor();
|
||||
|
||||
loop {
|
||||
let mut force_drag = true;
|
||||
|
||||
buffer.shape_until_scroll();
|
||||
if buffer.cursor_moved {
|
||||
buffer.shape_until_cursor();
|
||||
buffer.cursor_moved = false;
|
||||
} else {
|
||||
buffer.shape_until_scroll();
|
||||
}
|
||||
|
||||
if buffer.redraw {
|
||||
let instant = Instant::now();
|
||||
|
|
@ -203,8 +205,6 @@ fn main() {
|
|||
} else if mouse_y + 5 >= window.height() as i32 {
|
||||
buffer.action(TextAction::Scroll { lines: 3 });
|
||||
window_async = true;
|
||||
} else {
|
||||
buffer.shape_until_cursor()
|
||||
}
|
||||
|
||||
force_drag = false;
|
||||
|
|
@ -218,8 +218,6 @@ fn main() {
|
|||
x: mouse_x - line_x,
|
||||
y: mouse_y,
|
||||
});
|
||||
|
||||
buffer.shape_until_cursor()
|
||||
}
|
||||
force_drag = false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,7 +9,12 @@ fn redraw(window: &mut Window, buffer: &mut TextBuffer<'_>, swash_cache: &mut Sw
|
|||
let bg_color = Color::rgb(0x34, 0x34, 0x34);
|
||||
let font_color = Color::rgb(0xFF, 0xFF, 0xFF);
|
||||
|
||||
buffer.shape_until_cursor();
|
||||
if buffer.cursor_moved {
|
||||
buffer.shape_until_cursor();
|
||||
buffer.cursor_moved = false;
|
||||
} else {
|
||||
buffer.shape_until_scroll();
|
||||
}
|
||||
|
||||
if buffer.redraw {
|
||||
let instant = Instant::now();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue