Zim

Duplicate names on ToC dont lead to correct item

Bug #1121854 reported by Álvaro Navarro
36
This bug affects 9 people
Affects Status Importance Assigned to Milestone
Zim
Confirmed
Low
Unassigned

Bug Description

When two (or more) ToC items have the same name (for example, same subsection name (header 3) in two different sections (header 2)), clicking in the ToC item doesn't always lead to the correct subsection in the page.

using Zim Wiki 0.59, Windows 7

Tags: anchors
Revision history for this message
Jaap Karssenberg (jaap.karssenberg) wrote :

Current implementation depends on matching text, no interface to select a specific heading other than by matching text.

Will be able to fix once we have anchors implemented.

Changed in zim:
importance: Undecided → Low
status: New → Confirmed
tags: added: anchors
Revision history for this message
Paddy (patrick-kudos) wrote :

The problem also still exists in 0.60 & 0.61. When are anchors planned?

Revision history for this message
Andreas Wehler (andreas-wehler) wrote :

Still observed in zim 0.65 on Ubuntu 16.04.

The behaviour is comprehensible and there is a workaround.
See attached snapshot.

1) Click {First heading 2}
2) Click {Some heading level 3}, the 2nd one
   You erroneously arrive at {Some heading level 3}, the 1st one
3) Click {Second heading 2}
4) Click {Some heading level 3}, the 2nd one
   You rightly arrive at {Some heading level 3}, the 2nd one

As it stands out the text matching search starts at the current position, which gives you a chance to hierarchically navigate to the wanted subheading. This assumes that at least the top level headings different.

Revision history for this message
Andreas Wehler (andreas-wehler) wrote :
Revision history for this message
Sisso (ubuntu-sisso) wrote :

A workaround solution is execute multiple searches following the same hierarchy of the ToC.

Using the screenshot as example:

seek = document.searchIndexOf("second heading 2", start = 0)
seek = document.searchIndexOf("some heading level 3", start = seek)

I had implemented it some years ago and it require very few changes, it works for me. Unfortunately I was to lazy to learn those "docs vs code check" to submit a patch.

I already get used to the workaround, but I can contribute on this if needed.

Revision history for this message
sojusnik (sojusnik) wrote :

@Sisso

Do you thought about making a pull request on GitHub?

Revision history for this message
Sisso (ubuntu-sisso) wrote :

@sojusnik

I will do it, one day, but I will :D

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.