Commit Graph

170 Commits

Author SHA1 Message Date
Justin M. Keyes
119f0ca854 test: helpers.execute() => helpers.feed_command() 2017-04-11 02:37:39 +02:00
ZyX
0ac2afdec7 functests: Fix some ui/*_spec tests 2017-04-09 03:24:26 +03:00
ZyX
ddaa41dee4 functests: Fix ui/bufhl_spec 2017-04-09 03:24:26 +03:00
ZyX
88ea362c70 functests: Fix ui/screen_basic_spec 2017-04-09 03:24:23 +03:00
ZyX
65fb622000 functests: Replace execute with either command or feed_command
Hope this will make people using feed_command less likely: this hides bugs.
Already found at least two:

1. msgpackparse() will show internal error: hash_add() in case of duplicate
   keys, though it will still work correctly. Currently silenced.
2. ttimeoutlen was spelled incorrectly, resulting in option not being set when
   expected. Test was still functioning somehow though. Currently fixed.
2017-04-09 03:24:08 +03:00
Björn Linse
3b558e5d7b tests: short form screen:except(func) expects condition only. #6440
- Use this to properly test cursor shape events.
- tests: update screen_basic_spec to use `screen:expect` short form.
  Clearer than using `screen:wait` directy.
2017-04-06 01:06:39 +02:00
Justin M. Keyes
e348e256f3 'guicursor': Disable by default for unknown terminals.
User can still set guicursor explicitly in init.vim.

Closes #5990
Closes #6403
2017-04-04 14:19:26 +02:00
Justin M. Keyes
3ccd59ee82 'guicursor': enabled=false if 'guicursor' is empty
Closes #6429
Closes #6430
2017-04-04 14:19:26 +02:00
Yichao Zhou
bc6d868d00 'listchars': Whitespace highlight group #6367 2017-04-03 14:10:40 +02:00
ZyX
dc75766081 tests: Fix testlint errors 2017-04-03 03:07:01 +03:00
Justin M. Keyes
3a69dbfca6 api/cursor_style_set: mode descriptions 2017-04-01 23:29:10 +02:00
Justin M. Keyes
c2826a7830 'guicursor': Empty means "block cursor in all modes".
Also: update default 'guicursor' to match the documentation.
2017-04-01 23:14:05 +02:00
Matthieu Coudron
dd4a5fcbb6 tui: 'guicursor' shape #6044
Closes #2583
2017-04-01 23:14:05 +02:00
Yichao Zhou
43a99f77a8 highlight: :match should override 'list' (#6343)
Closes #4946
2017-03-26 13:04:20 +02:00
Justin M. Keyes
a90beeadbb defaults: 'showcmd', 'belloff', 'ruler'
- Vim "unix default" of 'noshowcmd' is serving few users. And it's
  inconsistent.
- 'ruler' and 'belloff=all' improve the out-of-the-box experience.
- Continue to use 'noshowcmd' and 'noruler' by default in the functional
  tests to keep them fast.

TODO: Add a "disable slow stuff" command or mapping to address the
use-case of a very slow terminal connection.
2017-03-16 18:44:10 +01:00
James McCoy
7217360e34 vim-patch:7.4.2051
Problem:    No proper testing of trunc_string().
Solution:   Add a unittest for message.c.

502ae4ba63
2017-03-06 15:09:40 -05:00
Justin M. Keyes
937e54f865 terminal: Keep cursor position.
Let the terminal dictate the normal-mode cursor position. This will be
disorienting sometimes, but it is closer to what users expect vs always
going to the last line.
2017-03-01 14:47:49 +01:00
Matthew Malcomson
d25649fa01 undo: :earlier, g-: Set b_u_seq_cur correctly. (#6016)
Previously alternate branches were not accounted for properly, with this
change g- after an undo to a branch point works.

The current sequence number b_u_seq_cur is used in undo_time(), in
u_doit() this was calculated by subtracting one from the curhead
sequence number.

The curhead header entry represents the change that was just undone, so
the sequence number we want is that of the change we have moved to. This
is the sequence number of the undo head that is the uh_next element of
this curhead. That sequence number is not always one less than the
curhead sequence number -- there may have been an alternate branch at
this point.

Instead of subtracting one, we now directly find the sequence number of
curhead->uh_next.
2017-01-31 05:46:55 +01:00
Justin M. Keyes
25427ae892 test: Fix broken test. 2017-01-24 14:25:50 +01:00
Justin M. Keyes
a3a241d313 ci: XXX: Disable "throttle" test on Travis macOS. 2017-01-23 22:17:16 +01:00
Justin M. Keyes
6be8ea0787 coverity/133845: Negative array index read. (FP)
`find_command(s->ca.cmdchar) >= 0` was established near the start of
normal_execute(). And `unshift_special(&s->ca);` "should" not ever
result in s->ca.cmdchar containing a multibyte char.

So only an assert() is needed here.
2017-01-23 15:49:37 +01:00
Justin M. Keyes
ef753a76b9 tui: Enable mode-sensitive cursor by default.
Also give NVIM_TUI_ENABLE_CURSOR_SHAPE more granularity:
0 = do not change cursor shape
1 = non-blinking ("steady") cursor with mode-sensitive shape
2 = blinking cursor with mode-sensitive shape

Note: blink state is not changed for Konsole, instead user's terminal
preference makes the decision. (Can't do that for xterm-likes, DECSCUSR
forces us to choose blink-state.)

This is a temporary step until the TUI respects 'guicursor'
Ref: https://github.com/neovim/neovim/issues/2583#issuecomment-272988384
2017-01-20 15:48:41 +01:00
Justin M. Keyes
3a574af3c4 ci: Disable "CTRL-C interrupts :global" test
This test is low-value, high-cost. It's slow, and sometimes crashes
luajit. It's still enabled on local runs, that's good enough.
2017-01-19 14:22:01 +01:00
James McCoy
75e6af44e0 Merge pull request #5963 from jamessan/screen-expect-clarity
test: screen: Assert expected row count matches configured screen height
2017-01-18 15:16:07 -05:00
Justin M. Keyes
2ee60e5b28 test: nvim_ui_attach() with huge dimensions. (#5974)
Also:
- Attempt to constrain wall-of-text in screen.lua.
- Windows: Enable screen_basic_spec.lua

Closes #2180
2017-01-18 20:28:35 +01:00
James McCoy
e2b031a342 test: screen_basic: Re-enable min width/height test 2017-01-18 11:24:39 -05:00
James McCoy
4322021bae test: screen: Assert expected row count matches configured screen height
When there is a difference in expected vs. actual row count, the user
gets a confusing message about being unable to string concat a nil value
from screen:expect.

This assert makes it clear what the problem is rather than requiring
people to dig through the code of screen:expect to determine what
happened.
2017-01-18 11:24:34 -05:00
James McCoy
f2dff86493
inccommand: Preview :sub commands only after the delimiter is present
Closes #5888
2017-01-11 21:05:02 -05:00
James McCoy
dcd77c64ef
inccommand: Suppress error reporting when previewing commands
Closes #5912
2017-01-11 21:05:02 -05:00
Justin M. Keyes
e03b43bd07 test: skip_fragile(), TEST_SKIP_FRAGILE
Let build systems define TEST_SKIP_FRAGILE to skip tests that are known to be
resource-intensive (unreliable on slow systems).

References https://github.com/neovim/neovim/pull/5488#issuecomment-265622113
2017-01-04 04:24:18 +01:00
Justin M. Keyes
cb58999007 os/shell: do_os_system(): Always show last chunk.
This ameliorates use-cases like:
    :!cat foo.txt
    :make
where the user is interested in the last few lines of output.

Try these shell-based ex-commands before/after this commit:
    :grep -r '' *
    :make
    :!yes
    :!grep -r '' *
    :!git grep ''
    :!cat foo
    :!echo foo
    :!while true; do date; done
    :!for i in `seq 1 20000`; do echo XXXXXXXXXX $i; done

In all cases the last few lines of the command should always be shown,
regardless of where throttling was triggered.
2016-12-10 01:26:34 +01:00
Justin M. Keyes
97204e1cef os/shell: Throttle :! output, pulse "..." message.
Periodically skip :! spam. This is a "cheat" that works for all UIs and greatly
improves responsiveness when :! spams MB or GB of output:
    :!yes
    :!while true; do date; done
    :!git grep ''
    :grep -r '' *

After ~10KB of data is seen from a single :! invocation, output will be skipped
for ~1s and three dots "..." will pulse in the bottom-left. Thereafter the
behavior alternates at every:
    * 10KB received
    * ~1s throttled

This also avoids out-of-memory which could happen with large :! outputs.

Note: This commit does not change the behavior of execute(':!foo').
      execute(':!foo') returns the string ':!foo^M', it captures *only* Vim
      messages, *not* shell command output. Vim behaves the same way.
      Use system('foo') for capturing shell command output.

Closes #1234

Helped-by: oni-link <knil.ino@gmail.com>
2016-12-09 18:51:17 +01:00
Justin M. Keyes
a1b0f594ea test: Disable unreliable tests on travis+ASAN_UBSAN 2016-12-07 17:22:23 +01:00
chemzqm
3cf4b14e96 add cmdline mode to modechange of RPC and tests
use set_cursor_shape_bar for cmdline mode

fix test of screen_basic_spec.lua & screen.lua

comment fix
2016-11-30 22:20:06 +08:00
Björn Linse
4b95bb582d ui: add tests for ui_mode_change
Also fix snapshot_util() to work even if default_attr_ids is not a
proper lua array.
2016-11-25 11:37:23 +01:00
Justin M. Keyes
44e6ee930f build: Target luacheck HEAD.
https://github.com/mpeterv/luacheck/pull/81#issuecomment-261099606

> If you really want to use bleeding-edge version you should get the
> rockspec from master branch, not a fixed commit ...
> The correct way to install from a specific commit is cloning that
> commit and running "luarocks make" from project directory. The reason
> is that running "install" or "build" on an scm rockspec fetches
> sources from master but uses build description from the rockspec
> itself, which may be outdated.
2016-11-17 00:55:39 +01:00
Justin M. Keyes
35231312d7 'inccommand': Add tests. 2016-11-15 05:01:25 +01:00
Justin M. Keyes
708617ebb6 inccommand=nosplit: Jump to first match.
Call update_topline() to adjust the current viewport.

Closes #5597
2016-11-15 04:22:24 +01:00
Justin M. Keyes
ae9a3d3b99 'inccommand': Simplify cursor placement logic.
Remove the inner for-loop; just use the column of the first in-line
match.
2016-11-11 05:45:06 +01:00
Justin M. Keyes
795f2bb9b9 'inccommand': Restore cursor/view if cancelled.
Restore cursor position and window "view", if command is cancelled.
This is how 'incsearch' works.
2016-11-10 18:09:48 +01:00
Justin M. Keyes
2e1217da46 'inccommand': buftype=nofile, restore cursor/view
- Use a standard scratch buffer instead of a new 'buftype', functions
  like curbufIsChanged() already have special handling for scratch bufs.
- Cleanup some stuff from the previous merge.
- Add support for :smagic, :snomagic. Closes #5578
2016-11-10 15:48:00 +01:00
Justin M. Keyes
aa0e09d251 'inccommand': Preserve curbuf->b_u_newhead.
Add tests for undotree().

Helped-by: Björn Linse <bjorn.linse@gmail.com>

When "curhead" points to a valid head, the value of "newhead" is
meaningless (and really should be set to null). The undo state for
a buffer is _logically_ the enum:

  enum UndoState {
    CurrentHead(head),
    NewHead(head),
    EmptyTree
  }

nvim _represents_ this as: whenever `curbuf->b_u_curhead` is nonnull it
should be used as the current head, and `curbuf->b_u_newhead` is
ignored. If the there is a current head, then this will be redoed on the
next redo, and its parent will be undone on next undo. Only if
`b_u_curhead` is NULL, `b_u_newhead` will be used as the head to undo
(and it is not possible to redo). Also both can be NULL, to indicate an
empty undotree. (To be fair, this only strictly true when calling undo.c
from the outside, in some places _within_ a function in undo.c both
values might be meaningful)

Apparently `undotree()` breaks this non-abstraction, this _cosmetic_
issue can easily be fixed by `ex_substitute` also saving and restoring
`b_u_newhead`, but is doesn't reflect any error really how
`u_undo_and_forget` manipulates the _actual_ state of the undo tree.
2016-11-09 01:03:47 +01:00
Justin M. Keyes
f3e8ca3bf5 'inccommand': preserve 'modified'
During the live preview, the buffer-local 'modified' flag
should not be changed.
2016-11-08 21:22:24 +01:00
Justin M. Keyes
ff6ec703d5 'inccommand': Do not trigger during scripts, feedkeys(). 2016-11-08 21:22:24 +01:00
KillTheMule
527ba2b12a 'inccommand': test: scripts/feedkeys() should not trigger preview 2016-11-08 21:22:24 +01:00
Justin M. Keyes
6a3f8d48d0 'inccommand': rename 'incsubstitute'
'inccommand' allows us to expand the feature to other commands, such as:
    :cdo
    :cfdo
    :global

Also rename "IncSubstitute" highlight group to "Substitute".
2016-11-08 21:22:13 +01:00
Justin M. Keyes
1e0e301062 'inccommand': format line numbers as "|123| "
This matches what Quickfix traditionally does.
2016-11-08 21:21:46 +01:00
Justin M. Keyes
3ccf69c1de 'inccommand': set buffer name to [Preview]
[inc_sub] is less obvious for users. Also, in the future we may want to
generalize the idea of a "preview buffer", or "incremental commands"
besides :substitute.
2016-11-08 21:21:46 +01:00
Justin M. Keyes
d0689eb0b2 'inccommand': disable 'cursorline', 'spell' in preview 2016-11-08 21:21:43 +01:00
Justin M. Keyes
e31f9007e4 'inccommand': preserve b:changedtick 2016-11-08 21:21:00 +01:00