Skip to content

fix(tui): disambiguate navigation to duplicate headings from outline#56

Merged
nicholasjpaterno merged 1 commit into
Epistates:mainfrom
alisaifee:duplicate-heading-navigation
Jun 2, 2026
Merged

fix(tui): disambiguate navigation to duplicate headings from outline#56
nicholasjpaterno merged 1 commit into
Epistates:mainfrom
alisaifee:duplicate-heading-navigation

Conversation

@alisaifee

Copy link
Copy Markdown
Contributor

Problem

Selecting an outline item that appears multiple times in a document resulted in always jumping to the first occurence. This was caused by the lookup using the heading text as the key.

Solution

Add a index field to HeadingNode and heading_index to OutlineItem that stores each heading's position in Document::headings. All content extraction, selection restore, and rendering paths now resolve by index.

extract_section is kept unchanged for the CLI --section flag, which internally delegates to the new extract_section_at_index function.

Demo

Before After

Selecting an outline item that appears multiple times in a document
resulted in always jumping to the first occurence. This was caused by
the lookup using the heading text as the key.

Add an index field to HeadingNode and OutlineItem that stores
each heading's position.  All content extraction, selection restore,
and rendering paths now resolve by index.

extract_section(text) is kept unchanged for the CLI --section flag,
which internally delegates to the new extract_section_at_index().
@alisaifee alisaifee marked this pull request as ready for review June 1, 2026 16:57
@nicholasjpaterno

Copy link
Copy Markdown
Contributor

Thanks @alisaifee I was able to confirm this bug locally. Thanks for the PR, everything looks good!

@nicholasjpaterno nicholasjpaterno merged commit 616f651 into Epistates:main Jun 2, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants