This didn't happen in 7.2. It's been happening to me for a while,
but I hadn't had time to investigate it and to find a small example.
I don't know in what version it started.
Here's how to reproduce it.
$ vim -N -u NONE
:set fo+=aw
:set ai
:set tw=40
I don't think the 'tw' value matters. I set it to 40 avoid a lot of
typing.
Insert enough text to create a paragraph of at least two lines,
indented by some amount. On some line other than the first, move
the cursor somewhere early in the line and attempt to insert
something. After inserting the first character, the cursor will
jump the indent amount to the right. The next character will be
inserted to the left of the cursor and the cursor will again jump
the indent amount to the right.
Here's a specific example. Put the following text into a buffer,
indented by three spaces as shown.
Lorem ipsum dolor sit amet,
consectetuer adipiscing elit.
Note that the first line ends with a space. Move the cursor to the
first 't' in the second line and type
i1234
The second line will then look like this:
consec1tet2uer3 ad4ipiscing elit.
I am running vim 7.3.3 on RHEL4.
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Aug 17 2010 23:24:30)
Included patches: 1-3
Compiled by gary...@company.com
Normal version with GTK2 GUI. Features included (+) or not (-):
-arabic +autocmd +balloon_eval +browse +builtin_terms +byte_offset +cindent
+clientserver +clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments
+conceal +cryptv +cscope +cursorbind +cursorshape +dialog_con_gui +diff
+digraphs +dnd -ebcdic -emacs_tags +eval +ex_extra +extra_search -farsi
+file_in_path +find_in_path +float +folding -footer +fork() +gettext
-hangul_input +iconv +insert_expand +jumplist -keymap -langmap +libcall
+linebreak +lispindent +listcmds +localmap -lua +menu +mksession +modify_fname
+mouse +mouseshape -mouse_dec +mouse_gpm -mouse_jsbterm -mouse_netterm
-mouse_sysmouse +mouse_xterm +multi_byte +multi_lang -mzscheme +netbeans_intg
-osfiletype +path_extra -perl +persistent_undo +postscript +printer -profile
-python -python3 +quickfix +reltime -rightleft -ruby +scrollbind +signs
+smartindent -sniff +startuptime +statusline -sun_workshop +syntax +tag_binary
+tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title
+toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo
+vreplace +wildignore +wildmenu +windows +writebackup +X11 -xfontset +xim
+xsmp_interact +xterm_clipboard -xterm_save
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "$VIM/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
system menu file: "$VIMRUNTIME/menu.vim"
fall-back for $VIM: "/home/garyjohn/src/Linux/vim-7.3-hg/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -DXTHREADS -D_REENTRANT -DXUSE_MTSAFE_API -I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/X11R6/include -I/usr/include/atk-1.0 -I/usr/include/pango-1.0 -I/usr/include/freetype2 -I/usr/include/freetype2/config -I/usr/include/glib-2.0 -I/usr/lib/glib-2.0/include -g -O2 -I/usr/X11R6/include
Linking: gcc -L/usr/X11R6/lib -L/usr/local/lib -o vim -Wl,--export-dynamic -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgdk_pixbuf-2.0 -lpangoxft-1.0 -lpangox-1.0 -lpango-1.0 -lgobject-2.0 -lgmodule-2.0 -lglib-2.0 -lXt -lm -lncurses -lselinux -lacl -lgpm
Regards,
Gary
It is probably a duplicate of my report:
From: ZyX <zyx...@gmail.com>
Date: Sun, 22 Aug 2010 00:23:40 +0400
Subject: [BUG] Setting formatoption to auto ('a') causes cursor to jump on input
The following script causes wrong behavior: expected to see ``^^'' in the file,
but actually first ``^'' is 8 characters far from second ``^'' (see result.txt,
notice the tab appeared at the start of the file replacing 8 spaces).
Vim version 7.3, gentoo amd64 with blank user configuration.
==== bug.sh ====
cat > input.txt <<EOF
Word word word word word word word word word word word word word word
word word word word word word word word word word word word word word
word word word word word word word word word word word word word word
EOF
vim -u NONE --cmd 'set formatoptions=a' -c 'normal! 2ggI^^' -c 'w! result.txt' -c 'qa!'
input.txt
== result.txt ==
Word word word word word word word word word word word word word word
^word wor^d word word word word word word word word word word word word word
word word word word word word word word word word word word word
================
Текст сообщения:
> On 15 Sep, 10:25, ZyX <zyx....@gmail.com> wrote:
> > ïÔ×ÅÔ ÎÁ ÓÏÏÂÝÅÎÉÅ <<Bug in 7.3.3: Cursor jumps in insert mode when 'a' and 'w' in
> > 'formatoptions'>>,
> > ÐÒÉÓÌÁÎÎÏÅ × 10:56:15 15 ÓÅÎÔÑÂÒÑ 2010, óÒÅÄÁ,
> > ÏÔÐÒÁ×ÉÔÅÌØ Gary Johnson:
Thanks for making this patch. I'll try it out soon.
You get bonus points if you can make a test that fails before this
patch.
--
Spam seems to be something useful to novices. Later you realize that
it's a bunch of indigestable junk that only clogs your system.
Applies to both the food and the e-mail!
/// Bram Moolenaar -- Br...@Moolenaar.net -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ download, build and distribute -- http://www.A-A-P.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
> You get bonus points if you can make a test that fails before this
> patch.
>
Attached a test (adding it to test68.vim which tests 'formatoptions')
Carlo
Thanks!
--
Your mouse has moved. Windows must be restarted for the change
to take effect. Reboot now?