[vim/vim] Add functions to set/get cursor and mark position using character count (#7648)

13 views
Skip to first unread message

Yegappan Lakshmanan

unread,
Jan 9, 2021, 3:38:12 PM1/9/21
to vim/vim, Subscribed

Add the following functions:
getcharpos() - Get the character position of the cursor or a mark.
setcharpos() - Set the character position of the cursor or a mark.
charcol() - Get the character count of the cursor or a mark in a line.
getcursorcharpos() - Get the character position of the cursor.
setcursorcharpos() - Set the character position of the cursor.


You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/7648

Commit Summary

  • Add functions to set/get cursor and mark position using character counter instead of byte count

File Changes

Patch Links:


You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or unsubscribe.

Yegappan Lakshmanan

unread,
Jan 9, 2021, 4:20:49 PM1/9/21
to vim/vim, Push

@yegappan pushed 1 commit.

  • 559be8e Pass value for the new additional argument


You are receiving this because you are subscribed to this thread.

View it on GitHub or unsubscribe.

codecov[bot]

unread,
Jan 9, 2021, 4:25:34 PM1/9/21
to vim/vim, Subscribed

Codecov Report

Merging #7648 (a0c1467) into master (cff40ff) will decrease coverage by 86.50%.
The diff coverage is 0.00%.

Impacted file tree graph

@@             Coverage Diff             @@

##           master    #7648       +/-   ##

===========================================

- Coverage   88.99%    2.48%   -86.51%     

===========================================

  Files         148      146        -2     

  Lines      164050   159057     -4993     

===========================================

- Hits       145989     3960   -142029     

- Misses      18061   155097   +137036     
Flag Coverage Δ
huge-clang-none ?
huge-gcc-none ?
huge-gcc-testgui ?
huge-gcc-unittests 2.48% <0.00%> (-0.01%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
src/eval.c 0.11% <0.00%> (-96.20%) ⬇️
src/evalfunc.c 0.00% <0.00%> (-96.00%) ⬇️
src/tag.c 0.00% <0.00%> (-93.95%) ⬇️
src/typval.c 3.60% <0.00%> (-93.05%) ⬇️
src/sha256.c 0.00% <0.00%> (-97.96%) ⬇️
src/digraph.c 0.00% <0.00%> (-97.78%) ⬇️
src/gui_gtk_f.c 0.00% <0.00%> (-97.54%) ⬇️
src/crypt_zip.c 0.00% <0.00%> (-97.06%) ⬇️
src/libvterm/src/rect.h 0.00% <0.00%> (-96.56%) ⬇️
src/debugger.c 0.00% <0.00%> (-96.38%) ⬇️
... and 138 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cff40ff...559be8e. Read the comment docs.

Yegappan Lakshmanan

unread,
Jan 9, 2021, 9:36:26 PM1/9/21
to vim/vim, Push

@yegappan pushed 1 commit.

  • ff41c2b Validate the parameters passed to cursor()


You are receiving this because you are subscribed to this thread.

Bram Moolenaar

unread,
Jan 10, 2021, 2:23:42 PM1/10/21
to vim/vim, Subscribed

Closed #7648 via 6f02b00.

Shane-XB-Qian

unread,
Jan 10, 2021, 11:25:32 PM1/10/21
to vim/vim, Subscribed

@yegappan great, #6955 (comment) so now looks solved 'char' column, one day we may can w e b for real char/word.

Shane-XB-Qian

unread,
Jan 16, 2021, 9:55:25 AM1/16/21
to vim/vim, Subscribed

@brammool @yegappan there is a regression/not-compatible issue:
in the past cursor(line, col), that 'col' can be a 'string' type, now must be 'int'.
for now, not sure caused by this, or vim9, since vim9 made type check looks strict..

Yegappan Lakshmanan

unread,
Jan 16, 2021, 10:01:03 AM1/16/21
to vim_dev, reply+ACY5DGH4GWK6QKUORZ...@reply.github.com, vim/vim, Subscribed
Hi,

On Sat, Jan 16, 2021 at 6:55 AM Shane-XB-Qian <vim-dev...@256bit.org> wrote:

@brammool @yegappan there is a regression/not-compatible issue:
in the past cursor(line, col), that 'col' can be a 'string' type, now must be 'int'.
for now, not sure caused by this, or vim9, since vim9 made type check looks strict..



It is a regression caused by this change. I added a check to make sure
the column argument is a number. I didn't realize plugins are passing string
for this argument. I will create a PR to address this.

Regards,
Yegappan


vim-dev ML

unread,
Jan 16, 2021, 10:01:25 AM1/16/21
to vim/vim, vim-dev ML, Your activity

Hi,

On Sat, Jan 16, 2021 at 6:55 AM Shane-XB-Qian <vim-dev...@256bit.org>
wrote:

> @brammool <https://github.com/brammool> @yegappan
> <https://github.com/yegappan> there is a regression/not-compatible issue:

> in the past cursor(line, col), that 'col' can be a 'string' type, now
> must be 'int'.
> for now, not sure caused by this, or vim9, since vim9 made type check
> looks strict..
>
>
>
It is a regression caused by this change. I added a check to make sure
the column argument is a number. I didn't realize plugins are passing string
for this argument. I will create a PR to address this.

Regards,
Yegappan

Shane-XB-Qian

unread,
Jan 16, 2021, 10:05:41 AM1/16/21
to vim/vim, vim-dev ML, Comment

I didn't realize plugins are passing string for this argument. I will create a PR to address this.

yea, some plugins did not treat type very clear, since it's implicit for legacy vim script. waitting... thx. :-)


You are receiving this because you commented.

Shane-XB-Qian

unread,
Jan 16, 2021, 10:18:13 AM1/16/21
to vim/vim, vim-dev ML, Comment

BTW: pls consider if to add some test case in 'test_cursor_func.vim' as well, for now, those all were 'number', but no 'string'.. :-)


You are receiving this because you commented.

Reply all
Reply to author
Forward
0 new messages