Newbie question: I have to press the left / right arrow keys twice to move one character


#1

Hi there,

I’m rather new to Atom but recently (don’t know what caused it to start and it might only be related to a specific type of file with extension “strings”) I need to press my left-/right-arrow keys twice to move the cursor a single position in the requested direction.
As this is quite annoying, I started digging around but until now I just found a few leads on how to “debug” but not how to fix it.
Anyone able to help?

I pressed “Cmd+.” to be able to see how my keypresses are interpreted and this is what I found when pressing the Right-arrow key:

I also figured out that when I hover over the presented lines, I can “edit” these files.
When I look at the “core:darwin.cson” and check out what is listed for the “left” and “right” keys, it shows:
“left”: “core:move-left”,
“right”: “core:move-right”,

As said in the beginning, strange enough, this issue seems to be related to files of type “strings” as within that darwin.cson file and with other files, the keybehaviour is acting normal, so a single press of an arrow key is required to move it a single position.

All of this is just related to left / right. Up / down is NOT affected.

I’m running Atom version 1.18 on Mac OS-X Sierra (10.12.5).

Anyone any suggestions?

Regards,
Rob.


#2

Some more info.
Opening the file in another editor (as this was not working in Atom), gave me the following view:

That immediately showed me why the extra keystroke was required. There’s a strange character that is NOT visible in Atom (at least with my settings).

After figuring out what happened, I come to the conclusion that this all started after opening the files from Mail directly into Atom.
First saving the files to disc and then opening them (in the other editor), revealed that the strange characters disappeared.
However, opening them in Atom still forced me to press the arrow keys twice :frowning:


#3

Opening the files in Atom, showed me immediately a few characters are added to the beginning of the first sentence:


#4

Starting to edit the file and saving it, completely messed up the file in the other editor:

I don;t know what and why this is happening but, for now I must admit, Atom is not usable for these files.

I sure hope there’s a solution for this.

Regards,
Rob


#5

BTW: The alternate editor used in this test was TextWrangler.


#6

This looks like an encoding issue. The file appears to be UTF-16 but it’s opened as UTF-8. You can try manually changing the encoding in Atom by pressing Ctrl-Alt-U (or the equivalent in Mac, I’m a PC user) or just pressing the encoding in the status bar (where it says UTF-8).


#7

Thanks Madak!
That did the trick!!! (By selecting one of the UTF16 formats from the bottom of Atom, could not find the right key-combination for that on Mac).

Do you perhaps know about a way to let Atom detect the right format?

Regards,
Rob.


#8

FYI: I found the “Default File Encoding” in settings, but I don’t know whether there’s a more intelligent way of dealing with this as using the “Settings” options is rather static / less intelligent.


#9

See https://github.com/atom/encoding-selector/issues/24