Giter VIP home page Giter VIP logo

h-east / vim Goto Github PK

View Code? Open in Web Editor NEW

This project forked from vim/vim

20.0 20.0 0.0 137.05 MB

Vim-CLPUM

Home Page: http://h-east.github.io/vim/

License: Vim License

Makefile 3.03% NSIS 1.15% Shell 0.40% C 90.64% IDL 0.03% Awk 0.12% Perl 0.41% Batchfile 0.08% PostScript 0.41% Smalltalk 0.16% Emacs Lisp 0.19% NewLisp 0.24% Ruby 0.26% SystemVerilog 0.18% C++ 1.53% Module Management System 0.36% Python 0.33% XS 0.33% Objective-C 0.08% DIGITAL Command Language 0.07%

vim's People

Contributors

amaanq avatar azc100 avatar brammool avatar chrisbra avatar dkearns avatar dpelle avatar dundargoc avatar errael avatar freed-wu avatar glepnir avatar h-east avatar habamax avatar ichizok avatar jamessan avatar k-takata avatar lemonboy avatar luukvbaal avatar observeroftime avatar pheiduck avatar restorerz avatar ribru17 avatar seandewar avatar shane-xb-qian avatar shougo avatar ychin avatar yegappan avatar zdohnal avatar zeertzjq avatar zewpo avatar zzzyxwvut avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

vim's Issues

CLPUM doesn't appear if some options are set

&conceallevel > 0 の状態で cursorline, cursorcolumn, relativenumber のいずれかを設定すると、
<C-D> で CLPUM が表示されないことがあります。

[repro steps]

vimrc:

if exists('+clpum')
    set clpum
    set clpumheight=40
    set clcompleteopt+=noinsert
endif
set cole=1 cul
vim -u vimrc -N
:set <C-D>

expected: CLPUM が表示される
actual: CLPUM が表示されない

内部的には処理が実行されているので、<C-N> 等で候補選択すると CLPUM が表示されます。

[investigation]

vim/src/main.c

Line 1196 in 60422e6

conceal_update_lines = TRUE;

&conceallevel > 0 のとき conceal_update_lines = TRUE

vim/src/main.c

Line 1299 in 60422e6

curwin->w_valid &= ~VALID_CROW;

で、curwin->w_valid &= ~VALID_CROW となる

vim/src/move.c

Line 970 in 60422e6

if (!(curwin->w_valid & VALID_CROW))

vim/src/move.c

Line 795 in 60422e6

redraw_for_cursorline(curwin);

そのため、CLPUM 実行時に curs_columns > curs_rows > redraw_for_cursorline と呼ばれ、

vim/src/move.c

Line 145 in 60422e6

redraw_win_later(wp, SOME_VALID);

ここで、cursorline, relativenumber がセットされていると redraw_win_later(wp, SOME_VALID) が呼ばれるため、この後の再描画で CLPUM が消去されてしまいます。

[solution proposal]

vim/src/move.c

Line 142 in 60422e6

&& !pum_visible()

vim/src/move.c

Line 824 in 60422e6

&& !pum_visible()

vim/src/move.c

Line 1197 in 60422e6

&& !pum_visible()

上記箇所の判定に && !clpum_visible() を追加することで領域の再描画を回避できました。

CLPUM is not triggered by <TAB> key.

https://groups.google.com/d/msg/vim_dev/E3zq6C_b23k/sEmckDA9AwAJ

Now behavior:

- When 'clpum' option is on.
  - `<TAB>` behavior:
    When not started CLPUM, conform to 'wildmenu' and 'wildmode'. 
    When started CLPUM, Use the next match.  This match replaces the previous one.

  - `<C-D>` behavior:
    When not started CLPUM, CLPUM is triggered.  
    When started CLPUM, Use the next match.  This match replaces the previous one.

I'll change to the following behavior.

- When 'clpum' option is on.
  - `<TAB>` and `<C-D>` behavior:
    When not started CLPUM, CLPUM is triggered.  
    When started CLPUM, Use the next match.  This match replaces the previous one.

popup menu inside terminal window is not cleared when closed

Hi!
Thanks for making this patch, I hope it gets included in Vim.

When popup menu is overlapping terminal window it is not cleared when closed. The issue and a fix are both related to vim#2908

diff --git a/src/clpum.c b/src/clpum.c
index 22ec3a487..c8b7025e2 100644
--- a/src/clpum.c
+++ b/src/clpum.c
@@ -394,7 +394,7 @@ clpum_undisplay(void)
     //FreeWild(clpum_size, clpum_array);
     clpum_array = NULL;
     //clpum_size = -1;
-    redraw_all_later(SOME_VALID);
+    redraw_all_later(NOT_VALID);
 #ifdef FEAT_WINDOWS
     redraw_tabline = TRUE;
 #endif

CLPUM flickers

How to reproduce:

$ vim -N -u NONE -c "set clpum"
:set <C-D>
Continue to press the <C-D>.

A match item is inserted when option 'clcot' not set.

How to reproduce:

  • Start pure Vim with some options.
    $vim -Nu NONE -c "set wmnu wim=popup"
  • clpum triggerd.
    :set <TAB>

Expected behavior:

A popup menu is displayed and command-line stay :set. Because option clcot default value is "menuone,noinsert".

Actual behavior:

A popup menu is displayed and command-line completed to :set all. Unexpected completion.

filename/menu name completion issue happen, when "set wmnu wim=popup clcot=menu,noinsert" and type <RIGHT>

Step to reproduce:

in Vim clone directory (:cd vim/src)

  1. Start pure Vim and some options.
    $ vim -Nu NONE -c "set wmnu wim=popup clcot=menu,noinsert"
  2. Start filename completion and select "testdir/" by up/down cursor key.
    :cd <TAB>↑↑↑↑
  3. Type right cursor key and select "testdir/pythonx/" by up/down cursor key.
    →↓↓↓↓
  4. Type right cursor key.

Expect behavior:

  • Popup is undisplayed.

Actual behavior:

  • Previous popup was displayed.

Long command-line and CLPUM is wrong

When command-line cursor position + complete item length > Columns in CLPUM, command-line and last line message become scramble.

How to reproduce:

  • Terminal size is 80x24.
  • Start Vim.
    $ ./vim -N -u NONE -c "set clpum ch=2"
  • input below.
    :set w
    (:set + 75 spaces + w)
  • Start CLPUM.
    <C-D>

Expected behaivior:

  • Command-line and last line message each appear.
    (Command-line maybe scrolled 1 up)

Actual behaivior:

  • It is scramble to display.

Vim is crashed if input() was called with complete functions

input() 関数を第3引数つき(補完つき)で呼び出すと、補完を開始したタイミングで落ちます。

Environment

  • Windows 10 64bit
  • MINGW64 でビルド

How to reproduce

gvim -N -u NONE または vim -N -u NONE

で起動した後、
以下のスクリプトを読み込みます(cmdlineから入力しても再現可能)

set wildmenu wildmode=popup
call input('', '', 'option')

<TAB> を何度か叩きます。

cannot accept selection when popup menu is not visible

With the following settings:

  set wildmode=popup
  set wildmenu
  set clcompleteopt=menu

Enter:

  • :colorsch
  • Press <tab>
  • Press <c-y>
  • Instead of accepting selection ^Y is inserted.

The following is what fixed it for me.

diff --git a/src/ex_getln.c b/src/ex_getln.c
index 6b19c8c8c..0673418b6 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -8969,8 +8969,7 @@ clpum_compl_prep(int c)
 	     * the selection without inserting anything.  When
 	     * clpum_compl_enter_selects is set the Enter key does the same. */
 	    if ((c == Ctrl_Y || (clpum_compl_enter_selects
-				   && (c == CAR || c == K_KENTER || c == NL)))
-		    && clpum_visible())
+				   && (c == CAR || c == K_KENTER || c == NL))))
 		retval = TRUE;
 
 	    /* CTRL-E means completion is Ended, go back to the typed text. */

SEGV when using `<C-R>=`

SEGV occurs when using <C-R>= expansion.

[environment]
Vim 7.4.1832 on Ubuntu 16.04

[repro steps]

$ cat test.vim
if has('clpum')
  set wildmode=popup
  set wildmenu
endif
$ vim -Nu NONE -S test.vim

input keys,

:<C-R>=<CR><TAB>

and SEGV occurs.

[cause]

stacktrace.1 (when expansion)

#0  getcmdline (firstc=61, count=0, indent=0) at ex_getln.c:387
#1  0x000000000050c053 in get_expr_register () at ops.c:784
#2  0x00000000004897e5 in getcmdline (firstc=58, count=1, indent=0) at ex_getln.c:1454
#3  0x000000000048b05b in getexline (c=58, cookie=0x0, indent=0) at ex_getln.c:2497
#4  0x0000000000470d4c in do_cmdline (cmdline=0x0, fgetline=0x48b01e <getexline>, cookie=0x0, flags=0) at ex_docmd.c:1003
#5  0x0000000000503254 in nv_colon (cap=0x7fff060f2710) at normal.c:5320
#6  0x00000000004fc5ff in normal_cmd (oap=0x7fff060f27a0, toplevel=1) at normal.c:1149
#7  0x00000000005ec25c in main_loop (cmdwin=0, noexmode=0) at main.c:1359
#8  0x00000000005ebc4c in main (argc=7, argv=0x7fff060f2a88) at main.c:1051

stacktrace.2 (received SEGV)

#0  0x000000000048d962 in ExpandInit (xp=0x0) at ex_getln.c:4103
#1  0x0000000000475435 in set_one_cmd_context (xp=0x0, buff=0xc44940 "edit ") at ex_docmd.c:3422
#2  0x000000000048eacc in set_cmd_context (xp=0x0, str=0xc44940 "edit ", len=5, col=5) at ex_getln.c:4784
#3  0x0000000000496643 in clpum_complete (c=9) at ex_getln.c:8866
#4  0x00000000004889a7 in getcmdline (firstc=58, count=1, indent=0) at ex_getln.c:1102
#5  0x000000000048b05b in getexline (c=58, cookie=0x0, indent=0) at ex_getln.c:2497
#6  0x0000000000470d4c in do_cmdline (cmdline=0x0, fgetline=0x48b01e <getexline>, cookie=0x0, flags=0) at ex_docmd.c:1003
#7  0x0000000000503254 in nv_colon (cap=0x7fff060f2710) at normal.c:5320
#8  0x00000000004fc5ff in normal_cmd (oap=0x7fff060f27a0, toplevel=1) at normal.c:1149
#9  0x00000000005ec25c in main_loop (cmdwin=0, noexmode=0) at main.c:1359
#10 0x00000000005ebc4c in main (argc=7, argv=0x7fff060f2a88) at main.c:1051

It nests getcmdline, so clpum_compl_xp points NULL when entering clpum_complete.

getcmdline              # L383: set clpum_compl_xp to &xpc
__get_expr_register
____getcmdline          # L383: set clpum_compl_xp to &xpc
                        # and L2218: set clpum_compl_xp to NULL
__clpum_complete        # clpum_compl_xp is NULL

Shift-Tab does not show popup

Problem

With vim --clean, Shift-Tab in command-line completes the last filename.
I want clpum to show popup even when pressing Shift-Tab.

502aebc532f9f3182cda6fa98806e370

Sorry, I tried this only in CUI Vim.

Steps to reproduce

vimrc

set wildmode=popup
set wildmenu
set clpumheight=40
  1. vim --clean -S clpum.vim
  2. :e <S-Tab>

It does not show popup.
It works the same as plain vim behavior.

Environment

WSL Debian 9.5
Microsoft Windows 10 Pro 64bit 10.0.17134

When stop CLPUM, characters are deleted under the cursor until the end of the command-line.

How to reproduce:

  • Start pure Vim with enable clpum.
    $ vim -N -u NONE -c "set clpum"
  • Input below.
    :abcde<C-B>set w
  • Start CLPUM and insert second item.
    <Tab><Tab>
  • Stop CLPUM and go back to the originally typed text.
    <C-E>

Expected behavior:

  • The following characters are displayed on the command line. (| is cursor)
    :set w|abcde

Actual behavior:

  • Displayed this. Where is abcde gone?
    :set w|

The first item is not inserted to command-line

Problem

The first item bar is selected in completion menu, but not inserted to command-line
when pressing <Tab> to complete file paths.

820374ec9ac22beedc04a531637fc0c5

Steps to reproduce

set wildmode=popup
set wildmenu
set clpumheight=40
$ ls -1 tmp
bar
baz
foo
  1. vim --clean -S clpum.vim
  2. :e tmp/<Tab>

It shows bar, baz, foo in completion menu, and the first item bar is selected.
But bar is not inserted to command-line.
So the next <Tab> selects and inserts the second item baz not the first item bar.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.