|
|
@ -8,7 +8,7 @@ use helix_core::{
|
|
|
|
Position,
|
|
|
|
Position,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
use helix_view::{editor::Config, graphics::Rect, Document, Theme, View, ViewId};
|
|
|
|
use helix_view::{editor::Config, graphics::Rect, Document, DocumentId, Theme, View};
|
|
|
|
|
|
|
|
|
|
|
|
use tui::buffer::Buffer as Surface;
|
|
|
|
use tui::buffer::Buffer as Surface;
|
|
|
|
|
|
|
|
|
|
|
@ -27,7 +27,7 @@ pub struct StickyNode {
|
|
|
|
pub indicator: Option<String>,
|
|
|
|
pub indicator: Option<String>,
|
|
|
|
pub anchor: usize,
|
|
|
|
pub anchor: usize,
|
|
|
|
pub has_context_end: bool,
|
|
|
|
pub has_context_end: bool,
|
|
|
|
pub view_id: ViewId,
|
|
|
|
pub doc_id: DocumentId,
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#[derive(Debug)]
|
|
|
|
#[derive(Debug)]
|
|
|
@ -106,7 +106,7 @@ pub fn calculate_sticky_nodes(
|
|
|
|
|
|
|
|
|
|
|
|
let mut cached_nodes = build_cached_nodes(doc, nodes, view, &mut context).unwrap_or_default();
|
|
|
|
let mut cached_nodes = build_cached_nodes(doc, nodes, view, &mut context).unwrap_or_default();
|
|
|
|
|
|
|
|
|
|
|
|
if cached_nodes.iter().any(|node| node.view_id != view.id) {
|
|
|
|
if cached_nodes.iter().any(|node| node.doc_id != view.doc) {
|
|
|
|
cached_nodes.clear();
|
|
|
|
cached_nodes.clear();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -207,7 +207,7 @@ pub fn calculate_sticky_nodes(
|
|
|
|
indicator: None,
|
|
|
|
indicator: None,
|
|
|
|
anchor: doc.view_offset(view.id).anchor,
|
|
|
|
anchor: doc.view_offset(view.id).anchor,
|
|
|
|
has_context_end: node_byte_range.is_some(),
|
|
|
|
has_context_end: node_byte_range.is_some(),
|
|
|
|
view_id: view.id,
|
|
|
|
doc_id: view.doc,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -269,7 +269,7 @@ fn build_cached_nodes(
|
|
|
|
context: &mut StickyNodeContext,
|
|
|
|
context: &mut StickyNodeContext,
|
|
|
|
) -> Option<Vec<StickyNode>> {
|
|
|
|
) -> Option<Vec<StickyNode>> {
|
|
|
|
if let Some(nodes) = nodes {
|
|
|
|
if let Some(nodes) = nodes {
|
|
|
|
if nodes.iter().any(|node| view.id != node.view_id) {
|
|
|
|
if nodes.iter().any(|node| view.doc != node.doc_id) {
|
|
|
|
return None;
|
|
|
|
return None;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -363,7 +363,7 @@ fn add_indicator(
|
|
|
|
indicator: Some(str),
|
|
|
|
indicator: Some(str),
|
|
|
|
anchor: doc.view_offset(view.id).anchor,
|
|
|
|
anchor: doc.view_offset(view.id).anchor,
|
|
|
|
has_context_end: false,
|
|
|
|
has_context_end: false,
|
|
|
|
view_id: view.id,
|
|
|
|
doc_id: view.doc,
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
res
|
|
|
|
res
|
|
|
|