Skip to content

Commit

Permalink
Improve ingo#gui#position#Get()
Browse files Browse the repository at this point in the history
Merge branch 'feature/getwinpos'
  • Loading branch information
inkarkat committed Mar 16, 2023
2 parents 097b1c7 + 760e8a5 commit cb7c672
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 12 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,9 @@ HISTORY
- ingo#regexp#comments#CommentToExpression(): BUG: The $ anchor was mistakenly
escaped, but the pattern is (normal) magic; special comment characters (like
"\*") are not properly escaped.
- CHG: Minor: ingo#gui#position#Get() swap the first two returned elements (so
it's X-Y, too) and return numbers for elements 3 and 4. This shouldn't
matter to clients as the format is unspecified.

##### 1.044 08-Apr-2022
- Add ingo#cursor#IsBeyondEndOfLine() variant of ingo#cursor#IsAtEndOfLine().
Expand Down Expand Up @@ -1282,7 +1285,7 @@ HISTORY
- Started development of shared autoload functionality.

------------------------------------------------------------------------------
Copyright: (C) 2009-2022 Ingo Karkat -
Copyright: (C) 2009-2023 Ingo Karkat -
Contains URL encoding / decoding algorithms written by Tim Pope. -
The [VIM LICENSE](http://vimdoc.sourceforge.net/htmldoc/uganda.html#license) applies to this plugin.

Expand Down
23 changes: 13 additions & 10 deletions autoload/ingo/gui/position.vim
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,22 @@
"
" DEPENDENCIES:
"
" Copyright: (C) 2013 Ingo Karkat
" Copyright: (C) 2013-2023 Ingo Karkat
" The VIM LICENSE applies to this script; see ':help copyright'.
"
" Maintainer: Ingo Karkat <ingo@karkat.de>
"
" REVISION DATE REMARKS
" 1.011.001 19-Jul-2013 file creation

function! ingo#gui#position#Get()
redir => l:winpos
silent! winpos
redir END
return [&lines, &columns, matchstr(l:winpos, '\CX \zs-\?\d\+'), matchstr(l:winpos, '\CY \zs-\?\d\+')]
endfunction
if exists('*getwinpos')
function! ingo#gui#position#Get() abort
return [&columns, &lines] + getwinpos()
endfunction
else
function! ingo#gui#position#Get() abort
redir => l:winpos
silent! winpos
redir END
return [&columns, &lines, str2nr(matchstr(l:winpos, '\CX \zs-\?\d\+')), str2nr(matchstr(l:winpos, '\CY \zs-\?\d\+'))]
endfunction
endif

" vim: set ts=8 sts=4 sw=4 noexpandtab ff=unix fdm=syntax :
5 changes: 4 additions & 1 deletion doc/ingo-library.txt
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,9 @@ HISTORY *ingo-library-history*
- ingo#regexp#comments#CommentToExpression(): BUG: The $ anchor was mistakenly
escaped, but the pattern is (normal) magic; special comment characters (like
"*") are not properly escaped.
- CHG: Minor: ingo#gui#position#Get() swap the first two returned elements (so
it's X-Y, too) and return numbers for elements 3 and 4. This shouldn't
matter to clients as the format is unspecified.

1.044 08-Apr-2022
- Add ingo#cursor#IsBeyondEndOfLine() variant of ingo#cursor#IsAtEndOfLine().
Expand Down Expand Up @@ -1297,7 +1300,7 @@ First published version as separate shared library.
Started development of shared autoload functionality.

==============================================================================
Copyright: (C) 2009-2022 Ingo Karkat
Copyright: (C) 2009-2023 Ingo Karkat
Contains URL encoding / decoding algorithms written by Tim Pope.
The VIM LICENSE applies to this plugin; see |copyright|.

Expand Down

0 comments on commit cb7c672

Please sign in to comment.