Consistently delete back to last backslash

This commit is contained in:
Shane Kilkelly 2017-07-13 10:23:45 +01:00
parent 75b0e0cf51
commit f66982dd8b

View file

@ -188,8 +188,22 @@ define [
leftRange = _.clone(range) leftRange = _.clone(range)
rightRange = _.clone(range) rightRange = _.clone(range)
# trim to left of cursor # trim to left of cursor
leftRange.start.column -= completions.filterText.length; lineUpToCursor = editor.getSession().getTextRange(
editor.session.remove(leftRange); 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( lineBeyondCursor = editor.getSession().getTextRange(
new Range( new Range(
rightRange.start.row, rightRange.start.row,