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

[CLOSED] Decrease Font Size keyboard shortcut throws error if command is disabled #2851

Open
core-ai-bot opened this issue Aug 29, 2021 · 9 comments

Comments

@core-ai-bot
Copy link
Member

Issue by lkcampbell
Sunday Mar 03, 2013 at 19:25 GMT
Originally opened as adobe/brackets#3030


Background:
I discovered this problem while working on another bug fix for adjusting font sizes. See the discussion at adobe/brackets#3027.

Repro Steps:

  1. Patch Brackets with the pull request at Persisting font size between Brackets Sessions adobe/brackets#3027 or just wait for the pull request to be merged (hopefully).
  2. Make sure all documents in the project are closed.
  3. Open the View Menu and observe that Increase Font Size, Decrease Font Size, and Restore Font Size commands are all disabled.
  4. Hit F12 to launch the Dev Tools and open the console.
  5. Press Ctrl-- (the shortcut key for Decrease Font Size command).

Observed Behavior:
A message is printed in the Dev Tools console: "Uncaught TypeError: Cannot call method 'state' of undefined."

Expected Behavior:
Nothing should happen. The shortcut keys for Increase Font Size (Ctrl-+) and Restore Font Size (Ctrl-0) do nothing. The shortcut key for Decrease Font Size shoud act the same.

@core-ai-bot
Copy link
Member Author

Comment by RaymondLim
Sunday Mar 03, 2013 at 21:11 GMT


@lkcampbell -- I think you can fix it by removing its displayKey (line 161 in base-config\keyboard.json) which is using unicode minus character as its shortcut. And I would like to know whether the issue is on Windows only or or Mac only or both platforms. We can consider on fixing it in native shell if we decide to keep using unicode minus character.

@core-ai-bot
Copy link
Member Author

Comment by WebsiteDeveloper
Sunday Mar 03, 2013 at 22:03 GMT


for me on windows i get errors for all three shortcuts when no document is open and i found a quick fix for the errors because the Command execute function returns undefined if the Command is disabled i fixed this by adding

return (new $.Deferred()).reject().promise()

@core-ai-bot
Copy link
Member Author

Comment by lkcampbell
Sunday Mar 03, 2013 at 22:20 GMT


@RaymondLim:

I'm on Windows 7 and the problem does go away when I edit keyboard.json per your suggestion.

@WebsiteDeveloper:

I'm not seeing the problem with the other shortcuts.

@core-ai-bot
Copy link
Member Author

Comment by RaymondLim
Sunday Mar 03, 2013 at 22:35 GMT


@WebsiteDeveloper:

I don't see any issue with the other two as well.

@lkcampbell:

I'm seeing a new issue after removing displayKey. Now Decrease font size is also showing its shortcut as Ctrl++ (same as Increase font size). So we have to fix the issue in native shell (at least on Windows).

@core-ai-bot
Copy link
Member Author

Comment by WebsiteDeveloper
Monday Mar 04, 2013 at 06:06 GMT


this is weird i merged you branch in the current master to test it and still get the errors i'll try to merge again to see if i made any merge errors or something like that
By the way i'm also on windows 7

@core-ai-bot
Copy link
Member Author

Comment by WebsiteDeveloper
Monday Mar 04, 2013 at 06:16 GMT


it seems that i get this additional errors because of my german keyboard layout where i have 0 + - 2times, on the Num block they all throw an error, and the other ones only the Ctrl-- logs an error.

@core-ai-bot
Copy link
Member Author

Comment by RaymondLim
Tuesday Mar 05, 2013 at 05:52 GMT


@WebsiteDeveloper:

Nice discovery! I can reproduce it with numpad; so it has nothing to do with German keyboard layout. And your solution to fix it from CommandManager execute method is the right way to go. My suggestion of removing the displayKey won't fix the issue if the user uses keys from numpad. So please go ahead and fix it. I'll review your pull request when you submit it.

@core-ai-bot
Copy link
Member Author

Comment by RaymondLim
Tuesday Mar 05, 2013 at 23:04 GMT


FBNC to@lkcampbell

@core-ai-bot
Copy link
Member Author

Comment by lkcampbell
Wednesday Mar 06, 2013 at 01:18 GMT


Confirmed fix. Thanks!

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

No branches or pull requests

1 participant