Skip to content

Fix set name key conversion on set switch - #1357

Closed
LAfricain wants to merge 2 commits into
crosswire:masterfrom
LAfricain:parallelsets-fix
Closed

Fix set name key conversion on set switch#1357
LAfricain wants to merge 2 commits into
crosswire:masterfrom
LAfricain:parallelsets-fix

Conversation

@LAfricain

Copy link
Copy Markdown
Contributor

When switching sets via the ComboBox, the displayed name (with spaces)
was being stored directly in settings.xml instead of the XML key
(with underscores), causing a mismatch on next startup.

Apply name_to_key() before storing parallel_set_current and before
calling get_parallel_set() when switching sets.

lafricain79 added 2 commits August 1, 2026 20:33
Set names with spaces or other XML-special characters caused a parser
error on startup when used as XML tag names (e.g. 'Short set' became
<parallel_set_Short set> which is invalid XML).

Fix: automatically convert spaces to underscores when storing set names
as XML keys, and convert back for display in the UI.

New helpers in settings.c:
  name_to_key(name) - convert display name to XML key (space -> _)
  key_to_name(key)  - convert XML key to display name (_ -> space)

Fixes crash on startup when a parallel set name contains a space.
When switching sets via the ComboBox, the displayed name (with spaces)
was being stored directly in settings.xml instead of the XML key
(with underscores), causing a mismatch on next startup.

Apply name_to_key() before storing parallel_set_current and before
calling get_parallel_set() when switching sets.
@LAfricain

Copy link
Copy Markdown
Contributor Author

I hope this works! I've run several tests and it seems to be working...

@karlkleinpaste

Copy link
Copy Markdown
Contributor

sigh

$ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
$ patch -p1 < ~/Desktop/1357.patch
patching file src/gtk/navbar_versekey_parallel.c
Reversed (or previously applied) patch detected!  Assume -R? [n] n
Apply anyway? [n] n
Skipping patch.
3 out of 3 hunks ignored -- saving rejects to file src/gtk/navbar_versekey_parallel.c.rej
patching file src/gtk/preferences_dialog.c
Reversed (or previously applied) patch detected!  Assume -R? [n] n
Apply anyway? [n] n
Skipping patch.
4 out of 4 hunks ignored -- saving rejects to file src/gtk/preferences_dialog.c.rej
patching file src/main/settings.c
Reversed (or previously applied) patch detected!  Assume -R? [n] n
Apply anyway? [n] n
Skipping patch.
2 out of 2 hunks ignored -- saving rejects to file src/main/settings.c.rej
patching file src/main/settings.h
Reversed (or previously applied) patch detected!  Assume -R? [n] n
Apply anyway? [n] n
Skipping patch.
1 out of 1 hunk ignored -- saving rejects to file src/main/settings.h.rej
patching file src/gtk/preferences_dialog.c

Try again.

@greg-hellings

Copy link
Copy Markdown
Contributor

@karlkleinpaste Not sure what you're doing to pull a patch file like that and apply it. You can just directly check out his branch. Two main ways:

If you do not have the Github client installed

  1. git remote add lafricain git@github.com:LAfricain/xiphos.git
  2. git fetch lafricain
  3. git checkout lafricain/parallelsets-fix

If you DO have the Github client installed

gh pr checkout 1357

@karlkleinpaste

Copy link
Copy Markdown
Contributor

Not sure what you're doing to pull a patch file like that and apply it.

I do what I've always done wtih GH PRs: I add ".patch" to the url, save that patch file, and apply it in a clean branch from master (or in my local master itself, if I don't want to bother creating a temp local branch, because cleaning up the results of an applied patch is easy) with patch -p1.

@greg-hellings

Copy link
Copy Markdown
Contributor

I'd suggest choosing either the native Git method or setting up the Github CLI client. Either one makes testing PRs a far smoother experience!

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.

3 participants