Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Escape ampersands in mod info abstract label #3429

Merged
merged 1 commit into from
Sep 18, 2021

Conversation

HebaruSan
Copy link
Member

Problem

If a mod has & in its abstract, it is hidden and the next character is underlind in the mod info abstract label:

windows

linux

A similar issue with the mod list was fixed in #3149.

Cause

WinForms Labels (and some other controls) treat & as a hotkey indicator; the next character in the text is used as the hotkey such that if you press Alt and that key, the control (or the next control in the tab order) receives focus. This is indicated visually by hiding the & and underlining the next character.

Usually it's not a good idea to expose this functionality to external data sources such as abstracts entered into SpaceDock; they generally just want the & to display normally, which is accomplished by doubling it to &&.

Changes

Now we double any ampersands in the abstract when populating them into the mod info abstract, which makes them display normally:

image

Fixes #3428.

@HebaruSan HebaruSan added Bug Easy This is easy to fix GUI Issues affecting the interactive GUI Pull request labels Aug 4, 2021
Copy link
Member

@DasSkelett DasSkelett left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A bit unfortunate that Mono and Framework decided to behave differently in the grid list case. But a double ampersand is probably more readable than no ampersand and a weird underscore.
At least this PR fixes it for the side panel.

@HebaruSan HebaruSan merged commit b6f7903 into KSP-CKAN:master Sep 18, 2021
@HebaruSan HebaruSan deleted the fix/modinfo-abstract-ampersand branch September 18, 2021 00:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Easy This is easy to fix GUI Issues affecting the interactive GUI Pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] Ampersands not escaped in mod info, doubled in grid on Windows
2 participants