summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--autoload/ale/completion.vim10
-rw-r--r--autoload/ale/cursor.vim6
-rw-r--r--autoload/ale/definition.vim2
-rw-r--r--autoload/ale/hover.vim6
-rw-r--r--autoload/ale/loclist_jumping.vim2
-rw-r--r--autoload/ale/lsp/message.vim2
-rw-r--r--autoload/ale/preview.vim2
-rw-r--r--autoload/ale/references.vim2
-rw-r--r--autoload/ale/util.vim2
-rw-r--r--autoload/ale/virtualtext.vim3
-rwxr-xr-xtest/script/custom-linting-rules1
11 files changed, 19 insertions, 19 deletions
diff --git a/autoload/ale/completion.vim b/autoload/ale/completion.vim
index 4a566d4f..782a68e4 100644
--- a/autoload/ale/completion.vim
+++ b/autoload/ale/completion.vim
@@ -236,7 +236,7 @@ function! ale#completion#Show(response, completion_parser) abort
endfunction
function! s:CompletionStillValid(request_id) abort
- let [l:line, l:column] = getcurpos()[1:2]
+ let [l:line, l:column] = getpos('.')[1:2]
return ale#util#Mode() is# 'i'
\&& has_key(b:, 'ale_completion_info')
@@ -514,7 +514,7 @@ endfunction
" This function can be used to manually trigger autocomplete, even when
" g:ale_completion_enabled is set to false
function! ale#completion#AlwaysGetCompletions(need_prefix) abort
- let [l:line, l:column] = getcurpos()[1:2]
+ let [l:line, l:column] = getpos('.')[1:2]
let l:prefix = ale#completion#GetPrefix(&filetype, l:line, l:column)
@@ -546,7 +546,7 @@ endfunction
function! s:TimerHandler(...) abort
let s:timer_id = -1
- let [l:line, l:column] = getcurpos()[1:2]
+ let [l:line, l:column] = getpos('.')[1:2]
" When running the timer callback, we have to be sure that the cursor
" hasn't moved from where it was when we requested completions by typing.
@@ -569,7 +569,7 @@ function! ale#completion#Queue() abort
return
endif
- let s:timer_pos = getcurpos()[1:2]
+ let s:timer_pos = getpos('.')[1:2]
if s:timer_pos == s:last_done_pos
" Do not ask for completions if the cursor rests on the position we
@@ -593,7 +593,7 @@ function! ale#completion#Done() abort
call ale#completion#RestoreCompletionOptions()
- let s:last_done_pos = getcurpos()[1:2]
+ let s:last_done_pos = getpos('.')[1:2]
endfunction
function! s:Setup(enabled) abort
diff --git a/autoload/ale/cursor.vim b/autoload/ale/cursor.vim
index 6672c349..eea8ffe6 100644
--- a/autoload/ale/cursor.vim
+++ b/autoload/ale/cursor.vim
@@ -22,7 +22,7 @@ function! ale#cursor#TruncatedEcho(original_message) abort
let l:shortmess_options = &l:shortmess
try
- let l:cursor_position = getcurpos()
+ let l:cursor_position = getpos('.')
" The message is truncated and saved to the history.
setlocal shortmess+=T
@@ -44,7 +44,7 @@ function! ale#cursor#TruncatedEcho(original_message) abort
" Reset the cursor position if we moved off the end of the line.
" Using :norm and :echomsg can move the cursor off the end of the
" line.
- if l:cursor_position != getcurpos()
+ if l:cursor_position != getpos('.')
call setpos('.', l:cursor_position)
endif
finally
@@ -114,7 +114,7 @@ function! ale#cursor#EchoCursorWarningWithDelay() abort
call s:StopCursorTimer()
- let l:pos = getcurpos()[0:2]
+ let l:pos = getpos('.')[0:2]
" Check the current buffer, line, and column number against the last
" recorded position. If the position has actually changed, *then*
diff --git a/autoload/ale/definition.vim b/autoload/ale/definition.vim
index 9fc47834..521f0b45 100644
--- a/autoload/ale/definition.vim
+++ b/autoload/ale/definition.vim
@@ -104,7 +104,7 @@ endfunction
function! s:GoToLSPDefinition(linter, options, capability) abort
let l:buffer = bufnr('')
- let [l:line, l:column] = getcurpos()[1:2]
+ let [l:line, l:column] = getpos('.')[1:2]
let l:column = min([l:column, len(getline(l:line))])
let l:Callback = function(
diff --git a/autoload/ale/hover.vim b/autoload/ale/hover.vim
index 6a3f58c9..2af35aa4 100644
--- a/autoload/ale/hover.vim
+++ b/autoload/ale/hover.vim
@@ -57,7 +57,7 @@ function! ale#hover#HandleLSPResponse(conn_id, response) abort
" If the call did __not__ come from balloonexpr...
if !get(l:options, 'hover_from_balloonexpr', 0)
let l:buffer = bufnr('')
- let [l:line, l:column] = getcurpos()[1:2]
+ let [l:line, l:column] = getpos('.')[1:2]
let l:end = len(getline(l:line))
if l:buffer isnot l:options.buffer
@@ -174,7 +174,7 @@ endfunction
" This function implements the :ALEHover command.
function! ale#hover#ShowAtCursor() abort
let l:buffer = bufnr('')
- let l:pos = getcurpos()
+ let l:pos = getpos('.')
call ale#hover#Show(l:buffer, l:pos[1], l:pos[2], {})
endfunction
@@ -182,7 +182,7 @@ endfunction
" This function implements the :ALEDocumentation command.
function! ale#hover#ShowDocumentationAtCursor() abort
let l:buffer = bufnr('')
- let l:pos = getcurpos()
+ let l:pos = getpos('.')
let l:options = {'show_documentation': 1}
call ale#hover#Show(l:buffer, l:pos[1], l:pos[2], l:options)
diff --git a/autoload/ale/loclist_jumping.vim b/autoload/ale/loclist_jumping.vim
index 6b916227..1d3ef7e5 100644
--- a/autoload/ale/loclist_jumping.vim
+++ b/autoload/ale/loclist_jumping.vim
@@ -11,7 +11,7 @@
" be returned.
function! ale#loclist_jumping#FindNearest(direction, wrap, ...) abort
let l:buffer = bufnr('')
- let l:pos = getcurpos()
+ let l:pos = getpos('.')
let l:info = get(g:ale_buffer_info, bufnr('%'), {'loclist': []})
" Copy the list and filter to only the items in this buffer.
let l:loclist = filter(copy(l:info.loclist), 'v:val.bufnr == l:buffer')
diff --git a/autoload/ale/lsp/message.vim b/autoload/ale/lsp/message.vim
index dd07685a..646dbd20 100644
--- a/autoload/ale/lsp/message.vim
+++ b/autoload/ale/lsp/message.vim
@@ -5,7 +5,7 @@
" [is_notification, method_name, params?]
"
" All functions which accept line and column arguments expect them to be 1-based
-" (the same format as being returned by getcurpos() and friends), those then
+" (the same format as being returned by getpos() and friends), those then
" will be converted to 0-based as specified by LSP.
let g:ale_lsp_next_version_id = 1
diff --git a/autoload/ale/preview.vim b/autoload/ale/preview.vim
index a94da594..6d58aca9 100644
--- a/autoload/ale/preview.vim
+++ b/autoload/ale/preview.vim
@@ -71,7 +71,7 @@ endfunction
function! s:Open(open_in_tab) abort
let l:item_list = get(b:, 'ale_preview_item_list', [])
- let l:item = get(l:item_list, getcurpos()[1] - 1, {})
+ let l:item = get(l:item_list, getpos('.')[1] - 1, {})
if empty(l:item)
return
diff --git a/autoload/ale/references.vim b/autoload/ale/references.vim
index 14f3cd15..0e88afe2 100644
--- a/autoload/ale/references.vim
+++ b/autoload/ale/references.vim
@@ -113,7 +113,7 @@ function! ale#references#Find(...) abort
endif
let l:buffer = bufnr('')
- let [l:line, l:column] = getcurpos()[1:2]
+ let [l:line, l:column] = getpos('.')[1:2]
let l:column = min([l:column, len(getline(l:line))])
let l:Callback = function('s:OnReady', [l:line, l:column, l:options])
diff --git a/autoload/ale/util.vim b/autoload/ale/util.vim
index 1ed6b0d1..e57307e4 100644
--- a/autoload/ale/util.vim
+++ b/autoload/ale/util.vim
@@ -470,7 +470,7 @@ endfunction
function! ale#util#FindItemAtCursor(buffer) abort
let l:info = get(g:ale_buffer_info, a:buffer, {})
let l:loclist = get(l:info, 'loclist', [])
- let l:pos = getcurpos()
+ let l:pos = getpos('.')
let l:index = ale#util#BinarySearch(l:loclist, a:buffer, l:pos[1], l:pos[2])
let l:loc = l:index >= 0 ? l:loclist[l:index] : {}
diff --git a/autoload/ale/virtualtext.vim b/autoload/ale/virtualtext.vim
index c4ce37dd..532427fb 100644
--- a/autoload/ale/virtualtext.vim
+++ b/autoload/ale/virtualtext.vim
@@ -47,7 +47,6 @@ function! ale#virtualtext#ShowMessage(message, hl_group) abort
return
endif
- let l:cursor_position = getcurpos()
let l:line = line('.')
let l:buffer = bufnr('')
let l:prefix = get(g:, 'ale_virtualtext_prefix', '> ')
@@ -117,7 +116,7 @@ function! ale#virtualtext#ShowCursorWarningWithDelay() abort
call s:StopCursorTimer()
- let l:pos = getcurpos()[0:2]
+ let l:pos = getpos('.')[0:2]
" Check the current buffer, line, and column number against the last
" recorded position. If the position has actually changed, *then*
diff --git a/test/script/custom-linting-rules b/test/script/custom-linting-rules
index 77e87db4..981a9459 100755
--- a/test/script/custom-linting-rules
+++ b/test/script/custom-linting-rules
@@ -106,6 +106,7 @@ check_errors 'let g:ale_\w\+_\w\+_args =' 'Name your option g:ale_<filetype>_<li
check_errors 'shellescape(' 'Use ale#Escape instead of shellescape'
check_errors 'simplify(' 'Use ale#path#Simplify instead of simplify'
check_errors 'tempname(' 'Use ale#util#Tempname instead of tempname'
+check_errors 'getcurpos(' "Use getpos('.') instead of getcurpos() if you don't need curswant, to avoid a bug that changes curswant"
check_errors "expand(['\"]%" "Use expand('#' . a:buffer . '...') instead. You might get a filename for the wrong buffer."
check_errors 'getcwd()' "Do not use getcwd(), as it could run from the wrong buffer. Use expand('#' . a:buffer . ':p:h') instead."
check_errors '==#' "Use 'is#' instead of '==#'. 0 ==# 'foobar' is true"