rstudio / rstudio

RStudio is an integrated development environment (IDE) for R
https://posit.co/products/open-source/rstudio/
Other
4.68k stars 1.09k forks source link

Pressing "alt gr" jumps one character back #4584

Closed innir closed 2 years ago

innir commented 5 years ago

Since I updated RStudio to 1.2.1330, I have a strange issue:

Pressing "alt gr" jumps one character back, that makes working on a German keyboard really hard as I need this key to type [, \ and the like.

An example, when I wrote tmp and want to add [ I actually get tm[p instead of tmp[ - this does only happen with RStudio, other programs are not affected.

> sessioninfo::session_info()
─ Session info ──────────────────────────────────────────────────
 setting  value                       
 version  R version 3.4.4 (2018-03-15)
 os       Ubuntu 18.04.2 LTS          
 system   x86_64, linux-gnu           
 ui       RStudio                     
 language en_US:en                    
 collate  en_US.UTF-8                 
 ctype    en_US.UTF-8                 
 tz       Europe/Berlin               
 date     2019-04-05                  

English local with German keyboard

$ setxkbmap -query
rules:      base
model:      pc104
layout:     de

Pressing "alt gr"

$ xinput test 7
key press   113 
key release 113 
innir commented 5 years ago

Maybe related to https://github.com/rstudio/rstudio/issues/4247 ? The mentioned system dialogs are not affected here as well...

And still present in 1.2.1335...

kevinushey commented 5 years ago

Some other questions:

Screen Shot 2019-04-05 at 10 18 54 AM

Are you using RStudio through X11? A similar issue is reported separately here: https://github.com/Microsoft/vscode/issues/24783, but I'm not aware of a similar kind of workaround for RStudio.

innir commented 5 years ago

My findings:

jmkekala commented 5 years ago

I have this issue as well with the RStudio IDE 1.2.1335 with XRDP (Finnish/Swedish keyboard layout) When I start the the RStudio IDE and try to write character with alt-gr (for example character $) then the cursor automatically jumps back one character. This issue happens in both console and editor. This issue also occurs with the latest preview version 1.2.1541.

If I downgrade back to version rstudio-1.1.463 this does not happen.

Specs: CentOS 7 Gnome Classic desktop XRDP 0.9.10-1 with xorgxrdp

ronblum commented 5 years ago

Issue #5130 is a duplicate, but here is the information from it, courtesy of @sdittmar:

System details

RStudio Edition : Desktop
RStudio Version : 1.2.1335
OS Version      : Linux Debian 9
R Version       : 3.5.2

Steps to reproduce the problem

Push Alt Gr Key.

Describe the problem in detail

When I push the Alt Gr key on a German keyboard, the cursor moves one place to the left. That is particularly painful since the Alt Gr key is needed on a German keyboard to type curly brackets. The effect only occurs in R-Studio and not in any other programs every since I upgraded to v1.2.1335 a few days ago. Interestingly, the functional effect of the Alt Gr key remains in place. That means if I move one character to the right from where I want to insert a curly bracket, I can use the normal combination of Alt Gr and the 7 key to insert a curly bracket in the correct position after the cursor moved one position to the left in the same process.

I checked Linux and R-Studio keyboard shortcuts to see if something there might cause any problems (I don't usually use these functionalities), but there is nothing defined for the relevant key. In fact, if I try to set up a keyboard shortcut in R-Studio and push the Alt Gr key, the shortcut reads "Left".

This is the /etc/default/keyboard file I am using:

XKBMODEL="pc105" XKBLAYOUT="de" XKBVARIANT="" XKBOPTIONS=""

BACKSPACE="guess"

Describe the behavior you expected

Cursor does not move when I push the ISO level 3 shift key (Alt Gr).

sdittmar commented 5 years ago

Btw, my issues above was also during an RDP session from Win7 to Linux Debian 9...

ChrWesp commented 4 years ago

Hello everyone, is there any update on this or does anyone have a good workaround for this? We are also struggeling on this issue. Thanks

peikert commented 4 years ago

Same issue here. I am connecting via remote desktop from Win10 to Ubuntu18.

RaulKite commented 4 years ago

any idea to solve it?

Thanks

dinilu commented 4 years ago

Same problem here. RStudio runs in an Ubuntu Server 18.04 accessed from W10 through RXDP. The whole system seems to work fine with Alt Gr not showing this behaviour. However, as soon as it is in RStudio it moves the cursor one position to the left. Let me know if I can provide more details to help fix the issue.

kevinushey commented 4 years ago

One way around this that I'm fairly sure should work -- you could set up RStudio Server and access RStudio through a browser, rather than accessing RStudio Desktop remotely.

Unfortunately I don't think we'll be able to fix this in time for the v1.3 release.

Andreas-Bio commented 4 years ago

Same problem here. Not usable in this state. It has been almost a year since the original report.

rfbrondum commented 4 years ago

I am experiencing the samme issue using Rstudio 1.3.959 with a Danish keyboard on Ubuntu 16.04 remote desktop from win10 through X2Go.

peterblattmann commented 4 years ago

Experiencing exactly the same issue with RStudio 1.3.1056 and Swiss German keyboard on Ubuntu 18.04 connecting from a windows machine using remote desktop connection. It is especially annoying as it affects typing square brackets.

andreas5232 commented 4 years ago

Google brought me here when searching for the same issue in combination with Windows10 Remote Desktop and vscode on Ubuntu. I don't know rstudio, but maybe this helps you finding a fix or workaround: https://github.com/Microsoft/vscode/issues/24783

stale[bot] commented 3 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs, per https://github.com/rstudio/rstudio/wiki/Issue-Grooming. Thank you for your contributions.

innir commented 3 years ago

As the issue is still present in the current version, I don't think is appropriate to close this bug.

CoveredInChocolate commented 3 years ago

Just installed R 4.0.4 and RStudio 1.4.1106. I got the same issue and found this by googling. I am using a Norwegian keyboard and I am remotely connected to my Ubuntu with xrdp.

I have no idea if it is related, but I had the same problem in Visual Studio Code, but there you can change an option. https://github.com/Microsoft/vscode/issues/24783

AlexanderBartholomaeus commented 3 years ago

Same issue for me. Just installed R 4.04 and Rstudio 1.4.1106 updated Rstudio and now AltGr move cursor to the left. No other program is effected.

Additionally: If I open the Terminal in Rstudio and work on the command line the issue is also here. That mean that it must be some rstudio issue.

JakobJuergens commented 3 years ago

Experiencing the same issue, while using RStudio in Ubuntu in a WSL2 setup. Makes it pretty much unusable to the point, where I think about replacing my keyboard with a QWERTY one, since I need RStudio for work.

pzuldp commented 3 years ago

Hi ! I don't know whether it's useful to report that this is a problem for me as well, since many users have already posted their own specifics, but just in case : same here, accessing Rstudio 1.4.1106 (and R 4.04) on a Debian server from Windows 10 via x2go/x11, and a French keyboard (and same issue when accessing from Ubuntu 20.04). Hopefully someone can find a fix! cheers

jmkekala commented 3 years ago

Same issue rstudio-1.4.1717 when connecting over RDP from Win10 client Keyboard layout: finnish/swedish host: RockyLinux 8.4 Gnome 3.32.2 XRDP 1.0.9.16 xorgxrdp 0.2.16

AlexanderBartholomaeus commented 3 years ago

I did some more testing (as written on Mar 26 above still with R 4.04 and Rstudio 1.4.1106):

The problem is really inconvenient when working on frequently used multi-user servers as testing another or fresh installation of Rstudio is not simply possible

mikebessuille commented 3 years ago

Possibility this is related to QT, so we should re-test after moving to Electron. Note, looks like people are seeing this problem specifically on remote desktop.

ghost commented 3 years ago

Go to Tools > Modify Keyboard Shortcuts > Reset.

Most likely you hit a key combination that set a shortcut (probably ctrl + ...). I don't know if this is a permanent and/or easy solution but it should fix it for now...by the way, I checked and it also works for German and French keyboards. Screenshot from 2021-07-22 07-32-25

snowpong commented 3 years ago

I can replicate this in on my local Windows 10 machine when running RStudio on Ubuntu via X2Go.

Ubuntu 18.04.5 LTS RStudio Version 1.4.1717 (QtWebEngine/5.12.8) Norwegian keyboard layout Qt software rendering (no GPU) R 4.1

This is very likely a Qt bug. My guess it there are platform specific workarounds concerning AltGr that kicks in that shouldn't. I see that QPA has an AltGr plugin for Windows for example.

When I run xev I get

KeyPress event, serial 31, synthetic NO, window 0x600001,
    root 0x84, subw 0x0, time 979238972, (-740,897), root:(1100,1242),
    state 0x0, keycode 113 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
    XLookupString gives 0 bytes: 
    XmbLookupString gives 0 bytes: 
    XFilterEvent returns: False

KeyRelease event, serial 31, synthetic NO, window 0x600001,
    root 0x84, subw 0x0, time 979239055, (-740,897), root:(1100,1242),
    state 0x80, keycode 113 (keysym 0xfe03, ISO_Level3_Shift), same_screen YES,
    XLookupString gives 0 bytes: 
    XFilterEvent returns: False
JakobJuergens commented 3 years ago

No new information, but I grew so frustrated with it, that it became the final straw that made me learn typing on a US-keyboard. I'm not looking back if I'm honest and should have done so earlier - even though my last name has a German Umlaut in it.

snowpong commented 3 years ago

This is pretty horrible. Has anyone here found a workaround? The switch to US-keyboard suggested by @JakobJuergens is too radical.

gtritchie commented 2 years ago

We need to test this once we have Electron preview builds.

gtritchie commented 2 years ago

Confirmed this is fixed by the move to Electron.

I tested on Ubuntu 20.04.4 using the "English (US, intl., with dead keys)" keyboard, remoting to the Linux machine from a Windows-computer using Remote Desktop application.

I reproduced the problem with a recent daily build (Qt), then installed the same Electron build (2022.06.0-daily+248), and the problem no longer happened. Was able to type in characters using the Alt-Gr key without it moving the cursor backwards.

SebastianConSchneider commented 1 year ago

Dear all,

this issue seems to have reappeared for me using Debian GNU/Linux 11 (x2go) via remote-desktop from W10. I am using Rstudio 2022.07.2+576 and a German keyboard layout. I am limited to the following other Rstudio versions: 22.07.0, 22.07.1, 22.02.0, 22.02.1, 22.02.2, 22.02.3, 21.09.0, 21.09.1, 21.09.2 but not more. I have tested some sporadically, but the issue has been present for all of them so far.

Thank you very much!

gelberlaubfrosch commented 9 months ago

@SebastianConSchneider There is a link for a solution in the issue linked above: https://github.com/microsoft/vscode/issues/24783 Here the direct link https://github.com/Microsoft/vscode/wiki/Keybinding-Issues#troubleshoot-linux-keybindings

Are you connecting to the Linux machine via some form of virtualization or remote desktop software?

symptoms: e.g. pressing AltGr acts as Backspace, pressing C acts as ArrowLeft, etc. solution: use "keyboard.dispatch": "keyCode" in your settings and restart VS Code. explanation: VS Code on Linux dispatches keybindings using scan codes to accomodate various keyboard layouts. This works well when sitting physically at the machine and the OS is the one creating keyboard events, but some virtualization / remote desktop software creates keyboard events with incorrect scan codes.