mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Consistently delete back to last backslash
This commit is contained in:
parent
75b0e0cf51
commit
f66982dd8b
1 changed files with 16 additions and 2 deletions
|
@ -188,8 +188,22 @@ define [
|
|||
leftRange = _.clone(range)
|
||||
rightRange = _.clone(range)
|
||||
# trim to left of cursor
|
||||
leftRange.start.column -= completions.filterText.length;
|
||||
editor.session.remove(leftRange);
|
||||
lineUpToCursor = editor.getSession().getTextRange(
|
||||
new Range(
|
||||
range.start.row,
|
||||
0,
|
||||
range.start.row,
|
||||
range.start.column,
|
||||
)
|
||||
)
|
||||
# Delete back to last backslash, as appropriate
|
||||
lastBackslashIndex = lineUpToCursor.lastIndexOf('\\')
|
||||
if lastBackslashIndex != -1
|
||||
leftRange.start.column = lastBackslashIndex
|
||||
else
|
||||
leftRange.start.column -= completions.filterText.length
|
||||
editor.session.remove(leftRange)
|
||||
# look at text after cursor
|
||||
lineBeyondCursor = editor.getSession().getTextRange(
|
||||
new Range(
|
||||
rightRange.start.row,
|
||||
|
|
Loading…
Reference in a new issue