-
Notifications
You must be signed in to change notification settings - Fork 90
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
[BUG] Cannot type the letter 'n' in the script editor #177
Comments
PS: No, there is nothing wrong with my keyboard ;) |
I've had this issue all year.. thought it was just me :) ... Linux + Razor |
Key mapping issue, would need someone to debug it locally to find out what the actual mapping is. |
Is happening for me as well, I'll try to figure out where the problem is. |
Well, it's not a mapping issue. It's an unlucky combination of some strange form/control behaviour under mono, and a strange design decision by the author of FastColoredTextBox. The strange decision: FCTB overrides the underlying WinForms events for OnKeyDown, OnKeyUp, and ProcessMnemonic, but rolls it's own OnKeyPressed and OnKeyPressing. The latter two are purely internal and not inherited from it's base class. The 'N' key comes through for OnKeyDown and OnKeyUp, but not ProcessMnemonic. All actual text input processing for the FCTB control is handled in ProcessMnemonic, and since 'N' isn't being passed to it from the base control, 'N' can't be typed in to the script editor. That seems strange to me, I'd have overridden OnKeyPress and done the heavy lifting there. Anyway, the 'N' does not come through on that one, because... The strange behaviour under mono: For reasons I haven't yet figured out, when running under Mono the FCTB control is inheriting the Mnemonics of it's parent, MainForm. The only Mnemonic present in MainForm (set not in Razor.Designer.cs, but by the various language translation files under etc/Language/Razor_lang.*) is the New Profile button under the General tab. But, the N key only triggers that button if the General tab has focus; If the Scripts tab has focus, the button traps the key without being activated, and FCTB doesn't get it's N. I see three options for fixing this: Finding and stopping the incorrect mnemonic-inheritance between MainForm and FCTB, removing the mnemonic entirely, or editing FCTB to move it's input processing out of that function and in to OnKeyDown, OnKeyUp, or adding a proper override for OnKeyPress and doing it there. |
Mostly it's strange behaviour under mono. The letter isn't passed to a properly overridden OnKeyPress either. Three options: Figure out why it happens under Mono and get it fixed, remove mnemonics, or move FCTB's input processing to OnKeyDown or OnKeyUp. Option one, I don't have the know-how to pursue, and nothing the size of Mono responds quickly to patches anyway. Option two isn't really fixing the problem, and option three would be very annoying, since OnKeyDown/OnKeyUp receive a KeyCode not a KeyChar, meaning we'd have to re-invent the wheel to get upper/lower case and proper modifier handling. So I went with option four: Ugly hack. PR for it will be in shortly. |
Thank you!!! |
You are welcome. I expect that the problem will actually resolve itself if/when the switch away from a Winforms UI happens, without needing a patch for anything. Until then, and as a purely local work-around, you can edit the file Remove the ampersand will disable the mnemonic entirely, and the 'n' key will work again in the script editor. |
When using ClassicUO 0.1.9 and Razor 1.7.0.12 (though this also happened with some 1.6 version) on Linux, I am unable to type the letter n in the script editor. Typing it works fine in the pop-out editor. Copy-pasting it in works too.
Steps to reproduce:
The text was updated successfully, but these errors were encountered: