Keyboard strange behavior


#1

Hi there,

I’ve something strange when using “alt + back” or “alt + delete”… Atom will remove a part of the next line (like the first next word after line break).

This is really annoying and I’ve never saw that behavior into another IDE.

Is someone have any clue on how or why I’ve got that ?

Br,
Mk


#2

Can you please provide us with some more details; OS and Atom version at least.
Also, confirm if you are able to reproduce the behavior after starting Atom by running atom --safe.


#3

Hi there,

I’m under Mac OS 10.9.3 and Atom 0.113.0.
And yes, it happen also on safe mode… :-/

I’ve made a quick capture here to show what is happening:

Sorry for the “Demo Mode” watermark! :slight_smile:

As you can see, when hitting “alt + delete” at the end of a line, it will delete breakline, space (which is correct) but also the first word of the next line.


#4

This is the behavior when a newline is not involved. Why should it be different when at the end of line?

Repro Steps

  1. Type “foo bar baz quux wibble wobble timey wimey” on a line
  2. Put the cursor immediately after the second “o” in “foo”
  3. Press Alt+DEL repeatedly

Notice that each time you press the key command, the space and the following word is deleted.

Additionally, if you separate each word by multiple spaces, Alt+DEL deletes all of the intervening whitespace and the following word.

And finally, if you look in the keymap, the command is named editor:delete-to-end-of-word:

So I would say that this is “by design”.


#5

In fact, Atom is the only editor (used by me) where doing this delete also the following word.
Sublime Text 1 & 2, Coda 1 & 2 or PHPStorm 6, 7 & 8 removes only spaces and breaklines before the next word.

Which seems logic to me in a IDE and so useful !
I can’t see a case where I’ll want to delete all the next spaces and the first word after that…

I’ll try to change the keybindings ! :wink:

Thank you !


#6

Ok, it seems that there is no method to do what I want… (cfr. https://github.com/atom/atom/blob/master/src/editor-view.coffee).

And for illustrating what I’m trying to have (in ST2):

Could someone tell me where I can/have to make this feature request ? :slight_smile:


#7

I just tried it in TextEdit (the basic OS X text editor for those not using OS X) and Coda 2. You are correct, that Coda 2 requires a second key press when dealing specifically with an end-of-line marker. TextEdit (and I would suspect XCode) does not.

You could submit a feature request on Atom Core or you could publish a package or write your own command in your init.coffee.


#8

Thank you @leedohm !

I will try to do both writing my own command and submit a feature request! :wink:


#9

I’ve been annoyed by this as well, and for me it makes more sense to have Alt-Delete delete spaces only, as in ST2. In ST3 I hear it works like it does in Atom now, though.

Did you get around to submitting a feature request, @monkeymonk?


#10

I honestly don’t remember if I have made the feature request… but I think I am !
For command, the one I wrote is really inaccurate… and I currently have no time to do it well.

Here the current state of the command:

# @TODO - test case when spaces are not deleted
atom.workspaceView.command 'editor:delete-until-beginning-of-line', ->
    editor = atom.workspace.activePaneItem
    selections = editor.getSelections()

    for selection in selections
        selection.selectToNextWordBoundary()
        selection.deleteSelectedText()

Best regards,
Mk