summaryrefslogtreecommitdiff
path: root/autoload
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2020-11-21 16:03:39 +0000
committerGitHub <noreply@github.com>2020-11-21 16:03:39 +0000
commitc10e8074924d88e6142f5739eab983481eade77a (patch)
tree39464f433224aa71e921cf99c45f57be5cee3a1e /autoload
parente5d16caebe8a57074ee52d9bf0c0334fba4106a9 (diff)
parentd1f48e5edef1d622817ffc054e6963e6ca956371 (diff)
downloadale-c10e8074924d88e6142f5739eab983481eade77a.zip
Fix handling of ranges at file end. (#3344)
Diffstat (limited to 'autoload')
-rw-r--r--autoload/ale/code_action.vim7
1 files changed, 6 insertions, 1 deletions
diff --git a/autoload/ale/code_action.vim b/autoload/ale/code_action.vim
index 506107f4..6b808b34 100644
--- a/autoload/ale/code_action.vim
+++ b/autoload/ale/code_action.vim
@@ -125,7 +125,12 @@ function! ale#code_action#ApplyChanges(filename, changes, should_save) abort
endif
call extend(l:middle, l:insertions[1:])
- let l:middle[-1] .= l:lines[l:end_line - 1][l:end_column - 1 :]
+
+ if l:end_line <= len(l:lines)
+ " Only extend the last line if end_line is within the range of
+ " lines.
+ let l:middle[-1] .= l:lines[l:end_line - 1][l:end_column - 1 :]
+ endif
let l:lines_before_change = len(l:lines)
let l:lines = l:start + l:middle + l:lines[l:end_line :]