aboutsummaryrefslogtreecommitdiff
path: root/test/functional/normal
Commit message (Collapse)AuthorAge
* test: reorg #15698Justin M. Keyes2021-09-17
| | | | | | | | | | | | | | | | | | | | Problem: Subdirectories like "visual", "insert", "normal" encourage people to separate *related* tests for no good reason. Typically the _mode_ is not the relevant topic of a test (and when it is, _then_ create an appropriate describe() or it()). Solution: - Delete the various `test/functional/<mode>/` subdirectories, move their tests to more meaningful topics. - Rename `…/normal/` to `…/editor/`. - Move or merge `…/visual/*` and `…/insert/*` tests into here where appropriate. - Rename `…/eval/` to `…/vimscript/`. - Move `…/viml/*` into here also. * test(reorg): insert/* => editor/mode_insert_spec.lua * test(reorg): cmdline/* => editor/mode_cmdline_spec.lua * test(reorg): eval core tests => eval_spec.lua
* feat(keywordprg): use :terminal for external commands #15398Gregory Anders2021-08-21
| | | | | | | Open external 'keywordprg' commands in a :terminal in a new tab. <Esc> is mapped to stop the job and close the buffer. Closes #2995 Closes #2761
* Treat unmapped ALT/META as ESC+c in all modesMatt Wozniski2020-10-05
| | | | | | | | In #8226 <A-x> and <M-x> were changed to behave like <Esc>x in insert mode when no mapping exists. This commit backs out that change and replaces it with a more general one that makes unmapped ALT and META keypresses as <Esc>+char in all modes. This fixes an unnecessary and confusing inconsistency between modes.
* lua: move test helper function, map and filter, to vim.shared moduleHirokazu Hata2020-02-18
|
* vim-patch:8.1.0974: cannot switch from terminal window to previous tabpageWe're Yet2020-01-03
| | | | | | Problem: Cannot switch from terminal window to previous tabpage. Solution: Make CTRL-W gT move to previous tabpage. https://github.com/vim/vim/commit/882d02eeb571a13a502fe82a04c9eaffa630c294
* vim-patch:8.1.0972: cannot switch from terminal window to next tabpageWe're Yet2020-01-03
| | | | | | Problem: Cannot switch from terminal window to next tabpage. Solution: Make CTRL-W gt move to next tabpage. https://github.com/vim/vim/commit/72e83c1ae535e2ebc35b114d34d0a811eb62b068
* doc [ci skip]Justin M. Keyes2019-12-31
|
* jumplist: browser-style (or 'tagstack') navigation #11530butwerenotthereyet2019-12-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Traditionally, when navigating to a specific location from the middle of the jumplist results in shifting the current location to the bottom of the list and adding the new location after it. This behavior is not desireable to all users--see, for example https://vi.stackexchange.com/questions/18344/how-to-change-jumplist-behavior. Here, another jumplist behavior is introduced. When jumpoptions (a new option set added here) includes stack, the jumplist behaves like the tagstack or like history in a web browser. That is, when navigating to a location from the middle of the jumplist 2 first 1 second 0 third <-- current location 1 fourth 2 fifth to a new location the locations after the current location in the jump list are discarded 2 first 1 second 0 third <-- current location The result is that when moving forward from that location, the new location will be appended to the jumplist: 3 first 2 second 1 third 0 new If the new location is the same new == second as some previous (but not immediately prior) entry in the jumplist, 2 first 1 second 0 third <-- current location 1 fourth 2 fifth both occurrences preserved 3 first 2 second 1 third 0 second (new) when moving forward from that location. It would be desireable to go farther and, when the new location is the same as the location that is currently next in the jumplist, new == fourth make the result of navigating to the new location by jumping (e.g. 50gg) be the same as moving forward in the jumplist 2 first 1 second 0 third 1 new <-- current location 2 fifth and simply increment the jumplist index. That change is NOT part of this patch because it would require passing the new cursor location to the function (setpcmark) from all of its callees. That in turn would require those callees to know *before* calling what the new cursor location is, which do they do not currently.
* doc + extmarks tweaks #11421Justin M. Keyes2019-11-25
| | | | - nvim_buf_get_extmarks: rename "amount" => "limit" - rename `set_extmark_index_from_obj`
* test: Eliminate expect_errJustin M. Keyes2019-09-06
| | | | Eliminate `expect_err` in favor of `pcall_err` + `eq` or `matches`.
* Merge #10596 'vim-patch:8.1.{899,903,905,907,908,910,913,1746}'Justin M. Keyes2019-07-25
| | | | | close #9930 close #10051
* build: update some test dependencies (#10339)Daniel Hahler2019-06-29
| | | | | | | | | | * build: update some test dependencies * luacheck ignores * BuildLua: add ${BUSTED} to depends for ${BUSTED_LUA} This is required to rebuild it when busted gets updated.
* jumplist: avoid extra tail entry #9805Abdelhakeem Osama2019-04-02
| | | fixes #9775
* tests: improve robustness of immediate successes in screen testsBjörn Linse2018-10-15
|
* Add some basic tests for macrosMatthew Malcomson2018-03-14
|
* Add some tests for 'langmap'Matthew Malcomson2018-01-27
|
* test: enable K_spec tests in WindowsJan Edmund Lazo2018-01-03
|
* fold: foldMoveRange(): fix :move bug #6534Matthew Malcomson2017-04-17
| | | | | | | | | | | | Closes #6540 In #6221 there was a mistake in calculating which folds need to be re-ordered. When there are no folds after those that have been adjusted, then `move_end` remains 0. This results in reverse_fold_order() swapping folds that have been adjusted with uninitialised folds in the remainder of the grow array. Add a check in foldMoveRange() to account for this case.
* ci: install Turkish locale and make locale tests more reliableBjörn Linse2017-04-11
|
* test: helpers.execute() => helpers.feed_command()Justin M. Keyes2017-04-11
|
* test: add tests for gu/gU behavior in Turkish localeBjörn Linse2017-04-10
|
* functests: Replace execute with either command or feed_commandZyX2017-04-09
| | | | | | | | | | 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.
* fold.c: more edge-cases when updating (#6207)Matthew Malcomson2017-03-31
| | | | | | | | | | | | | | | | When foldUpdateIEMSRecurse() re-uses an existing fold, it misses the case where the existing fold spans from before startlnum to after firstlnum, the new fold does not span this range, and there is no "forced start" of a fold. We add a case for this in. Ensure that if there was no forced break in folds, we merge folds that now touch each other. Include testing for a tricky foldmethod=expr case that has never been a bug. This case works at the moment because of some effects that are not obvious when reading the code. A test for this could be useful to ensure a regression doesn't happen. vim-patch:8.0.0408
* Robustly handle folds during a :move commandMatthew Malcomson2017-03-23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In order to re-order marks according to the :move command, do_move() uses mark_adjust() in a non-standard manner. The non-standard action is that it moves some marks *past* other marks. This doesn't matter for marks, but mark_adjust() calls foldMarkAdjust() which simply changes fold starts and lengths and doesn't have enough information to know that other folds have to be checked and reordered. The array of folds for each window are assumed to be in order of increasing line number, and if this gets broken some folds can get "lost". There has been a previous patch to avoid this problem by deleting and recalculating all folds in the window, but this comes at the cost of closing all folds when executing :move, and doesn't cover the case of manual folds. This patch adds a new function foldMoveRange() specifically for the :move command that handles reordering folds as well as simply moving them. Additionally, we allow calling mark_adjust_nofold() that does the same as mark_adjust() but doesn't affect any fold array. Calling mark_adjust_nofold() should be done in the same manner as calling mark_adjust(), but according changes to the fold arrays must be done seperately by the calling function. vim-patch:8.0.0457 vim-patch:8.0.0459 vim-patch:8.0.0461 vim-patch:8.0.0465
* test/put_spec: 2x speedup (#6294)Matthew Malcomson2017-03-18
| | | | Instead of helpers.clear() between each test, use execute('enew!') and ensure the state that matters is reset between each test.
* vim-patch:8.0.0388Matthew Malcomson2017-03-02
| | | | | | | | | | | | | | | | 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.
* undo: :earlier, g-: Set b_u_seq_cur correctly. (#6016)Matthew Malcomson2017-01-31
| | | | | | | | | | | | | | | | | | | 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.
* put fixup, esp. ". register close #5709 #5781Matthew Malcomson2017-01-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Note some bugs were judged to have too ugly a fix to solve, tests to demonstrate these problems, and the explanation behind not fixing them are below. describe('register . problems', function() before_each(reset) -- The difficulty here is: The basic requirement is that the text -- inserted is treated as if it were typed in insert mode. This is why -- the paste method is to enter insert mode and enter the ". register -- into readbuf1. -- We can't add a count into the readbuf here because the insert mode -- count is implemented with readbuf2 which is checked for characters -- after readbuf1. -- Hence, the ".gp command (which adds extra characters into readbuf1 -- to emulate leaving the cursor after the text by moving the cursor -- after inserting the text) would insert the motion characters into -- the buffer instead of using them to move after the insert has been -- done. -- I could probably get this working properly with a special flag put -- into start_redo_ins() and set in do_put(), but I think this adds -- much more complexity than fixing this bug justifies. pending('should not change the ". register with ".2p', function() local orig_register = funcs.getreg('.') feed('2".p') eq(orig_register, funcs.getreg('.')) end) describe("cursor positioning after undo and redo with '.'", function() before_each(reset) local function make_cursor_test(macro_string) return function() feed(macro_string) local afterpos = funcs.getcurpos() local orig_string = curbuf_contents() feed('u.') eq(afterpos, funcs.getcurpos()) expect(orig_string) end end -- The difficulty here is: setting the cursor after the end of the -- pasted text is done by adding a motion command to the -- stuffbuffer after the insert. -- Modifying 'redobuff' is done in the code that handles inserting -- text and moving around. -- I could add a special case in ins_esc() that checks for a flag -- set in do_put() to add the motion character to the redo buffer, -- but I think that is starting to get way too convoluted for the -- benefit. pending('should be the same after ".gp and ".gpu.', make_cursor_test('".gp')) -- The difficulty here is: putting forwards is implemented by using -- 'a' instead of 'i' to start insert. -- Undoing with 'u' an insert that began with 'a' leaves the cursor -- where the first character was inserted, not where the cursor was -- when the 'a' was pressed. -- We account for this the first time by saving the cursor position -- in do_put(), but this isn't stored in redobuff for a second time -- around. -- We can't change how such a fundamental action as undo after -- inserting with 'a' behaves, we could add in a special case -- whereby we set a flag in do_put() and read it when entering -- insert mode but this seems like way too much to fix such a minor -- bug. pending('should be the same after ".pu. and ".pu.u.', make_cursor_test('".pu.')) end) end)
* Correct logic for setting NormalState.toplevelJames McCoy2016-09-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Vim's main_loop function, the main loop is while (!cmdwin #ifdef FEAT_CMDWIN || cmdwin_result == 0 #endif ) { ... #ifdef FEAT_EVAL /* * May perform garbage collection when waiting for a character, but * only at the very toplevel. Otherwise we may be using a List or * Dict internally somewhere. * "may_garbage_collect" is reset in vgetc() which is invoked through * do_exmode() and normal_cmd(). */ may_garbage_collect = (!cmdwin && !noexmode); #endif /* * If we're invoked as ex, do a round of ex commands. * Otherwise, get and execute a normal mode command. */ if (exmode_active) { if (noexmode) /* End of ":global/path/visual" commands */ return; do_exmode(exmode_active == EXMODE_VIM); } else normal_cmd(&oa, TRUE); } cmdwin_result is set to 0 before calling main_loop to handle the cmdwin window and gets changed when the user causes a command to execute (either through pressing <CR> or <C-c>). This means that when the cmdwin isn't active OR the user is still editing their command, main_loop runs and main_loop calls normal_cmd with toplevel true as long as exmode isn't active. When the normal mode state was extracted in dae006a9, the conditions for toplevel and may_garbage_collect were combined. Since toplevel was set to always ignore cmdwin, the v:count(1) variables were no longer being updated when a command was prefixed with a count in the cmdwin. Closes #5404
* Mark some functional tests as pending in WindowsRui Abreu Ferreira2016-08-26
|
* functests: Check logs in lua codeZyX2016-06-10
| | | | | | It is otherwise impossible to determine which test failed sanitizer/valgrind check. test/functional/helpers.lua module return was changed so that tests which do not provide after_each function to get new check will automatically fail.
* test/functional: clean up according to luacheck (part 1)Marco Hinz2015-11-23
|
* test: K, 'keywordprg'Justin M. Keyes2015-09-23