[vim/vim] Arguments for cursor() function are inconsistent (#7686)

8 views
Skip to first unread message

Takahiro Yoshihara

unread,
Jan 15, 2021, 11:44:01 AM1/15/21
to vim/vim, Subscribed

Describe the bug

This behaviour was introduced with 6f02b00 (Vim 8.2.2324).

The cursor() function doesn't allow string value for {lnum} and {col}, but string can be passed if the argument is a list.
For example,

" E474: Invalid argument
:cal cursor('1', '1')

" this is ok even if `{lnum}` and `{col}` are string
:cal cursor(['1', '1'])

To Reproduce

  1. Run vim --clean
  2. Execute :call cursor(['1', '1'])
  3. The cursor position is changed to 1:1
  4. This is inconsistent, because :call cursor('1', '1') returns E474: Invalid argument.

Expected behavior
Although I'm not sure which is the correct behaviour, if string value is invalid for arguments for cursor function, it should be invalid sting values are passed as a List.

Screenshots

Environment (please complete the following information):

  • VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Jan 16 2021 01:05:13)
  • Included patches: 1-2353
  • OS: [Ubuntu 20.04 on WSL2]
  • Terminal: Windows Terminal 1.5.3242.0

Additional context


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

Bram Moolenaar

unread,
Jan 15, 2021, 12:42:14 PM1/15/21
to vim/vim, Subscribed

Closed #7686.

Bram Moolenaar

unread,
Jan 15, 2021, 12:42:16 PM1/15/21
to vim/vim, Subscribed

I don't think patch 8.2.2324 changed this. It was already like this before, and because of backwards compatibility can't be changed.
You an use Vim9 script, which is much stricter about this.

Takahiro Yoshihara

unread,
Jan 16, 2021, 11:25:18 AM1/16/21
to vim/vim, Subscribed

No, it wasn't. String values are allowed with older versions of Vim 8.2.

I have also confirmed this on Windows.
String value is allowed for {lnum} and {col} in 8.2.2320 (no 2323 build available in vim/vim-win32-installer, so tried with this version), but it's not allowed with the version 8.2.2327 and 8.2.2352.
So this indicates some cursor() function specification was changed with some commit between 8.2.2320 and 8.2.2327; also means they are NOT backwards compatible especially this behaviour.

7686

Yegappan Lakshmanan

unread,
Jan 16, 2021, 11:59:44 AM1/16/21
to vim_dev, reply+ACY5DGFKVOCHGMZE2E...@reply.github.com, vim/vim, Subscribed
Hi,

This has now been fixed by 8.2.2363.

- Yegappan

vim-dev ML

unread,
Jan 16, 2021, 12:00:02 PM1/16/21
to vim/vim, vim-dev ML, Your activity

Shane-XB-Qian

unread,
Jan 16, 2021, 1:05:01 PM1/16/21
to vim/vim, vim-dev ML, Comment

#7648


You are receiving this because you commented.

Shane-XB-Qian

unread,
Jan 16, 2021, 1:58:31 PM1/16/21
to vim/vim, vim-dev ML, Comment

looks you were misunderstanding each other.. ;-)
For this case, user/legacy-script should be not like more ‘strict’ type check.....


You are receiving this because you commented.

Reply all
Reply to author
Forward
0 new messages