Menu

#2401 TeXStudio inserting ramdom ascii symbols in the code

open
nobody
None
1
2019-02-03
2018-11-02
Anonymous
No

I am using TeXstudio 2.12.6 (hg 6632:7777b2b8a906) with Qt-version 5.9.1, compiling with Qt 5.9.1 R.
Although I am a different user, I basically want to resubmit the bug with ticket-no. #2184, since I have the same problem of random ascii smbols inserted in the code, after entering "\" to introduce a command.

Thank you very much for your help!

Discussion

  • Christoph Fröhlich

    I experienced the same problem with different versions of TeXstudio over the last years. I never experienced the same error with other programs, but his may be only due to the fact that I barely use the backslash outside of the tex-world.

    I use Windows 7x64 with a Cherry keyboard and the out-of-the-box Microsoft driver, without any (known) keyboard utilities installed on the system.

     
    • Rudi82

      Rudi82 - 2018-11-30

      I experience quite frequently the same problem, but not limited to TS but in other programs as well (yet most frequently in TS, across all versions used so far). Therefore, it seems not specific to TS. I use an external keyboard (IBM M, the "machine gun") via a USB-hub (also no extra drivers). I suspect the USB-connection to issue/insert extra-"impulses" being transformed into codes for spades, diamonds, bullets, or other special characters. No idea, what the true reason is, but I don't think, TS is the culprit.

       

      Last edit: Rudi82 2018-11-30
  • Maxime Oger

    Maxime Oger - 2019-02-03

    I know what the issue is: this is a bug in TeXMaker and TeXStudio for Windows involving the alt gr key. Unicode characters appear seamingly randomly after releasing the alt gr key, and thus after “\” but also “{”, ”[” or “@” for instance.

    I have finally found a consistent way to reproduce the bug! First, some general explanation: I believe the bug happens for every international keyboard layouts with alt gr (french, german, spanish, and many others) but triggers seamingly so rarely and randomly that nobody bothered to fix it. It happens in both TeXMaker and TeXStudio, and I think only in Windows. Indeed, I am pretty sure the root of the problem comes from the fact that alt gr is treated as alt+ctrl in windows.

    There's also an unwanted behaviour which might (or might not…) be related: alt gr (or ctrl+alt even in english keyboard layout) + “normal” letter (a, b, … , z) outputs a capital letter A, B, … , Z instead of the lowercase one.

    So now, to repoduce the bug:

    Initial state: TeXMaker (or TeXStudio) is not opened. Keyboard layout has alt gr.
    Steps:
    1) Open TeXMaker (or TeXStudio), open a file (new or already created, doesn't matter).
    2) Press and release alt gr once.
    3) Type a number with distinct digits, using Numpad.
    4) Press and release alt gr.

    Result: a unicode character appears, as if you had held the alt key, typed the number and released the alt key. For example, typing 1 then tap alt gr outputs ☺ (the alt+1 character), typing 78 then tap alt gr outputs N (the alt+78 character).

    As long as you haven't typed all the digits (from 0 to 9), you can input missing ones and you will get a new character after releasing alt gr.

    For instance, assuming I am only inputing digits, followed by pressing and releasing the alt gr key, and repeat until I've depleted all the digits, I can get the sequence:
    1☺781N1186877♠33♥450┬0123456789↔

    And now I should be fine for the rest of my TeX session until I close and reopen the software… or am I? There is another way to “reset” the digits for the bug, so that we don't need to do step 1) again i.e. close and reopen TeXMaker (or TeXStudio) to get the bug for already inputted digits: simply do step 1') Switch the keyboard layout twice (if you switch between two keyboard layouts that have alt gr, you could do it only once, although it seems that sometimes it doesn't resets the digits the first time).

    Various remarks:

    • You can input any non-digit character you want during any of the steps (well, after step 1) of course) and in-between any digits in any manner you want (as long as it doesn't involve alt gr obviously), this will not affect the bug. That explains why the bug appears so random, as often you don't start typing digits right away, and when you finally do, you may end up using the alt gr key only a long time after having used those digits: “There are 3 sort of people: those who know how to count and \♥emph…”
    • After step 1) or 1') and before step 2), if you input digits, then do step 2), no character will be output after you release the alt gr key. However, the digits are “used”, that is to say they will not count for the bug if you input them again.
    • Whenever you start TeXMaker (or TeXStudio), or switch your keyboard layout, inputing 0123456789, then pressing and releasing alt gr, and finally deleting the number, is a quick hacky fix that should prevent the bug from ever arising (unless there is some other trigger that also resets the digits and which I am unaware of). Obviously, I'd like TeXMaker to do the fix for me, especially since I am switching layouts quite often (between qwerty for math formulas, and azerty and bépo for french and special characters). But a better solution would be to look at the alt, ctrl and alt gr code and revamp all that to make sure alt gr can't produce alt-code characters (and capital letters instead of lowercase when neither shift nor caps lock are activated, as I mentioned previously).
    • I know this is the place to report bugs for TeXStudio, but I am using TeXMaker and would like the bug to be fixed for both. Unfortunately, I don't know how to report the bug for TeXMaker.

    EDIT: I forgot to mention that, on my french azerty (and bépo) layouts, the bug only happens for Numpad digits. Using the top row digits doesn't count toward the bug.

     
    👍
    1

    Last edit: Maxime Oger 2019-02-03
  • Denis Bitouzé

    Denis Bitouzé - 2019-02-03

    Unfortunately, I don't know how to report the bug for TeXMaker.

    Here: http://www.xm1math.net/texmaker/log_fr.html#contact ?

     
    • Maxime Oger

      Maxime Oger - 2019-02-03

      Thank you, I have sent them a message.

       
  • Jan  Sundermeyer

    Jan Sundermeyer - 2019-02-03

    if texmaker and texstudio is affected, it is a general qt problem, nothing directly related to any of this two programs

     
    • Maxime Oger

      Maxime Oger - 2019-02-03

      Please, let's not get into “Qt is the only and single culprit, so won’t fix anything” (in that case, just rewrite TeXStudio without it, since it's clearly not the first Qt-related bug), and actually try to fix the bug or find a way around it that solves the problem.

      I have already given a dirty hack that would prevent the bug from happening (even though it is still there under the hood) if implemented directly in TeXMaker/TeXStudio's code: input 0123456789, backspace×10, AltGr at program launch and at every keyboard layout switch.

      But as I said, it's the Alt and Ctrl modifiers code which probably need to be fixed. Maybe the warning from Qt's doc “On Windows, when the KeyDown event for this key is sent, the Ctrl+Alt modifiers are also set.” hasn't been taken thoroughly into account. In any case, there is a specific and serious problem to TeXMaker and TeXStudio's code, which needs to get resolved and not swept under the rug.

       

Log in to post a comment.

MongoDB Logo MongoDB