Commit Graph

14158 Commits

Author SHA1 Message Date
Justin M. Keyes
87389c6a57 paste: make vim.paste() "public" 2019-08-27 22:14:52 +02:00
Justin M. Keyes
ed60015266 paste: handle vim.paste() failure
- Show error only once per "paste stream".
- Drain remaining chunks until phase=3.
- Lay groundwork for "cancel".
- Constrain semantics of "cancel" to mean "client must stop"; it is
  unrelated to presence of error(s).
2019-08-27 22:13:45 +02:00
Justin M. Keyes
4344ac1111 paste: tickle cursor
HACK: The cursor does not get repositioned after the paste completes.
Scheduling a dummy event seems to fix it.

Test case:
0. Revert this commit.
1. Paste some text in Normal-mode.
2. Notice the cursor is still in the cmdline area.
2019-08-27 22:13:45 +02:00
Justin M. Keyes
5b41070c63 paste: implement redo (AKA dot-repeat)
- Normal-mode redo idiom(?): prepend "i" and append ESC.
- Insert-mode only needs AppendToRedobuffLit().
- Cmdline-mode: only paste the first line.
2019-08-27 22:13:45 +02:00
Justin M. Keyes
bfc5a18f4b paste: insert text "before" cursor in Insert-mode 2019-08-27 22:13:45 +02:00
Justin M. Keyes
eacc70fb3e API: nvim_paste 2019-08-27 22:13:45 +02:00
Justin M. Keyes
c95f5d166f paste: workaround typeahead race
Workaround this failure:

    [  ERROR   ] test/functional/terminal/tui_spec.lua @ 192: TUI paste: exactly 64 bytes
    test/functional/helpers.lua:403:
    retry() attempts: 478
    test/functional/terminal/tui_spec.lua:201: Expected objects to be the same.
    Passed in:
    (table: 0x47cd77e8) {
     *[1] = 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz endz' }
    Expected:
    (table: 0x47cd7830) {
     *[1] = 'zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz end' }

This happens because `curwin->w_cursor.col` is sometimes decremented at
the end of `do_put`... because the editor is in Normal-mode instead of
the expected Insert-mode.

Caused by "typeahead race" (#10826): there may be queued input in the
main thread not yet processed, thus the editor mode (`State` global)
will be "wrong" during paste. Example: input "i" followed immediately by
a paste sequence:

    i<start-paste>...<stop-paste>
    ^
     "i" does not get processed in time, so the editor is in
     Normal-mode instead of Insert-mode while handling the paste.

Attempted workarounds:
- vim.api.nvim_feedkeys('','x',false) in vim._paste()
- exec_normal() in tinput_wait_enqueue()
- LOOP_PROCESS_EVENTS(&main_loop,…,0) in tinput_wait_enqueue()

ref #10826
2019-08-27 21:19:10 +02:00
Justin M. Keyes
5ae6849517 paste: phases, dots
- Send `phase` parameter to the paste handler.
- Redraw at intervals and when paste terminates.
- Show "..." throbber during paste to indicate activity.
2019-08-27 21:19:10 +02:00
Justin M. Keyes
93e5f0235b API: nvim_put: "follow" parameter 2019-08-27 21:19:10 +02:00
Justin M. Keyes
613296936b API: nvim_put: always PUT_CURSEND
Fixes strange behavior where sometimes the buffer contents of a series
of paste chunks (vim._paste) would be out-of-order.

Now the tui_spec.lua screen-tests are much more reliable. But they still
sometimes fail because of off-by-one cursor (caused by "typeahead race"
resulting in wrong mode; fixed later in this patch-series).
2019-08-27 21:19:10 +02:00
Justin M. Keyes
1fdae25b2b test/tui_spec: connect to child session 2019-08-27 21:19:10 +02:00
Justin M. Keyes
517bf99ddb API: nvim_put: Avoid "N more lines" message 2019-08-27 21:19:10 +02:00
Justin M. Keyes
0221a9220a paste: edge-case: handle EOL at end-of-buffer
This is "readfile()-style", see also ":help channel-lines".
2019-08-27 21:19:10 +02:00
Justin M. Keyes
d303790ee7 paste: test 2019-08-27 21:19:10 +02:00
Justin M. Keyes
5a2894d677 paste: use nvim_put() 2019-08-27 21:19:10 +02:00
Justin M. Keyes
e1177be363 API: nvim_put #6819 2019-08-27 21:19:10 +02:00
Björn Linse
9e25a36467 API: nvim_put #6819: try to fix Insert, Visual 2019-08-27 21:19:10 +02:00
Björn Linse
4cc56905cb API: nvim_put #6819 2019-08-27 21:19:10 +02:00
Justin M. Keyes
f99caa755c paste: use chansend() in Terminal-mode 2019-08-27 21:19:10 +02:00
Justin M. Keyes
abd55be19a paste: fixup tests 2019-08-27 21:19:10 +02:00
Justin M. Keyes
4389401a7c paste: abort paste if handler does not return true 2019-08-27 21:19:10 +02:00
Justin M. Keyes
68ea9a7c8a TUI/paste: always flush on paste mode-change
Flush input before entering, not only when leaving, paste mode. Else
there could be pending input which will erroneously be sent to the paste
handler.
2019-08-27 21:19:10 +02:00
Justin M. Keyes
6d277f43a2 TUI/paste: define paste function as Lua builtin
- Define in Lua so that it is compiled-in (available with `-u NONE`).

TODO: Eventually we will want a 'pastefunc' option or some other way to
override the default paste handler.
2019-08-27 21:19:10 +02:00
Justin M. Keyes
7df566060c lua/stdlib: cleanup 2019-08-27 21:19:10 +02:00
Justin M. Keyes
0a4ef38e43 log: log_key() 2019-08-27 21:19:10 +02:00
Justin M. Keyes
9a92ba88dd TUI/paste: push bytes directly (avoid libtermkey) 2019-08-27 21:19:10 +02:00
ZyX
75663aaf0f TUI/paste: collect data, invoke user callback #4448 2019-08-27 21:19:10 +02:00
Justin M. Keyes
21f0f7bca5 paste: WIP #4448 2019-08-27 21:19:10 +02:00
Daniel Hahler
a851090dec
build: third-party: enable CXX language earlier (#10862)
This is required for `CMAKE_CXX_COMPILER` to be set already, not only
after including third-party/cmake/BuildGperf.cmake.

Closes https://github.com/neovim/neovim/pull/10860.
Ref: 31f879983f
2019-08-27 20:55:11 +02:00
Justin M. Keyes
4cedc8444e
Merge #10858 from janlazo/vim-8.1.1930
vim-patch:8.1.{1930,1931}
2019-08-27 09:27:03 +02:00
Jan Edmund Lazo
41ec296640
vim-patch:8.1.1931: syntax test fails
Problem:    Syntax test fails.
Solution:   Add new javascriptreact type to completions.
ea7a08a53e
2019-08-26 19:51:43 -04:00
Jan Edmund Lazo
f667a0e02a
vim-patch:8.1.1930: cannot recognize .jsx and .tsx files
Problem:    Cannot recognize .jsx and .tsx files.
Solution:   Recognize them as javascriptreact and typescriptreact.
            (closes vim/vim#4830)
92852cee3f
2019-08-26 19:51:26 -04:00
Ihor Antonov
f3cb529774 clang/"dereference of null pointer" #10856
In edit.c insert_execute calls ins_compl_addfrommatch
2019-08-26 20:22:39 +02:00
Daniel Hahler
7d56c90dff
timer_spec: shorter timeout with "doesn't mess up the cmdline" (#10769)
It was increased in dd21cd2a4 to avoid flakiness, but takes 1s then always.

This specifies a shorter timeout again, uisng `load_adjust`.
2019-08-26 14:21:01 +02:00
Daniel Hahler
6a21fe9fd1
vim-patch:8.1.1923: some source files are not in a normal encoding (#10852)
Problem:    Some source files are not in a normal encoding.
Solution:   Convert hangulin.c from euc-kr to utf-8 and digraph.c from latin1
            to utf-8. (Daniel Hahler, closes vim/vim#4731)
4119309d70
2019-08-26 12:22:21 +02:00
Daniel Hahler
b069a20910
runnvim.sh: lint (shellcheck) (#10851) 2019-08-26 12:21:53 +02:00
Daniel Hahler
b12b01a828
Merge pull request #10850 from blueyed/option-alias
findoption_len: treat viminfo/viminfofile as aliases
2019-08-26 10:23:12 +02:00
Daniel Hahler
f790799474
third-party: use neovim/unibilium (#10677)
Ref: https://github.com/neovim/neovim/issues/10302
Fixes https://github.com/neovim/neovim/issues/9071.
2019-08-26 10:21:08 +02:00
Jan Edmund Lazo
233597152a vim-patch:8.1.1790: :mkvimrc is not tested
Problem:    :mkvimrc is not tested.
Solution:   Add a test.
8750026a7f
2019-08-26 09:39:00 +02:00
Daniel Hahler
b2d6a6891e findoption_len: treat viminfo/viminfofile as aliases
Ref: https://github.com/neovim/neovim/pull/10672#issuecomment-524716824
2019-08-26 09:39:00 +02:00
Jan Edmund Lazo
ebc3070b7d vim-patch:8.1.1926: redraw cursorline after putting line above #10849
Problem:    Cursorline not redrawn when putting a line above the cursor.
Solution:   Redraw when the curor line is below a change. (closes vim/vim#4862)
c2b97643a8
2019-08-26 04:17:34 +02:00
Daniel Hahler
e3e0574cb3
Merge pull request #10841 from janlazo/vim-7.4.1407
vim-patch:7.4.1407,8.1.1111
2019-08-25 21:04:17 +02:00
Daniel Hahler
bec2336231
vim-patch:8.1.1913: not easy to compute the space on the command line (#10845)
Problem:    Not easy to compute the space on the command line.
Solution:   Add v:echospace. (Daniel Hahler, closes vim/vim#4732)
37f4cbd46f
2019-08-25 20:53:17 +02:00
Justin M. Keyes
c8fc285db6
Merge #10840 from janlazo/vim-8.1.1757
vim-patch:8.1.{1757,1924}
2019-08-25 09:13:49 +02:00
Abdelhakeem Osama
2e621553c0 teardown: fix win_free_all() heap-use-after-free #10839
Fixes #10838
2019-08-25 09:11:22 +02:00
Jan Edmund Lazo
66c06dad62
vim-patch:8.1.1924: using empty string for current buffer is unexpected
Problem:    Using empty string for current buffer is unexpected.
Solution:   Make the argument optional for bufname() and bufnr().
a8eee21e75
2019-08-24 21:18:15 -04:00
Jan Edmund Lazo
1dc088ea7d
vim-patch:8.1.1111: it is not easy to check for infinity
Problem:    It is not easy to check for infinity.
Solution:   Add isinf(). (Ozaki Kiichi, closes vim/vim#3787)
fda1bff39f
2019-08-24 17:02:05 -04:00
Jan Edmund Lazo
01b5499eea
vim-patch:7.4.1407
Problem:    json_encode() does not handle NaN and inf properly. (David
            Barnett)
Solution:   For JSON turn them into "null".  For JS use "NaN" and "Infinity".
            Add isnan().
f1b6ac7229
2019-08-24 15:56:17 -04:00
Jan Edmund Lazo
4fedef51b0
vim-patch:8.1.1757: text added with appendbufline() isn't displayed
Problem:    Text added with appendbufline() to another buffer isn't displayed.
Solution:   Update topline. (partly by Christian Brabandt, closes vim/vim#4718)
2984666291
2019-08-24 14:04:20 -04:00
Jan Edmund Lazo
34e4166673 vim-patch:8.0.1236: Mac features are confusing #10837
Problem:    Mac features are confusing.
Solution:   Make feature names more consistent, add "osxdarwin". Rename
            feature flags, cleanup Mac code. (Kazunobu Kuriyama, closes vim/vim#2178)
d057301b1f
2019-08-24 09:04:08 +02:00