Fix repaint issue
This commit is contained in:
parent
837fcb7b45
commit
47ccbdcec5
@ -575,6 +575,7 @@ fn gtk_draw(state_arc: &Arc<UiMutex<State>>, ctx: &cairo::Context) -> Inhibit {
|
|||||||
|
|
||||||
let mut state = state_arc.borrow_mut();
|
let mut state = state_arc.borrow_mut();
|
||||||
if state.nvim.borrow().is_initialized() {
|
if state.nvim.borrow().is_initialized() {
|
||||||
|
request_window_resize(&mut *state);
|
||||||
render::render(
|
render::render(
|
||||||
ctx,
|
ctx,
|
||||||
state.cursor.as_ref().unwrap(),
|
state.cursor.as_ref().unwrap(),
|
||||||
@ -583,7 +584,6 @@ fn gtk_draw(state_arc: &Arc<UiMutex<State>>, ctx: &cairo::Context) -> Inhibit {
|
|||||||
&state.color_model,
|
&state.color_model,
|
||||||
&state.mode,
|
&state.mode,
|
||||||
);
|
);
|
||||||
request_window_resize(&mut *state);
|
|
||||||
} else if state.nvim.borrow().is_initializing() {
|
} else if state.nvim.borrow().is_initializing() {
|
||||||
draw_initializing(&*state, ctx);
|
draw_initializing(&*state, ctx);
|
||||||
}
|
}
|
||||||
@ -995,12 +995,15 @@ impl RedrawEvents for State {
|
|||||||
fn on_resize(&mut self, columns: u64, rows: u64) -> RepaintMode {
|
fn on_resize(&mut self, columns: u64, rows: u64) -> RepaintMode {
|
||||||
self.model = UiModel::new(rows, columns);
|
self.model = UiModel::new(rows, columns);
|
||||||
self.request_resize();
|
self.request_resize();
|
||||||
RepaintMode::All
|
RepaintMode::Nothing
|
||||||
}
|
}
|
||||||
|
|
||||||
fn on_redraw(&mut self, mode: &RepaintMode) {
|
fn on_redraw(&mut self, mode: &RepaintMode) {
|
||||||
match *mode {
|
match *mode {
|
||||||
RepaintMode::All => self.drawing_area.queue_draw(),
|
RepaintMode::All => {
|
||||||
|
self.update_dirty_glyphs();
|
||||||
|
self.drawing_area.queue_draw();
|
||||||
|
},
|
||||||
RepaintMode::Area(ref rect) => self.queue_draw_area(&[rect]),
|
RepaintMode::Area(ref rect) => self.queue_draw_area(&[rect]),
|
||||||
RepaintMode::AreaList(ref list) => self.queue_draw_area(&list.list),
|
RepaintMode::AreaList(ref list) => self.queue_draw_area(&list.list),
|
||||||
RepaintMode::Nothing => (),
|
RepaintMode::Nothing => (),
|
||||||
|
@ -20,18 +20,9 @@ pub struct Line {
|
|||||||
|
|
||||||
impl Line {
|
impl Line {
|
||||||
pub fn new(columns: usize) -> Self {
|
pub fn new(columns: usize) -> Self {
|
||||||
let mut line = Vec::with_capacity(columns);
|
|
||||||
for _ in 0..columns {
|
|
||||||
line.push(Cell::new(' '));
|
|
||||||
}
|
|
||||||
let mut item_line = Vec::with_capacity(columns);
|
|
||||||
for _ in 0..columns {
|
|
||||||
item_line.push(None);
|
|
||||||
}
|
|
||||||
|
|
||||||
Line {
|
Line {
|
||||||
line: line.into_boxed_slice(),
|
line: vec![Cell::new(' '); columns].into_boxed_slice(),
|
||||||
item_line: item_line.into_boxed_slice(),
|
item_line: vec![None; columns].into_boxed_slice(),
|
||||||
cell_to_item: vec![-1; columns].into_boxed_slice(),
|
cell_to_item: vec![-1; columns].into_boxed_slice(),
|
||||||
dirty_line: true,
|
dirty_line: true,
|
||||||
}
|
}
|
||||||
@ -48,6 +39,12 @@ impl Line {
|
|||||||
for cell in &mut self.line[left..right + 1] {
|
for cell in &mut self.line[left..right + 1] {
|
||||||
cell.clear();
|
cell.clear();
|
||||||
}
|
}
|
||||||
|
for item in &mut self.item_line[left..right + 1] {
|
||||||
|
item.clone_from(&None);
|
||||||
|
}
|
||||||
|
for i in left..right + 1 {
|
||||||
|
self.cell_to_item[i] = -1;
|
||||||
|
}
|
||||||
self.dirty_line = true;
|
self.dirty_line = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user