Skip to content

Commit

Permalink
fix: use doc id instead of view id
Browse files Browse the repository at this point in the history
  • Loading branch information
SoraTenshi committed Sep 6, 2024
1 parent 85a5f60 commit ea3ac71
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions helix-term/src/ui/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use helix_core::{
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;

Expand All @@ -27,7 +27,7 @@ pub struct StickyNode {
pub indicator: Option<String>,
pub anchor: usize,
pub has_context_end: bool,
pub view_id: ViewId,
pub doc_id: DocumentId,
}

#[derive(Debug)]
Expand Down Expand Up @@ -106,7 +106,7 @@ pub fn calculate_sticky_nodes(

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();
}

Expand Down Expand Up @@ -207,7 +207,7 @@ pub fn calculate_sticky_nodes(
indicator: None,
anchor: doc.view_offset(view.id).anchor,
has_context_end: node_byte_range.is_some(),
view_id: view.id,
doc_id: view.doc,
});
}
}
Expand Down Expand Up @@ -269,7 +269,7 @@ fn build_cached_nodes(
context: &mut StickyNodeContext,
) -> Option<Vec<StickyNode>> {
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;
}

Expand Down Expand Up @@ -363,7 +363,7 @@ fn add_indicator(
indicator: Some(str),
anchor: doc.view_offset(view.id).anchor,
has_context_end: false,
view_id: view.id,
doc_id: view.doc,
});

res
Expand Down

0 comments on commit ea3ac71

Please sign in to comment.