Wrong tabstop position

Bug #1256451 reported by Andrei on 2013-11-29
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
UltiSnips
Confirmed
Medium
Unassigned

Bug Description

I have the following snippet:

    snippet se "" b
    ,{
      'AUTHOR': '${1:Williams}',
      'TEXT': '${VISUAL}$2',
    }
    endsnippet

When I skip first tabstop without changing default text, the second tabstop shows itself beyond single quotes as if we would have ...'$2,... instead of ...$2',... But when default text in the first tabstop is changed the second tabstop appears in the right place.

SirVer (sirver) wrote :

I cannot reproduce this. I copy and pasted your snippet, unintended it, so that ,{ is starting at the begging of the line. In an empty file I type:

se<expand><jf>hello world<jf>blub

output is as expected:

------------------- SNIP -------------------
,{
  'AUTHOR': 'Williams',
  'TEXT': 'hello world',
}blub
------------------- SNAP -------------------

Changed in ultisnips:
status: New → Incomplete
SirVer (sirver) wrote :

what version of ultisnips are you using (and from where)? Which version of Vim and which OS are you using? Also, gvim or vim on console. Please try to reproduce the bug in a simple fashion and describe your steps similar to what I just did.

Andrei (khan-msu) wrote :

I use vim v7.4 (not gvim) on console. My OS is Ubuntu 13.10 64-bit. Ultisnips v2.2 (according to ChangeLog).

------------------- SNIP -------------------
$ vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Aug 12 2013 00:23:19)
Modified by <email address hidden>
Compiled by buildd@
Huge version without GUI. Features included (+) or not (-):
+arabic +file_in_path +mouse_sgr +tag_binary
+autocmd +find_in_path -mouse_sysmouse +tag_old_static
-balloon_eval +float +mouse_urxvt -tag_any_white
-browse +folding +mouse_xterm -tcl
++builtin_terms -footer +multi_byte +terminfo
+byte_offset +fork() +multi_lang +termresponse
+cindent +gettext -mzscheme +textobjects
-clientserver -hangul_input +netbeans_intg +title
-clipboard +iconv +path_extra -toolbar
+cmdline_compl +insert_expand -perl +user_commands
+cmdline_hist +jumplist +persistent_undo +vertsplit
+cmdline_info +keymap +postscript +virtualedit
+comments +langmap +printer +visual
+conceal +libcall +profile +visualextra
+cryptv +linebreak +python +viminfo
+cscope +lispindent -python3 +vreplace
+cursorbind +listcmds +quickfix +wildignore
+cursorshape +localmap +reltime +wildmenu
+dialog_con -lua +rightleft +windows
+diff +menu -ruby +writebackup
+digraphs +mksession +scrollbind -X11
-dnd +modify_fname +signs -xfontset
-ebcdic +mouse +smartindent -xim
+emacs_tags -mouseshape -sniff -xsmp
+eval +mouse_dec +startuptime -xterm_clipboard
+ex_extra +mouse_gpm +statusline -xterm_save
+extra_search -mouse_jsbterm -sun_workshop
+farsi +mouse_netterm +syntax
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -Wl,-Bsymbolic-functions -Wl,-z,relro -Wl,--as-needed -o vim -lm -ltinfo -lnsl -lselinux -lacl -lattr -lgpm -ldl -L/usr/lib/python2.7/config-x86_64-linux-gnu -lpython2.7 -lpthread -ldl -lutil -lm -Xlinker -export-dynamic -Wl,-O1 -Wl,-Bsymbolic-functions
------------------- SNAP -------------------

------------------- SNIP -------------------
$ uname -a
Linux insula 3.11.0-13-generic #20-Ubuntu SMP Wed Oct 23 07:38:26 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux
------------------- SNAP -------------------

SirVer (sirver) wrote :

From where did you install this version of UltiSnips?

Andrei (khan-msu) wrote :

I used Vundle to install and update it from github.

SirVer (sirver) wrote :

Where on github - there are 192 forks :)

Andrei (khan-msu) wrote :

https://github.com/SirVer/ultisnips

I've tried to minimize the number of plugins and reduced my .vimrc to the following (see below), but the problem still persists. The exact look of the snippet is the following:

------------------- SNIP -------------------
snippet sse "" b
,{
  'AUTHOR': '${1:Williams}',
  'TEXT': '${VISUAL}$2',
}
endsnippet
------------------- SNAP -------------------

I select a sentence with ``<vis>``, than ``<tab>sse<tab><c-j>hello world<c-j>``
and the 3rd line of my snippet looks like that:

  'TEXT': '<selected sentence>'hello world,

My reduced .vimrc:
------------------- SNIP -------------------
set nocompatible
set encoding=UTF-8

" VUNDLE
filetype off
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()

Bundle 'gmarik/vundle'
Bundle 'SirVer/ultisnips'

filetype plugin indent on
" VUNDLE END
------------------- SNAP -------------------

SirVer (sirver) wrote :

I still cannot reproduce the problem. With the same vimrc everything works nicely for me. Can you try doing a screencapture of your vimsession or something? Maybe it has to do with the sentence you copy in your visual selection.

Andrei (khan-msu) wrote :

I suppose you are right. My sentences are in cyrillic script. If they are in latin, everything works pretty fine. You can try this one to reproduce the bug:

------------------- SNIP -------------------
Так в доме кроме кота и ежа стала жить третья живая душа — Желтухин.
------------------- SNAP -------------------

And here is a video record with reproducing the bug: http://www.youtube.com/watch?v=YU5FdfxUTgA
Thank you very much for Ultisnips and for being responsive and cooperative.

Andrei (khan-msu) wrote :

May be it is a bug related to the variable width of a unicode character in bytes in UTF-8?

SirVer (sirver) wrote :

Yep, that seems to be the issue. I can reproduce the problem using the cyrillic script and I guess that you are right about the width of unicode characters. Theoretically, UltiSnips should deal fine with that (there is a bunch of code that deals with the details and ugliness of Vims internal encoding stuff), but I only speak latin based languages, so there was not enough testing apparently.

If you have the option, you can try a Vim that supports python3 - there the situation is less difficult and it could maybe work. Otherwise this bug needs careful inspection to get fixed.

Changed in ultisnips:
status: Incomplete → Confirmed
importance: Undecided → Medium
To post a comment you must log in.
This report contains Public information  Edit
Everyone can see this information.

Other bug subscribers