Skip to content

Commit

Permalink
tab multicursor
Browse files Browse the repository at this point in the history
  • Loading branch information
Pangoraw committed Oct 16, 2024
1 parent a5122a7 commit 5e066c6
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions frontend/components/CellInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -365,15 +365,16 @@ export const CellInput = ({
return true
}

// TODO Multicursor?
let selection = cm.state.selection.main
if (!selection.empty) {
const anySelect = cm.state.selection.ranges.some(r => !r.empty)
if (anySelect) {
return indentMore(cm)
} else {
cm.dispatch({
changes: { from: selection.from, to: selection.to, insert: "\t" },
selection: EditorSelection.cursor(selection.from + 1),
})
cm.dispatch(
cm.state.changeByRange(selection => ({
range: EditorSelection.cursor(selection.from + 1),
changes: { from: selection.from, to: selection.to, insert: "\t" },
}))
)
return true
}
}
Expand Down

0 comments on commit 5e066c6

Please sign in to comment.