Skip to content

Commit e6a7fe1

Browse files
committed
feat: list-indent folding — gutter chevrons on nested list/task items, same click/shift/ctrl/ctrl-shift gestures as headings, plus caret snap out of list-marker prefix
1 parent 383e08a commit e6a7fe1

6 files changed

Lines changed: 529 additions & 81 deletions

File tree

src/buffer.rs

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ static NEXT_VERSION: AtomicU64 = AtomicU64::new(1);
1212
use crate::highlight::{HighlightSpan, Highlighter};
1313
use crate::inline::{StyledRegion, extract_all_inline_styles, styles_in_range};
1414
use crate::marker::{
15-
HeadingInfo, LineMarkers, ParsedNodes, collect_node_infos, is_line_in_checked_task,
16-
is_line_in_code_block, markers_at_from_infos,
15+
HeadingInfo, LineMarkers, ListItemInfo, ParsedNodes, collect_node_infos,
16+
is_line_in_checked_task, is_line_in_code_block, markers_at_from_infos,
1717
};
1818
use crate::parser::{MarkdownParser, MarkdownTree};
1919
use crate::table::{RowKind, TableInfo};
@@ -674,6 +674,12 @@ impl BufferContent {
674674
&self.parsed().headings
675675
}
676676

677+
/// List items in document order (parent before child), for list folding.
678+
/// Rc-cached with the parse tree, so auto-invalidated on edit.
679+
pub fn list_items(&self) -> &[ListItemInfo] {
680+
&self.parsed().list_items
681+
}
682+
677683
/// Compute LineMarkers for a specific line on demand.
678684
pub fn line_markers(&self, line_idx: usize) -> LineMarkers {
679685
line_markers_from(&self.parsed, &self.text, line_idx)

0 commit comments

Comments
 (0)