Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

検索でcountとoffsetを組み合わせた場合カウントが無視されるケースがある #645

Closed
haya14busa opened this issue Oct 1, 2014 · 11 comments

Comments

@haya14busa
Copy link
Member

不具合としては2つあって

  1. :set incsearchでハイライトするターゲットがおかしくなる
  2. そもそも検索の実行結果のカーソル位置がカウントを無視した挙動と同じになってしまう

があるとおもわれますが、まとめて報告させていただきます

test.txt

{cursor}

1: pattern12345

2: pattern12345

再現手順

  1. vim -N -u NONE test.txt
  2. :set incsearch
  3. 2/pattern/e
    • /eを打った時点でインクリメンタルハイライトが1: patternの方へ移ってしまうが実行結果は正しく2:の行のpatternへ飛ぶ
  4. :1 (カーソル戻す)
  5. 2/pattern/e3
    • ハイライトが1:の行に移る上に、実行しても1: pattern12{3}45(カーソル位置が3) とカウントが無視されてカーソル移動してしまう (場合がある???)

なお

:exec "normal! 2/pattern/e3\<CR>"

した場合も同様の結果になります。 また、vim -N -u NONEでテストすると今のところ100%再現するのですが、普段の環境だと場合によって再現しない時があるのでなにか条件があるのかもしれませんがわかりませんでした...

Version

VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Sep 25 2014 17:52:44)
Included patches: 1-460
Compiled by haya14busa@haya14busa-ThinkPad-X200s
Huge version with GTK2 GUI.  Features included (+) or not (-):
+acl             +conceal         +farsi           +libcall         +mouse_netterm   +profile         +syntax          +visualextra
+arabic          +cryptv          +file_in_path    +linebreak       +mouse_sgr       +python/dyn      +tag_binary      +viminfo
+autocmd         +cscope          +find_in_path    +lispindent      -mouse_sysmouse  +python3/dyn     +tag_old_static  +vreplace
+balloon_eval    +cursorbind      +float           +listcmds        +mouse_urxvt     +quickfix        -tag_any_white   +wildignore
+browse          +cursorshape     +folding         +localmap        +mouse_xterm     +reltime         -tcl             +wildmenu
++builtin_terms  +dialog_con_gui  -footer          +lua/dyn         +multi_byte      +rightleft       +terminfo        +windows
+byte_offset     +diff            +fork()          +menu            +multi_lang      +ruby            +termresponse    +writebackup
+cindent         +digraphs        +gettext         +mksession       -mzscheme        +scrollbind      +textobjects     +X11
+clientserver    +dnd             -hangul_input    +modify_fname    -netbeans_intg   +signs           +title           -xfontset
+clipboard       -ebcdic          +iconv           +mouse           +path_extra      +smartindent     +toolbar         +xim
+cmdline_compl   +emacs_tags      +insert_expand   +mouseshape      +perl            -sniff           +user_commands   +xsmp_interact
+cmdline_hist    +eval            +jumplist        +mouse_dec       +persistent_undo +startuptime     +vertsplit       +xterm_clipboard
+cmdline_info    +ex_extra        +keymap          +mouse_gpm       +postscript      +statusline      +virtualedit     -xterm_save
+comments        +extra_search    +langmap         -mouse_jsbterm   +printer         -sun_workshop    +visual          +xpm
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
      user exrc file: "$HOME/.exrc"
  system gvimrc file: "$VIM/gvimrc"
    user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
    system menu file: "$VIMRUNTIME/menu.vim"
  fall-back for $VIM: "/usr/local/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK  -pthread -I/usr/include/gtk-2.0 -I/usr/lib/i386-linux-gnu/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/freetype2 -I/usr/include/glib-2.0 -I/usr/lib/i386-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/libpng12 -I/usr/include/harfbuzz     -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1      
Linking: gcc   -L. -L/home/haya14busa/.anyenv/envs/rbenv/versions/2.1.2/lib  -fstack-protector -rdynamic -Wl,-export-dynamic -Wl,-E   -L/usr/local/lib -Wl,--as-needed -o vim   -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfontconfig -lgobject-2.0 -lglib-2.0 -lfreetype   -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE  -lm -ltinfo    -lacl -lattr -lgpm -ldl   -Wl,-E  -fstack-protector -L/usr/local/lib  -L/usr/lib/perl/5.18/CORE -lperl -ldl -lm -lpthread -lcrypt    -Wl,-R -Wl,/home/haya14busa/.anyenv/envs/rbenv/versions/2.1.2/lib -L/home/haya14busa/.anyenv/envs/rbenv/versions/2.1.2/lib -lruby-static -lpthread -ldl -lcrypt -lm  -L/home/haya14busa/.anyenv/envs/rbenv/versions/2.1.2/lib   
@ichizok
Copy link
Member

ichizok commented Oct 8, 2014

最初のマッチとそれ以降で探索位置の条件を変更�しました。
https://gist.github.com/ichizok/9252b826f789f8addd98

@haya14busa
Copy link
Member Author

@ichizok さんのパッチを試したところ意図した挙動になりました! ありがとうございます!

@haya14busa
Copy link
Member Author

不具合としては2つあって

両方直りました

@ichizok
Copy link
Member

ichizok commented Oct 16, 2014

@haya14busa
Copy link
Member Author

@ichizok さんありがとうございます!

@ynkdir
Copy link
Member

ynkdir commented Oct 17, 2014

おつです!

/foo/;/bar/ とかセミコロンがからんだりすると仕様自体よくわからないですねこのへん。

@ichizok
Copy link
Member

ichizok commented Oct 21, 2014

" Then, you input return key, cursor goes on second 'pattern' line (correct).

"" issue 2

:1

2/pattern/e3

" It is same as issue 1 until input last '3'.
" Then, you input return key, cursor goes on first 'pattern' line (incorrect).

I cannot reproduce this, it goes to 3 characters after the second match,
as expected."

2番目の方は再現しなかったそうです...
(私の環境では再現してます。CentOS 7 / Vim 7.4.481

@haya14busa
Copy link
Member Author

oh.... 最新版にしてもう一度試してみましたがこちらでもやはり再現しました Ubuntu CUI Vim 7.4.482

@haya14busa
Copy link
Member Author

取り込まれたようですっ! https://groups.google.com/forum/#!topic/vim_dev/PXaU7Hxty58

@ichizok さんありがとうございました!

@k-takata
Copy link
Member

7.4.532 で取り込まれたということで、閉じます。

@mattn
Copy link
Member

mattn commented Nov 27, 2014

@ichizok ++

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants