remove check_for_dirty_lines_and_invalidate_selection from periodic
Since we now always check this during rendering, and we have a reliable event for pane output, we don't need this check in the period task. refs: #770
This commit is contained in:
1 parent
ed6987298a
commit
b5bf25a9c5
2 files changed
+17
-29
No files matched your search
@@ -939,11 +939,6 @@ impl TermWindow {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// If the model is dirty, arrange to re-paint
|
||||
if self.check_for_dirty_lines_and_invalidate_selection(&pos) {
|
||||
needs_invalidate = true;
|
||||
}
|
||||
}
|
||||
|
||||
if needs_invalidate {
|
||||
@@ -955,18 +950,18 @@ impl TermWindow {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn check_for_dirty_lines_and_invalidate_selection(&mut self, pos: &PositionedPane) -> bool {
|
||||
let dims = pos.pane.get_dimensions();
|
||||
fn check_for_dirty_lines_and_invalidate_selection(&mut self, pane: &Rc<dyn Pane>) -> bool {
|
||||
let dims = pane.get_dimensions();
|
||||
let viewport = self
|
||||
.get_viewport(pos.pane.pane_id())
|
||||
.get_viewport(pane.pane_id())
|
||||
.unwrap_or(dims.physical_top);
|
||||
let visible_range = viewport..viewport + dims.viewport_rows as StableRowIndex;
|
||||
let dirty = pos.pane.get_dirty_lines(visible_range);
|
||||
let dirty = pane.get_dirty_lines(visible_range);
|
||||
|
||||
if !dirty.is_empty() {
|
||||
if pos.pane.downcast_ref::<SearchOverlay>().is_none()
|
||||
&& pos.pane.downcast_ref::<CopyOverlay>().is_none()
|
||||
&& pos.pane.downcast_ref::<QuickSelectOverlay>().is_none()
|
||||
if pane.downcast_ref::<SearchOverlay>().is_none()
|
||||
&& pane.downcast_ref::<CopyOverlay>().is_none()
|
||||
&& pane.downcast_ref::<QuickSelectOverlay>().is_none()
|
||||
{
|
||||
// If any of the changed lines intersect with the
|
||||
// selection, then we need to clear the selection, but not
|
||||
@@ -975,18 +970,17 @@ impl TermWindow {
|
||||
// highlighting purpose but also manipulates the selection
|
||||
// and we want to allow it to retain the selection it made!
|
||||
|
||||
let clear_selection = if let Some(selection_range) =
|
||||
self.selection(pos.pane.pane_id()).range.as_ref()
|
||||
{
|
||||
let selection_rows = selection_range.rows();
|
||||
selection_rows.into_iter().any(|row| dirty.contains(row))
|
||||
} else {
|
||||
false
|
||||
};
|
||||
let clear_selection =
|
||||
if let Some(selection_range) = self.selection(pane.pane_id()).range.as_ref() {
|
||||
let selection_rows = selection_range.rows();
|
||||
selection_rows.into_iter().any(|row| dirty.contains(row))
|
||||
} else {
|
||||
false
|
||||
};
|
||||
|
||||
if clear_selection {
|
||||
self.selection(pos.pane.pane_id()).range.take();
|
||||
self.selection(pos.pane.pane_id()).start.take();
|
||||
self.selection(pane.pane_id()).range.take();
|
||||
self.selection(pane.pane_id()).start.take();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -151,13 +151,7 @@ impl super::TermWindow {
|
||||
}
|
||||
|
||||
pub fn paint_pane_opengl(&mut self, pos: &PositionedPane) -> anyhow::Result<()> {
|
||||
// We typically check this periodically in the background as part
|
||||
// of deciding whether to repaint, but there are some situations
|
||||
// where the model may have been marked dirty and we re-render
|
||||
// very quickly. If we don't check for dirty lines here before
|
||||
// we call get_lines_with_hyperlinks_applied below, then we'll
|
||||
// not clear the selection when we should.
|
||||
self.check_for_dirty_lines_and_invalidate_selection(pos);
|
||||
self.check_for_dirty_lines_and_invalidate_selection(&pos.pane);
|
||||
|
||||
let config = &self.config;
|
||||
let palette = pos.pane.palette();
|
||||
|
||||
Reference in new issue
Block a user