Skip to content

fix file history order number displaying 0 instead of 10#5635

Closed
BenK10 wants to merge 1 commit into
sumatrapdfreader:masterfrom
BenK10:fix-order
Closed

fix file history order number displaying 0 instead of 10#5635
BenK10 wants to merge 1 commit into
sumatrapdfreader:masterfrom
BenK10:fix-order

Conversation

@BenK10
Copy link
Copy Markdown

@BenK10 BenK10 commented May 20, 2026

Once 10 files have been opened, the file history menu displays the oldest item as number 0 instead of number 10.
This is caused by some arithmetic involving +1 and modulus.

For this fix to work, the loop bound in function AppendRecentFilesToMenu and the modulus operand in function AddFileMenuItem must have the same value (they already did, I just made it explicit by replacing a "magic value" with the constant kFileHistoryMaxRecent). Otherwise the menu numbers may "wrap around".

ordinal-bug

@GitHubRulesOK
Copy link
Copy Markdown
Collaborator

Hmm I am not the developer but the 0 is AFAIK intentional it is the key on the keyboard after 9

@BenK10
Copy link
Copy Markdown
Author

BenK10 commented May 20, 2026

Indeed you can select files with the 0-9 keys when the file history menu is open.
But I didn't know that, and there is no such command on the shortcuts page.

@BenK10 BenK10 closed this May 20, 2026
@GitHubRulesOK
Copy link
Copy Markdown
Collaborator

it is probably so old from 20 years ago it never got fully documented and the other old one has traditionally been used without 0
Alt + 1 go to tab 1. Use Alt + 2, etc. up to Alt + 8 Alt + 9 go to last tab

@BenK10
Copy link
Copy Markdown
Author

BenK10 commented May 20, 2026

I concluded that, odd as it may look, this is intentional.

If you open the menu with Alt key and navigate that way, the numbers in the file history are underlined, just like other menu shortcuts that appear when menus are accessed this way. In fact, my aesthetic fix breaks the number 0 key shortcut since only the first character in the history section is a shortcut, so the shortcut key for item 10 becomes 1 instead of 0.

I normally use the mouse, so I did not even consider this, nor have I seen any other program do it this way. LibreOffice for example will display number 10 with the 0 underscored as the shortcut key. But it has to because it displays more than 10 recent items.

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