mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 14:43:46 +01:00
Merge pull request #32114 from overleaf/mg-context-menu-cursor-movemenet
Move cursor on right-click within same line GitOrigin-RevId: 8b622e9f557ecb1a33b7ba1a80d5752e05a72718
This commit is contained in:
@@ -153,13 +153,11 @@ function isPositionInsideSelection(pos: number, from: number, to: number) {
|
||||
|
||||
function isPositionInsideAnyRangeOrCursor(view: EditorView, pos: number) {
|
||||
for (const range of view.state.selection.ranges) {
|
||||
// If it's a cursor, treat a right-click anywhere on the same line as "inside".
|
||||
// This avoids collapsing multi-cursor selections when right-clicking on blank lines
|
||||
// or to the right of the caret.
|
||||
// If it's a cursor (not a selection), only treat it as "inside" when
|
||||
// right-clicking exactly on the cursor position. This allows cursor
|
||||
// movement when clicking elsewhere on the same line.
|
||||
if (range.from === range.to) {
|
||||
const clickedLine = view.state.doc.lineAt(pos)
|
||||
const cursorLine = view.state.doc.lineAt(range.from)
|
||||
if (clickedLine.number === cursorLine.number) {
|
||||
if (pos === range.from) {
|
||||
return true
|
||||
}
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user