Commit Graph

1315 Commits

Author SHA1 Message Date
oni-link
3030ef825d terminal.c: Reset cursor postion when using termopen() (#6212)
After using 'termopen("echo") the current buffer content is changed,
but the cursor position of the current window is not updated.
Because of this, a call to 'mb_adjust_cursor()'  can lead to a
heap-buffer-overflow.

Fix this by resetting the cursor for the current window.

Fixes #3161
2017-03-04 20:12:57 +01:00
Matthew Malcomson
b1731fe1b5 vim-patch:8.0.0388
Fix a problem when filtering manually folded lines

When foldMarkAdjustRecurse() is called to adjust folds that start inside
the range of lines that are being moved and end outside that range, it
calculates `amount_after` for its recursive call incorrectly.
The calculation assumes that folds inside the changed range are being
deleted, but this is not always the case.

This means nested folds that start after the changed range of lines are
shifted an incorrect amount.

We fix this by calculating the `amount_after` differently if the folds
inside the changed range are not being deleted.
2017-03-02 00:18:00 +01:00
Justin M. Keyes
4306e5ae0c test: luacheck update
We pull luacheck HEAD, so this is a "catch up" commit to fix
newly-discovered errors.
2017-03-01 14:47:49 +01: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
Justin M. Keyes
2872e57af2 Merge #6191 from jamessan/vim-42ebd06
vim-patch:42ebd06,7.4.2098,6f1d9a0,7.4.2095
2017-02-28 09:57:46 +01:00
Matthieu Coudron
5ed753044d test: Refactor fold tests (#5993) 2017-02-28 09:34:02 +01:00
James McCoy
adc6e636fe
vim-patch:7.4.2095
Problem:    Man test fails when run with the GUI.
Solution:   Adjust for different behavior of GUI.  Add assert_inrange().

61c04493b0

Only changes related to assert_inrange() were included, since we have a
distinct man plugin.
2017-02-27 21:40:16 -05:00
Matthew Malcomson
86c2adc074 edit.c: CTRL-SPC: Insert previously-inserted text. #6090
Default Vim behavior of i_CTRL-<Space> is to insert the last-inserted
text and exit insert mode. :help i_CTRL-@

Before this commit that did not happen because insert_handle_key()
checks for NUL instead of checking for ' ' with a CTRL `mod_mask`.

I'm leaving the check for NUL despite the fact that at the moment that
key is never seen when using the terminal UI (not for C-Space, nor C-@).
This is because I assume it's still allowed for other front-ends to pass
NUL, but at the moment the terminal UI isn't.
2017-02-28 01:16:18 +01:00
James McCoy
c9c3f92b49 vim-patch:7.4.2200
Problem:    Cannot get all information about a quickfix list.
Solution:   Add an optional argument to get/set loc/qf list(). (Yegappan
            Lakshmanan)

d823fa910c
2017-02-27 11:39:41 -05:00
Justin M. Keyes
c318d8e672 Merge #6112 from ZyX-I/split-eval'/buf_get_changedtick
Better b:changedtick support
2017-02-27 10:29:46 +01:00
Justin M. Keyes
8c8ce1832e Merge #6111 from ZyX-I/split-eval'/os-fileio
Refactor writefile() and create more tests for it
2017-02-27 10:20:25 +01:00
Justin M. Keyes
152921837e test: screen_setup(): Detect spawn failures, usage errors. 2017-02-26 13:00:01 +01:00
Justin M. Keyes
d90e5f5260 test: screen_setup(): Support cols parameter. 2017-02-26 13:00:01 +01:00
Justin M. Keyes
9dbda59715 test/window_split_tab_spec.lua: fixup
Make the test work after the "follows cursor" changes.
This "auto-resize" feature is going away soon, anyways.
2017-02-26 13:00:01 +01:00
Justin M. Keyes
4ceec30cd0 terminal: Follow output only if cursor is at end.
Closes #2257
Closes #2636
References #2683
2017-02-26 13:00:01 +01:00
Justin M. Keyes
e7bbd35c81 terminal: 'scrollback'
Closes #2637
2017-02-26 11:57:52 +01:00
Tommy Allen
7ea81fe443 terminal: Don't redraw the entire screen when resizing (#6167) 2017-02-26 10:21:44 +01:00
ZyX
77ebe85be6 buffer: Hide one of the asserts from lua parser 2017-02-25 00:22:46 +03:00
ZyX
9c1865c7f8 *: Fix linter errors 2017-02-23 19:48:41 +03:00
ZyX
858ac9d8e5 api: Make sure dict_set_var doesn’t edit read-only values
Fixes #6147
2017-02-23 19:48:41 +03:00
ZyX
6550caee50 functests: Destroy accidental folds in api/vim_spec 2017-02-23 19:48:41 +03:00
ZyX
d8a7e5fdbb eval: Forbid (un)locking b:changedtick
Port of vim-patch:8.0.0343
2017-02-23 19:48:41 +03:00
ZyX
9668d26a43 eval: Make sure islocked('b:.changedtick') does not error out
Port of vim-patch:8.0.0345
2017-02-23 19:48:41 +03:00
ZyX
9972db79c8 eval: Specify more precise len for var_check_ro in get_lval 2017-02-23 19:46:45 +03:00
ZyX
d820daf076 functests: Add some more tests 2017-02-23 19:46:45 +03:00
ZyX
3277eff31a buffer: Forbid unletting b:changedtick 2017-02-23 19:46:45 +03:00
ZyX
e2fbbb292f eval: Refactor item_lock
If I am not mistaking, this commit should not change any functionality.
2017-02-23 19:46:45 +03:00
ZyX
f2c9fd312c eval: Make sure that b:changedtick may not be unlocked via :unlo b:var
It still may be unlocked by `:unlock b:.var`.
2017-02-23 19:46:44 +03:00
ZyX
908e53d98d functests: Add tests
Contains a number of FIXMEs.
2017-02-23 19:46:44 +03:00
ZyX
4f10d42f82 buffer: Bind b:changedtick to b:['changedtick'], remove special cases 2017-02-23 19:46:44 +03:00
ZyX
0eab7ac4b9 api/buffer: Add nvim_buf_get_changedtick method 2017-02-23 19:46:44 +03:00
James McCoy
d4dd447ded
win: test: Fix closure jobs test on Windows 2017-02-23 01:24:55 -05:00
James McCoy
bc76ce2c4f
Merge remote-tracking branch 'origin/master' into lambda 2017-02-22 19:23:20 -05:00
Justin M. Keyes
22337b1c01 Merge #6137 from justinmk/cmdline-ctrl-r
cmdline: CTRL-R: Omit trailing ^M character
2017-02-19 14:20:52 +01:00
Justin M. Keyes
baab49ee89 cmdline: CTRL-R: Omit trailing <CR>.
The "technically correct" interpretation is to execute the first line
that is seen (and this is what happens on middle-click paste in Vim).
^M is only intended to "defuse" the newline, so the user can review it.

The parent commit changed the behavior to insert <Space> between lines,
but that's a higher-risk change: it is arguably possible that some user
*wants* the literal ^M chars when e.g. assigning to a register:
    :let @a='<C-R>b'

To avoid that risk, keep the old behavior and only omit the last ^M.
This makes `yy:<C-R>0` nicer at no cost.
2017-02-18 23:24:35 +01:00
Justin M. Keyes
308ccb6f5e cmdline: CTRL-R: <Space> instead of CR between lines.
^M isn't any more "correct" than space: the "technically correct"
interpretation is to execute the first line that is seen (and this is
what happens on middle-click paste in Vim). ^M is only intended to
defuse the newline, so that the user can review the command. We can do
that with a space instead, and then the command can be executed without
having to fix it up first.
2017-02-18 14:49:05 +01:00
Kurt Bonatz
b0bbe82a60 eval.c: has("unnamedplus"). (#6136)
Return 1 for UNIX  with a functioning clipboard provider.

Closes #6103
2017-02-18 14:04:46 +01:00
Justin M. Keyes
706b01ba79 Merge #6114 'Partial string handling refactoring'. 2017-02-17 02:08:21 +01:00
Kurt Bonatz
0e44916fff ex_docmd.c: Allow unescaped spaces in :edit filename (#6119)
This makes :edit consistent on all platforms. 
Also affects :argedit, et al. Wild (tab) completion doesn't work, though.

Closes #6010
2017-02-15 11:12:31 +01:00
Michael Ennen
ef8701610b Allow lambdas to be used with jobs, timers and dictwatchers. 2017-02-14 17:38:19 -07:00
Nikolai Aleksandrovich Pavlov
64c375c589 unittest: Filter out standard defines so that they do not spam stderr (#6113) 2017-02-15 01:21:06 +01:00
ZyX
efa2682e3b *: Partial string handling refactoring
Main points:

- Replace `char_u` with `char` in some cases.
- Remove `str[len] = NUL` hack in some cases when `str` may be considered
  `const`.
2017-02-15 02:48:33 +03:00
ZyX
f489827b5f eval: Fix error messages from writefile
1. When calling writefile(list, fname, []) do not show error message twice.
2. Do not allow file name to be overwritten for writefile([1], 2).
3. Do not show “Can’t open file with an empty name” error after error like 
   “using Float as a String” when type of the second argument is not correct.
4. Do not give multiple error messages and still continue for code like 
   `writefile(["test", [], [], [], "tset"])`.

Note that to fix 4. ideally I need tv_check_str_or_nr which is currently present 
in two PRs: #6114 and #5119. I would want to avoid copying this function into 
a yet another PR.

Ref vim/vim#1476.
2017-02-14 20:46:12 +03:00
ZyX
fe0eecf9cc eval: writefile: Give more adequate IO errors and do not call putc() 2017-02-14 01:10:31 +03:00
ZyX
943531cf9e ci: Make sure core* is the last component of path 2017-02-14 00:33:52 +03:00
ZyX
d670591887 ci: Better core dump checking
- Do not exclude any directories from `find` search, remove dumps before tests
  instead.
- Install `apport` on travis so that linux tests should produce core dumps
  (based on information from travis-ci/travis-ci#3754, not sure whether it still
  applies).
- Check cores in lua so that one has an idea which test is failing exactly. Do
  this only 10% of time on linux because traversing the file system is slow.

Unit tests are still not touched, though it is what `app` argument in
`check_cores` is for.

TODO? consider using `find`, it may be faster. Consider retiring `os.execute`,
      dealing with escaping is bad.
2017-02-14 00:33:52 +03:00
Justin M. Keyes
30826cb2d6 build: oldtest target: TEST_FILE, NVIM_PRG (#6098)
- Add support for TEST_FILE to the `oldtest` target, for consistency
  with the busted/lua tests.
  Caveat: with the busted/lua tests TEST_FILE takes a full path, whereas
  for `oldtest` it must be "test_foo.res".
- Add support for NVIM_PRG, again so that all test-related targets are
  consistent.
- Use consistent name for NVIM_PRG. But still need to support NVIM_PROG
  for QuickBuild CI.

Note: The `oldtest` target is driven by the top-level Makefile, because
it requires a TTY. CMake 3.2 added a USES_TERMINAL flag to
add_custom_target(). But we support CMake 2.8...

    add_custom_target(oldtest
      COMMAND make clean
      COMMAND make NVIM_PRG=$<TARGET_FILE:nvim> $ENV{MAKEOVERRIDES}
      DEPENDS nvim
      WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/nvim/testdir"
      USES_TERMINAL true
    )
2017-02-12 01:02:54 +01:00
Nikolai Aleksandrovich Pavlov
abdbfd26bc eval: Add id() function and make printf("%p") return something useful (#6095) 2017-02-11 19:47:02 +01:00
Justin M. Keyes
18127f64c4 test: executable(): AppVeyor: Ignore "sibling" failure
This test sometimes fails on AppVeyor, but we still want to exercise the
code path and get at least a "soft" notification in the pending list.
2017-02-04 11:07:50 +01:00
Justin M. Keyes
67fbbdb1b5 win: executable(): full path without extension
Absolute path is considered executable even *without* an extension.
2017-02-04 11:07:50 +01:00