Duplicate names on ToC dont lead to correct item

Bug #1121854 reported by Álvaro Navarro on 2013-02-11
This bug affects 9 people
Affects Status Importance Assigned to Milestone

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

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
Paddy (patrick-kudos) wrote :

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

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.

Andreas Wehler (andreas-wehler) wrote :
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.

sojusnik (sojusnik) wrote :


Do you thought about making a pull request on GitHub?

Sisso (ubuntu-sisso) wrote :


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

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

Duplicates of this bug

Other bug subscribers