fix: TOC anchor navigation - remove anchor text from parsed content

- Fix parse_blocks: after extracting anchor from \\x03..\\x04 markers,
  remove the anchor text too (was contaminating display text)
- When TOC jump occurs, clear pending_anchor to prevent saved position
  from overriding the TOC navigation on first frame
- Add tests for heading with/without anchor parsing
This commit is contained in:
Developer
2026-05-22 21:03:56 +08:00
parent 1d2407098c
commit 528d70fc33
2 changed files with 27 additions and 1 deletions

View File

@@ -382,6 +382,7 @@ BgType::Custom(ref path) if !path.is_empty() => {
if let Some(section) = action.jump_to_section {
self.state.current_section = section;
self.state.current_page = 0;
self.state.pending_anchor = None;
if let Some(ref anchor) = action.jump_to_anchor {
if let Some(ref book) = self.state.book {
if section < book.sections.len() {