Skip to content

Commit

Permalink
Merge pull request rstudio#8517 from rstudio/feature/suppress-tab-nav…
Browse files Browse the repository at this point in the history
…igation

prevent navigation when hitting tab in visual mode
  • Loading branch information
jmcphers authored Dec 2, 2020
2 parents 3d4ffac + 101de8a commit 863767a
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/gwt/panmirror/src/editor/src/api/basekeys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,10 @@ export function baseKeysPlugin(keys: readonly BaseKeyBinding[]): Plugin {
{ key: BaseKey.Backspace, command: joinBackward },
{ key: BaseKey.Backspace, command: deleteSelection },

// base tab key behavior (ignore)
{ key: BaseKey.Tab, command: ignoreKey },
{ key: BaseKey.ShiftTab, command: ignoreKey },

// base delete key behaviors
{ key: BaseKey.Delete, command: selectNodeForward },
{ key: BaseKey.Delete, command: joinForward },
Expand Down Expand Up @@ -154,6 +158,10 @@ interface Coords {
bottom: number;
}

function ignoreKey(state: EditorState, dispatch?: (tr: Transaction) => void) {
return true;
}

function homeKey(state: EditorState, dispatch?: (tr: Transaction) => void, view?: EditorView) {
const selection = state.selection;
const editingNode = editingRootNode(selection);
Expand Down

0 comments on commit 863767a

Please sign in to comment.