解决atom使用ELAN触摸板时编辑器滚动异常问题
程序员文章站
2024-01-10 14:58:28
...
解决atom使用ELAN触摸板时编辑器滚动异常问题
atom 滚动异常是因为atom把触摸板的滚动事件识别为光标键按键事件了
通过配置编辑器快捷键可以实现通过同时按下
alt-cmd
时使用触摸板正常滚动编辑器的功能
keymap.cson
'atom-workspace':
'alt-cmd-up': 'core:cmd-move-up'
'alt-cmd-down': 'core:cmd-move-down'
'alt-cmd-left': 'core:cmd-move-left'
'alt-cmd-right': 'core:cmd-move-right'
init.coffee
atom.commands.add 'atom-workspace',
'core:cmd-move-down': () ->
editor = atom.workspace.getActiveTextEditor()
editor?.element.setScrollTop editor.element.getScrollTop() + editor.scrollSensitivity
'core:cmd-move-up': () ->
editor = atom.workspace.getActiveTextEditor()
editor?.element.setScrollTop editor.element.getScrollTop() - editor.scrollSensitivity
'core:cmd-move-right': () ->
editor = atom.workspace.getActiveTextEditor()
editor?.element.setScrollLeft editor.element.getScrollLeft() + editor.scrollSensitivity
'core:cmd-move-left': () ->
editor = atom.workspace.getActiveTextEditor()
editor?.element.setScrollLeft editor.element.getScrollLeft() - editor.scrollSensitivity