Skip to content

User command mods doesn't receive :[count]tab count #6901

@kassio

Description

@kassio

Describe the bug
:help <mods> states that :tab is one possible command modifier. On the :tab documentation is stated that it can receive a count. But, I wasn't able to receive this counter on a command.

To Reproduce

Test script

Script

function! s:fun(args)
  echo a:args
endfunction

function! s:test()
  echo '---'
  echo 'Range0: '.execute('Range0', '')
  echo 'Count0: '.execute('Count0', '')
  echo 'tab'
  echo 'tab Range0: '.execute('tab Range0', '')
  echo 'tab Count0: '.execute('tab Count0', '')
  echo '+tab'
  echo '+tab Range0: '.execute('+tab Range0', '')
  echo '+tab Count0: '.execute('+tab Count0', '')
  echo '-tab'
  echo '-tab Range0: '.execute('-tab Range0', '')
  echo '-tab Count0: '.execute('-tab Count0', '')
  echo '0tab'
  echo '0tab Range0: '.execute('0tab Range0', '')
  echo '0tab Count0: '.execute('0tab Count0', '')
  echo '$tab'
  echo '$tab Range0: '.execute('$tab Range0', '')
  echo '$tab Count0: '.execute('$tab Count0', '')
endfunction

command! Test call s:test()

command! -addr=tabs Range0 call s:fun({'qmods': <q-mods>, 'range': <range>, 'count': <count>, 'l1': <line1>, 'l2': <line2>})
command! -addr=tabs Count0 call s:fun({'qmods': <q-mods>, 'range': <range>, 'count': <count>, 'l1': <line1>, 'l2': <line2>})

Output

{'range': 0, 'qmods': '', 'count': -1, 'l2': 1, 'l1': 1}
Range0: 
{'range': 0, 'qmods': '', 'count': -1, 'l2': 1, 'l1': 1}
{'range': 0, 'qmods': '', 'count': -1, 'l2': 1, 'l1': 1}
Count0: 
{'range': 0, 'qmods': '', 'count': -1, 'l2': 1, 'l1': 1}
tab
{'range': 0, 'qmods': 'tab', 'count': -1, 'l2': 1, 'l1': 1}
tab Range0: 
{'range': 0, 'qmods': 'tab', 'count': -1, 'l2': 1, 'l1': 1}
{'range': 0, 'qmods': 'tab', 'count': -1, 'l2': 1, 'l1': 1}
tab Count0: 
{'range': 0, 'qmods': 'tab', 'count': -1, 'l2': 1, 'l1': 1}
+tab
{'range': 0, 'qmods': 'tab', 'count': -1, 'l2': 1, 'l1': 1}
+tab Range0: 
{'range': 0, 'qmods': 'tab', 'count': -1, 'l2': 1, 'l1': 1}
{'range': 0, 'qmods': 'tab', 'count': -1, 'l2': 1, 'l1': 1}
+tab Count0: 
{'range': 0, 'qmods': 'tab', 'count': -1, 'l2': 1, 'l1': 1}
-tab
{'range': 0, 'qmods': 'tab', 'count': -1, 'l2': 1, 'l1': 1}
-tab Range0: 
{'range': 0, 'qmods': 'tab', 'count': -1, 'l2': 1, 'l1': 1}
{'range': 0, 'qmods': 'tab', 'count': -1, 'l2': 1, 'l1': 1}
-tab Count0: 
{'range': 0, 'qmods': 'tab', 'count': -1, 'l2': 1, 'l1': 1}
0tab
{'range': 0, 'qmods': 'tab', 'count': -1, 'l2': 1, 'l1': 1}
0tab Range0: 
{'range': 0, 'qmods': 'tab', 'count': -1, 'l2': 1, 'l1': 1}
{'range': 0, 'qmods': 'tab', 'count': -1, 'l2': 1, 'l1': 1}
0tab Count0: 
{'range': 0, 'qmods': 'tab', 'count': -1, 'l2': 1, 'l1': 1}
$tab
{'range': 0, 'qmods': 'tab', 'count': -1, 'l2': 1, 'l1': 1}
$tab Range0: 
{'range': 0, 'qmods': 'tab', 'count': -1, 'l2': 1, 'l1': 1}
{'range': 0, 'qmods': 'tab', 'count': -1, 'l2': 1, 'l1': 1}
$tab Count0: 
{'range': 0, 'qmods': 'tab', 'count': -1, 'l2': 1, 'l1': 1}

Expected behavior
Receive the counter on <count>, or <range>.

Screenshots
If applicable, copy/paste the text or add screenshots to help explain your problem.

Environment (please complete the following information):

  • iterm2: Build 3.3.12
:version
:version
VIM - Vi IMproved 8.1 (2018 May 18, compiled Jun  5 2020 21:30:37)
macOS version
Included patches: 1-503, 505-680, 682-2292
Compiled by root@apple.com
Normal version without GUI.  Features included (+) or not (-):
+acl               -browse            +cmdline_compl     +cursorbind        -emacs_tags        +float             +insert_expand     +linebreak         +modify_fname      +mouse_sgr         +netbeans_intg     +printer           +ruby/dyn          +statusline        -termguicolors     +title             +visualextra       -X11
-arabic            +builtin_terms     +cmdline_hist      +cursorshape       +eval              +folding           +job               +lispindent        +mouse             -mouse_sysmouse    +num64             -profile           +scrollbind        -sun_workshop      +terminal          -toolbar           +viminfo           -xfontset
+autocmd           +byte_offset       +cmdline_info      +dialog_con        +ex_extra          -footer            +jumplist          +listcmds          -mouseshape        -mouse_urxvt       +packages          +python/dyn        +signs             +syntax            +terminfo          +user_commands     +vreplace          -xim
+autochdir         +channel           +comments          +diff              +extra_search      +fork()            -keymap            +localmap          -mouse_dec         +mouse_xterm       +path_extra        -python3           +smartindent       +tag_binary        +termresponse      -vartabs           +wildignore        -xpm
-autoservername    +cindent           -conceal           +digraphs          -farsi             -gettext           +lambda            -lua               -mouse_gpm         +multi_byte        -perl              +quickfix          -sound             -tag_old_static    +textobjects       +vertsplit         +wildmenu          -xsmp
-balloon_eval      -clientserver      +cryptv            -dnd               +file_in_path      -hangul_input      -langmap           +menu              -mouse_jsbterm     +multi_lang        +persistent_undo   +reltime           +spell             -tag_any_white     +textprop          +virtualedit       +windows           -xterm_clipboard
-balloon_eval_term +clipboard         +cscope            -ebcdic            +find_in_path      +iconv             +libcall           +mksession         -mouse_netterm     -mzscheme          +postscript        -rightleft         +startuptime       -tcl               +timers            +visual            +writebackup       -xterm_save
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H   -DMACOS_X_UNIX  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -L/usr/local/lib -o vim        -lm -lncurses  -liconv -framework Cocoa

Additional context
Probably related to:
#760

Origin of my investigation:
kassio/neoterm#303

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions