diff --git a/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/AutoCompleteManager.coffee b/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/AutoCompleteManager.coffee index 030b2d4abf..5a8ad66a2c 100644 --- a/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/AutoCompleteManager.coffee +++ b/services/web/public/coffee/ide/editor/directives/aceEditor/auto-complete/AutoCompleteManager.coffee @@ -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,