Skip to content

popup menu for multi-reference bookmark navigation (#crossref)#1335

Merged
karlkleinpaste merged 1 commit into
crosswire:masterfrom
LAfricain:crossref-popup
Jul 4, 2026
Merged

popup menu for multi-reference bookmark navigation (#crossref)#1335
karlkleinpaste merged 1 commit into
crosswire:masterfrom
LAfricain:crossref-popup

Conversation

@LAfricain

Copy link
Copy Markdown
Contributor

Add a user-controlled option for navigating multi-reference bookmarks:

  • When a bookmark key contains multiple references (semicolons, commas, or verse ranges), the user can choose between two behaviours via a new 'Open cross-references in a popup menu' toggle in the bookmark context menu.

  • When enabled (checked): a popup menu lists each reference individually; clicking one navigates directly to that verse. Verse ranges (e.g. Mt 15:1-9) are displayed with their full label but navigate to the first verse of the range.

  • When disabled (unchecked): the full key is passed to main_url_handler which displays all references in the Verse List as before.

  • Single references and studypad bookmarks are unaffected.

  • The preference is saved to and restored from the Xiphos config file under misc/crossref_popup (default: 0 = verse list behaviour).

Add a user-controlled option for navigating multi-reference bookmarks:

- When a bookmark key contains multiple references (semicolons, commas,
  or verse ranges), the user can choose between two behaviours via a new
  'Open cross-references in a popup menu' toggle in the bookmark context
  menu.

- When enabled (checked): a popup menu lists each reference individually;
  clicking one navigates directly to that verse. Verse ranges (e.g.
  Mt 15:1-9) are displayed with their full label but navigate to the
  first verse of the range.

- When disabled (unchecked): the full key is passed to main_url_handler
  which displays all references in the Verse List as before.

- Single references and studypad bookmarks are unaffected.
- The preference is saved to and restored from the Xiphos config file
  under misc/crossref_popup (default: 0 = verse list behaviour).
@karlkleinpaste
karlkleinpaste merged commit 8ba746a into crosswire:master Jul 4, 2026
7 checks passed
@karlkleinpaste

Copy link
Copy Markdown
Contributor

This seemed good. I will make one adjustment to provide for initialization in xml.c.

@karlkleinpaste

Copy link
Copy Markdown
Contributor

Oh no. I did this too soon.

Glitch. Big glitch.
This is what a verse dump of mine looks like in the old way, without popup.
Screenshot at 2026-07-04 11-01-51

This is what the same verse dump looks like in the popup.
Screenshot at 2026-07-04 11-03-21

If I click the entry for Acts 8:36, being fully specified, it goes there correctly.
But when I now click the entry for any other partially specified item, it goes ... somewhere utterly random.

The problem is that incomplete specification is handled properly when the verse list is processed by Sword.
That is, this bookmark entry that I handcrafted...

<Bookmark modulename="" key="Matt.17.20; 18.10; 23.13; Mark.7.15; 9.43,45; 11.25; 15.27; Luke.17.35; 23.16; John.5.3; Acts.8.36; 15.33; 24.6; 28.28; Romans.16.23" moduledescription=" " description="Verses should not exist"/>

...works fine when processed by Sword because it contextually fills in the fact that e.g. "18:10" is part of a Matthew citation. So it fills that in when returning the list of individual verses.

The popup handling does not provide for this. It leaves the partial (but proper and normal) specification as partial, leaving it contextually unanchored when referenced alone.

I don't want to revert this because the concept is fine, especially being user-selectable so the old behavior is default. But it very badly needs a fix to pass the verse list through Sword for contextual resolution.

@LAfricain

Copy link
Copy Markdown
Contributor Author

Ok this week I'm busy busy!! Next week I will look at this.

@karlkleinpaste

Copy link
Copy Markdown
Contributor

No sweat. The sole problem is that you still need to pass the bookmark's verse list through Sword just as is done when preparing the verse list dump in the default no-popup case.

@LAfricain

Copy link
Copy Markdown
Contributor Author

In the end, Claude solved it for me in 15 minutes! I hope that's okay, but take a look at the screenshot—it seems to match the bookmarks you gave me.
crossref

LAfricain pushed a commit to LAfricain/xiphos that referenced this pull request Jul 15, 2026
- **Truncated multi-reference bookmarks**: `BackEnd::parse_verse_list()`
  used `popError()` as a loop-termination condition, which also fires
  when a single element in the list fails to resolve — silently
  dropping every element after it, even valid ones. Switched to
  indexed access (`getCount()` / `getElement()`), so one bad reference
  no longer swallows the rest of a bookmark's verse list.

- **Unreadable text on dark tag colors**: the current-verse `<font
  color="...">` wrapper was applied unconditionally, overriding the
  contrast color already computed for the tag background. It's now
  skipped whenever a tag color is active, so the computed
  black/white contrast color is respected instead.

- **Major bug: verse text turning invisible for the rest of the
  chapter**: the tag-color `<span>` and the current-verse/annotation
  `<span><font>` were opened independently but shared a single,
  under-conditioned closing statement. When a verse had a tag color
  but wasn't the current verse, the highlight span was opened is
  never opened but its closing tag was still emitted, corrupting the
  HTML structure for every subsequent verse in the chapter. Each span
  now tracks its own open/close state explicitly.

- **Strong's/morphology links ignoring computed contrast**: verse
  numbers and linked words are colored via a global CSS `a:link`
  rule, which overrides any `color` inherited from an ancestor
  `<span>`. Added a `.tagcolor a:link { color: inherit !important }`
  rule and tagged the relevant span with `class="tagcolor"` so link
  text respects the computed contrast color too.

- **On/off toggle**: added "Colorize verses by folder color" as a
  right-click checkbox item on the bookmarks tree (rather than
  buried in Preferences), matching the existing "Popup menu for
  cross-references" toggle added by crosswire#1335. Defaults to on, persists
  across restarts, and takes effect immediately.

- **Status bar bookmark info on hover**: hovering (not clicking) a
  verse number that belongs to a bookmark now shows "<containing
  folder>: <bookmark name>" in the status bar, making it easier to
  identify which of several similarly-colored bookmarks a verse
  belongs to — without exposing the full nested folder path.

- The luminance/contrast calculation itself (`text_color_for_bg`)
  was already correct; the "dark green on black" and "white on
  white" issues were caused by other elements overriding its output,
  not by the luminance formula.
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