Skip to content
This repository has been archived by the owner on Mar 3, 2023. It is now read-only.

Enable default editor keymaps for editors located outside atom-workspace #16206

Conversation

as-cii
Copy link
Contributor

@as-cii as-cii commented Nov 16, 2017

Fixes atom/teletype#208

This is similar to what we do for macOS keymaps:

atom/keymaps/darwin.cson

Lines 108 to 163 in 6cbc998

'atom-text-editor':
# Platform Bindings
'alt-left': 'editor:move-to-beginning-of-word'
'alt-right': 'editor:move-to-end-of-word'
'alt-shift-left': 'editor:select-to-beginning-of-word'
'alt-shift-right': 'editor:select-to-end-of-word'
# Apple Specific
'cmd-backspace': 'editor:delete-to-beginning-of-line'
'cmd-shift-backspace': 'editor:delete-to-beginning-of-line'
'cmd-delete': 'editor:delete-to-end-of-line'
'ctrl-shift-a': 'editor:select-to-first-character-of-line'
'ctrl-shift-e': 'editor:select-to-end-of-line'
'cmd-left': 'editor:move-to-first-character-of-line'
'cmd-right': 'editor:move-to-end-of-screen-line'
'cmd-shift-left': 'editor:select-to-first-character-of-line'
'cmd-shift-right': 'editor:select-to-end-of-line'
'alt-backspace': 'editor:delete-to-beginning-of-word'
'alt-delete': 'editor:delete-to-end-of-word'
'ctrl-a': 'editor:move-to-first-character-of-line'
'ctrl-e': 'editor:move-to-end-of-line'
'ctrl-k': 'editor:cut-to-end-of-line'
# Atom Specific
'ctrl-shift-w': 'editor:select-word'
'cmd-ctrl-left': 'editor:move-selection-left'
'cmd-ctrl-right': 'editor:move-selection-right'
'cmd-shift-V': 'editor:paste-without-reformatting'
# Emacs
'alt-f': 'editor:move-to-end-of-word'
'alt-ctrl-f': 'editor:move-to-next-subword-boundary'
'alt-shift-f': 'editor:select-to-end-of-word'
'alt-ctrl-shift-f': 'editor:select-to-next-subword-boundary'
'alt-b': 'editor:move-to-beginning-of-word'
'alt-ctrl-b': 'editor:move-to-previous-subword-boundary'
'alt-shift-b': 'editor:select-to-beginning-of-word'
'alt-ctrl-shift-b': 'editor:select-to-previous-subword-boundary'
'alt-h': 'editor:delete-to-beginning-of-word'
'alt-ctrl-h': 'editor:delete-to-beginning-of-subword'
'alt-d': 'editor:delete-to-end-of-word'
'alt-ctrl-d': 'editor:delete-to-end-of-subword'
# Sublime Parity
'cmd-a': 'core:select-all'
'cmd-alt-p': 'editor:log-cursor-scope'
'cmd-k cmd-u': 'editor:upper-case'
'cmd-k cmd-l': 'editor:lower-case'
'cmd-l': 'editor:select-line'
'ctrl-t': 'editor:transpose'
'ctrl-alt-left': 'editor:move-to-previous-subword-boundary'
'ctrl-alt-right': 'editor:move-to-next-subword-boundary'
'ctrl-alt-shift-left': 'editor:select-to-previous-subword-boundary'
'ctrl-alt-shift-right': 'editor:select-to-next-subword-boundary'
'ctrl-alt-backspace': 'editor:delete-to-beginning-of-subword'
'ctrl-alt-delete': 'editor:delete-to-end-of-subword'

And would fix an issue teletype users are noticing when using editor commands in the popover. Since the popover is located outside the workspace (i.e. because it is a tooltip), keyboard shortcuts are not working for Linux and Windows users. I assume this is an issue with every package that attempts to use an editor outside the atom-workspace element.

@atom/maintainers: what do you think?

/cc: @AlexWayfer, who originally reported the issue on atom/teletype.

@jasonrudolph
Copy link
Contributor

@as-cii: Would this also fix atom/teletype#102?

@as-cii
Copy link
Contributor Author

as-cii commented Nov 16, 2017

I don't think it would because in that circumstance we use a native input element, as opposed to an atom-text-editor. Fixing that problem should be pretty easy though; I think it should only be a matter of using the native-keybindings class on the input element.

@nathansobo
Copy link
Contributor

We should really find a way to fall back to native bindings as a default instead of requiring that class.

@sadick254 sadick254 force-pushed the as-enable-editor-keymaps-outside-workspace-on-linux-and-win32 branch from 7958961 to fb338da Compare May 21, 2021 16:29
Copy link
Contributor

@sadick254 sadick254 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on my local windows and Linux installation. Looks good.

@sadick254 sadick254 merged commit ede1f91 into master May 21, 2021
@sadick254 sadick254 deleted the as-enable-editor-keymaps-outside-workspace-on-linux-and-win32 branch May 21, 2021 20:13
@Fatemekarimzadeh

This comment has been minimized.

@pomnt

This comment has been minimized.

@alsayedzomrawi

This comment has been minimized.

@atom atom deleted a comment from Floy288 Dec 15, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ctrl+A doesn't work in "Sign in" pop-up
8 participants