While playing Factorio I use Ctrl+C, Ctrl+V quite often. Most of the time I start the game they work, but for some runs they don't. The only solution to the problem I know is to restart the game, but after restarting it again can work and can not work. On bad days when Ctrl+C, Ctrl+V refused to work I had to use mouse to copy/paste.
When Ctrl+C, Ctrl+V don't work they behave as if Ctrl is not pressed. For example Ctrl+X swaps panels 1<->2 at the bottom of the screen as if X is pressed.
A little bit of background
I, as most other Russian speakers, use two keyboard layouts. US for entering Latin characters and RU for entering Cyrillic. There is a key combination (Alt+Shift most often) to switch between these two layouts. People switches between these two layouts quite often. For example to type an URL in browser you had to use US layout and instant messaging is most often done in RU layout.
It is important to note that the currently active layout at the start of the game is basically random thing that depends on what the user typed last.
Also note that I use Linux, perhaps this problem is Linux specific. I haven't tested other operating systems.
What I discovered
At some point I decided to investigate what exactly is going on. I would like to note that I have read viewtopic.php?f=7&t=65881 and https://www.factorio.com/blog/post/fff-259 and what I concluded is that the behavior I observe is not intended and erroneous as I found out only Ctrl key is broken.
I discovered that
- The problem manifests only when the game is started with Russian keyboard layout. When the game is started with US Ctrl+Anykey works as expected.
- Switching keyboard layout in game doesn't help, only what matters is the keyboard layout at game start (which is, as I noted above is basically random for Russian speakers)
- Only Ctrl+Somekey shortcuts are broken. Normal keys works well as well as Alt+Anything.
I noticed that when the game is started with Russian layout, in Settings+Control it prints Cyrillic letters that maps to the same key on the keyboard. For example instead of W it prints Ц, R->К, Shift+R->Shift+К. It is suspicious that for all Ctrl+X, Ctrl+C, Ctrl+V it prints Ctrl+KEY_0 (number zero). I tested all keys on my keyboard and I haven't found the key that matches KEY_0. If I assign Ctrl+Z, Ctrl+X, Ctrl+C, Ctrl+V manually to Ctrl+Я, Ctrl+Ч, Ctrl+С, Ctrl+М, they will work. So game is perfectly capable to handle Ctrl+Somekey and the problem is with configuration.
I attached three screenshots. is how Settings->Control looks when key bindings are reset to the default value and the game is started when Russian keyboard layout was active (you can see Ctrl+KEY_0 is set for all Ctrl+Somekey shortcuts). is when I assigned correct keys for Russian keyboard layout. is when I saved settings and restarted the game with english keyboard layout as you can see main and alternative keys match.
This is how config file ~/.factorio/config/config.ini looks like when saved from Russian keyboard layout:
Code: Select all
; copy=CONTROL + keycode-0 copy-alternative=CONTROL + C ; cut=CONTROL + keycode-0 cut-alternative=CONTROL + X ; paste=CONTROL + keycode-0 paste-alternative=CONTROL + V ; undo=CONTROL + keycode-0 undo-alternative=CONTROL + Z
Code: Select all
; copy=CONTROL + C copy-alternative=CONTROL + C ; cut=CONTROL + X cut-alternative=CONTROL + X ; paste=CONTROL + V paste-alternative=CONTROL + V ; undo=CONTROL + Z undo-alternative=CONTROL + Z
Although my original bug report was about not working Ctrl+Somekey key combinations. I would like to suggest one minor tweak to Settings->Control menu.
At the moment it prints either english or russian letters depending on what keyboard layout was when the game started. Can this dialog redraws and updates letters when user change keyboard layout while in-game?