Describe the bug
In NAPS2, the View and Black and White actions cannot be assigned separate keyboard shortcuts.
When I assign a keyboard shortcut to View under:
Settings → Keyboard Shortcuts
the same shortcut is automatically assigned to Black and White.
Likewise, if I assign a different shortcut to Black and White, the shortcut assigned to View changes to the same key.
Therefore, both actions always end up with the same shortcut, and pressing the shortcut executes View instead of Black and White.
Steps to reproduce
- Open NAPS2.
- Go to Settings → Keyboard Shortcuts.
- Select View.
- Assign a shortcut, for example
F8.
- Select Black and White.
- The shortcut is also shown as
F8.
- Now assign
F9 to Black and White.
- Return to View.
- It is now also assigned to
F9.
The problem occurs in both directions.
Versions tested
The problem occurs in both versions.
Additional testing
I also tested this by manually editing the NAPS2 configuration file.
For example:
<KeyboardShortcuts>
<ImageView>Ctrl + Divide</ImageView>
<ImageBlackWhite>Ctrl + Subtract</ImageBlackWhite>
</KeyboardShortcuts>
After opening Settings → Keyboard Shortcuts, NAPS2 displays Ctrl + Divide for both View and Black and White.
This indicates that the problem is not simply an invalid keyboard shortcut or an XML formatting issue.
Possible cause
I inspected the NAPS2 source code and found what appears to be the cause in KeyboardShortcutsForm.cs.
The entries for View and Black and White currently use the same configuration property:
new(UiStrings.View, c => c.KeyboardShortcuts.ImageView),
new(UiStrings.BlackAndWhite, c => c.KeyboardShortcuts.ImageView),
The second line appears to be incorrect. It should presumably be:
new(UiStrings.View, c => c.KeyboardShortcuts.ImageView),
new(UiStrings.BlackAndWhite, c => c.KeyboardShortcuts.ImageBlackWhite),
Interestingly, the actual desktop shortcut registration appears to treat the two actions separately:
_ksm.Assign(ks.ImageBlackWhite, commands.BlackWhite);
...
_ksm.Assign(ks.ImageView, commands.ViewImage);
Therefore, the problem appears to be specifically in the Keyboard Shortcuts settings UI, where the Black and White entry incorrectly references ImageView.
Expected behavior
View and Black and White should be independently configurable, for example:
F8 → View
F9 → Black and White
Changing one should not change the other.
Describe the bug
In NAPS2, the View and Black and White actions cannot be assigned separate keyboard shortcuts.
When I assign a keyboard shortcut to View under:
Settings → Keyboard Shortcuts
the same shortcut is automatically assigned to Black and White.
Likewise, if I assign a different shortcut to Black and White, the shortcut assigned to View changes to the same key.
Therefore, both actions always end up with the same shortcut, and pressing the shortcut executes View instead of Black and White.
Steps to reproduce
F8.F8.F9to Black and White.F9.The problem occurs in both directions.
Versions tested
The problem occurs in both versions.
Additional testing
I also tested this by manually editing the NAPS2 configuration file.
For example:
After opening Settings → Keyboard Shortcuts, NAPS2 displays
Ctrl + Dividefor both View and Black and White.This indicates that the problem is not simply an invalid keyboard shortcut or an XML formatting issue.
Possible cause
I inspected the NAPS2 source code and found what appears to be the cause in
KeyboardShortcutsForm.cs.The entries for View and Black and White currently use the same configuration property:
The second line appears to be incorrect. It should presumably be:
Interestingly, the actual desktop shortcut registration appears to treat the two actions separately:
Therefore, the problem appears to be specifically in the Keyboard Shortcuts settings UI, where the Black and White entry incorrectly references
ImageView.Expected behavior
View and Black and White should be independently configurable, for example:
F8→ ViewF9→ Black and WhiteChanging one should not change the other.