aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/normal.c
Commit message (Collapse)AuthorAge
* Merge remote-tracking branch 'origin/master' into lambdaJames McCoy2017-02-22
|\
| * *: Partial string handling refactoringZyX2017-02-15
| | | | | | | | | | | | | | | | Main points: - Replace `char_u` with `char` in some cases. - Remove `str[len] = NUL` hack in some cases when `str` may be considered `const`.
* | vim-patch:7.4.2090Michael Ennen2017-02-14
|/ | | | | | | | Problem: Using submatch() in a lambda passed to substitute() is verbose. Solution: Use a static list and pass it as an optional argument to the function. Fix memory leak. https://github.com/vim/vim/commit/df48fb456fb6bf63d94cad9b302ff01d8ee8d311
* lintJames McCoy2017-02-06
|
* vim-patch:8.0.0208James McCoy2017-02-06
| | | | | | | | | | | | Problem: Internally used commands for CTRL-Z and mouse click end up in history. (Matthew Malcomson) Solution: Use do_cmdline_cmd() instead of stuffing them in the readahead buffer. (James McCoy, closes vim/vim#1395) https://github.com/vim/vim/commit/25b0e6b701a7a8dfcb4f60e217360a5c75053d8c Closes #5966 Closes #5967
* coverity/133845: Negative array index read. (FP)Justin M. Keyes2017-01-23
| | | | | | | | `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.
* 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)
* vim-patch:7.4.1940 (#5849)lonerover2016-12-31
| | | | | | Problem: "gd" hangs in some situations. (Eric Biggers) Solution: Remove the SEARCH_START flag when looping. Add a test. https://github.com/vim/vim/commit/23c60f21b07b04351d846e6fbf4f4abd9aa09345
* vim-patch:7.4.1559Michael Ennen2016-12-12
| | | | | | | Problem: Passing cookie to a callback is clumsy. Solution: Change function() to take arguments and return a partial. https://github.com/vim/vim/commit/1735bc988c546cc962c5f94792815b4d7cb79710
* lintJames McCoy2016-12-02
|
* vim-patch:7.4.1748James McCoy2016-12-02
| | | | | | | | Problem: "gD" does not find match in first column of first line. (Gary Johnson) Solution: Accept match at the cursor. https://github.com/vim/vim/commit/1538fc34fae3fae39773ca43f6ff52401fce61d8
* folds: Do not auto-update folds for some foldmethods. #5426Shougo Matsushita2016-10-19
|
* event/multiqueue.c: Rename "queue" to "multiqueue".Justin M. Keyes2016-10-02
| | | | | | | | | | | | | | `lib/queue.h` implements a basic queue. `event/queue.c` implements a specialized data structure on top of lib/queue.h; it is not a "normal" queue. Rename the specialized multi-level queue implemented in event/queue.c to "multiqueue", to avoid confusion when reading the code. Before this change one can eventually notice that "macros (uppercase symbols) are for the normal queue, lowercase operations are for the multi-level queue", but that is unnecessary friction for new developers (or existing developers just visiting this part of the codebase).
* 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
* insert_enter: Update folds on insert-leave. #5351Shougo Matsushita2016-09-18
| | | | | Fixes failing test: 045_folding_spec.lua References #5299
* refactor: eliminate misc2.cJustin M. Keyes2016-09-13
| | | | | | | | | | move `call_shell` to misc1.c Move some fns to state.c Move some fns to option.c Move some fns to memline.c Move `vim_chdir*` fns to file_search.c Move some fns to new module, bytes.c Move some fns to fileio.c
* normal.c: Restore vim-like tab dragging. #4874sach1t2016-09-12
| | | | | Closes #4663 References #3310
* Merge #3745 from cacplate/ops_WconversionJustin M. Keyes2016-06-13
|\ | | | | Enable -Wconversion in ops.c
| * remove some asserts and lintCharles Joachim2016-05-30
| |
| * ops.c: enable -Wconversion warningCharles Joachim2016-05-30
| |
* | vim-patch:7.4.1150Michael Ennen2016-06-04
| | | | | | | | | | | | | | | | | | Problem: 'langmap' applies to the first character typed in Select mode. (David Watson) Solution: Check for SELECTMODE. (Christian Brabandt, closes #572) Add the 'x' flag to feedkeys(). https://github.com/vim/vim/commit/25281634cda03ce302aaf9f906a9520b5f81f91e
* | *: Rename main loop variable from loop to main_loopZyX2016-05-30
|/ | | | | | | | | | | | | | | | Current name is inappropriate for the following reasons: 1. It is often masked by local `loop` variables. 2. It cannot be searched for. There are many `loop` variables where `loop` is some local variable. There are many cases when “loop” word is used in a comment. 3. It is in any case bad idea to use a generic name as a name of the global variable. Best if global has module prefix: this is why it is in `main.h`: `main_loop` both stands for “a main loop” and “a loop defined in `main.*`”. Since I have no idea how to list every occurrence of this variable method used to rename it is “remove it from globals.h, try to compile, fix errors”. Thus if some occurrence was hidden under false `#if` branch it was not replaced.
* vim-patch:7.4.1513Jurica Bradaric2016-05-15
| | | | | | | Problem: "J" fails if there are not enough lines. (Christian Neukirchen) Solution: Reduce the count, only fail on the last line. https://github.com/vim/vim/commit/41e0f2f48f541eb2c8eb5620d3f1d270eb979154
* vim-patch:7.4.1042Jurica Bradaric2016-05-08
| | | | | | | | Problem: g-CTRL-G shows the word count, but there is no way to get the word count in a script. Solution: Add the wordcount() function. (Christian Brabandt) https://github.com/vim/vim/commit/ed767a2073ef150971b0439a58e7ee582af6984e
* *: Fix new linter errorsZyX2016-05-01
| | | | Originally there were 128 new errors, so I thought this is a good idea to fix all of them. Of course, this commit also fixes many suppressed errors.
* normal: convert MCHAR etc operator and register types to enum MotionTypeBjörn Linse2016-05-01
|
* Merge pull request #4632 from KillTheMule/vim-7.4.822Justin M. Keyes2016-04-25
|\ | | | | vim-patch:7.4.822
| * Linting.KillTheMule2016-04-23
| |
| * vim-patch:7.4.822KillTheMule2016-04-23
| | | | | | | | | | | | | | | | | | | | Problem: More problems reported by coverity. Solution: Avoid the warnings. (Christian Brabandt) https://github.com/vim/vim/commit/cde885473099296c4837de261833f48b24caf87c Applied manually. Files that do not exst anymore: gui.c gui_w16.c gui_w32.c if_xcmdsrv.c os_unix.c
* | mouse: Implement horizontal scroll. #3450bambu2016-04-25
|/ | | | | | | | | | - Code from Vim source. - Removed the check for 'guioptions' - mouse_spec.lua: test <ScrollWheelLeft> and <ScrollWheelRight> - Move horizontal scroll logic to mouse.c - Remove 'gui_' from the function names - Renamed variables to be more specific (as opposed to generic p, w). - Marked some functions as `static`
* *: Make set_vim_var_\* functions have proper argument typesZyX2016-04-18
|
* Merge pull request #4323 from watiko/vim-7.4.961Justin M. Keyes2016-03-02
|\ | | | | vim-patch:7.4.961
| * vim-patch:7.4.961watiko2016-02-23
| | | | | | | | | | | | | | Problem: Test107 fails in some circunstances. Solution: When using "zt", "zb" and "z=" recompute the fraction. https://github.com/vim/vim/commit/9dc2ce398bb3456cc8f590ef0260459798b34d2a
* | Merge #4231 'vim-patch:7.4.857'.Justin M. Keyes2016-03-02
|\ \ | |/ |/|
| * vim-patch:7.4.857Jurica Bradaric2016-02-10
| | | | | | | | | | | | | | Problem: Dragging the current tab with the mouse doesn't work properly. Solution: Take the current tabpage index into account. (Hirohito Higashi) https://github.com/vim/vim/commit/4a4b821085847651b71d8ad9fab9f180635cb453
* | Merge pull request #4234 from watiko/vim-7.4.977Justin M. Keyes2016-02-17
|\ \ | | | | | | vim-patch:7.4.{818,883,977}
| * | vim-patch:7.4.883watiko2016-02-11
| | | | | | | | | | | | | | | | | | | | | | | | Problem: Block-mode replace works characterwise instead of blockwise after column 147. (Issue #422) Solution: Set Visual mode. (Christian Brabandt) https://github.com/vim/vim/commit/10ad1d90da8c464e1bf08bf23d92d4888378a8a1
| * | vim-patch:7.4.818watiko2016-02-11
| |/ | | | | | | | | | | | | | | Problem: 'linebreak' breaks c% if the last Visual selection was block. (Chris Morganiser, Issue 389) Solution: Handle Visual block mode differently. (Christian Brabandt) https://github.com/vim/vim/commit/89c17c02cac7594c6bb85900d73b1dc70aa78306
* | vim-patch:7.4.929watiko2016-02-11
| | | | | | | | | | | | | | | | Problem: "gv" after paste selects one character less if 'selection' is "exclusive". Solution: Increment the end position. (Christian Brabandt) https://github.com/vim/vim/commit/d29c6fea94947b3f4b54fbd5a6f832a7d744bf27
* | vim-patch:7.4.734watiko2016-02-11
|/ | | | | | | | Problem: ml_get error when using "p" in a Visual selection in the last line. Solution: Change the behavior at the last line. (Yukihiro Nakadaira) https://github.com/vim/vim/commit/d009e8682686a56f7565e6e093a42cd0596e121f
* Merge pull request #4184 from watiko/vim-7.4.732Justin M. Keyes2016-02-09
|\ | | | | vim-patch:7.4.732
| * vim-patch:7.4.732watiko2016-02-07
| | | | | | | | | | | | | | Problem: The cursor line is not always updated for the "O" command. Solution: Reset the VALID_CROW flag. (Christian Brabandt) https://github.com/vim/vim/commit/d0d0fe09cf95bf88f643ec07d07939cbd41f8e63
* | vim-patch:7.4.798Jurica Bradaric2016-02-02
|/ | | | | | | | Problem: Repeating a change in Visual mode does not work as expected. (Urtica Dioica) Solution: Make redo in Visual mode work better. (Christian Brabandt) https://github.com/vim/vim/commit/31b259bf9571cae6408be3ef75d9485e24029be5
* tabline: Switch to functions, handle different click typesZyX2016-02-01
|
* tabline: Add %[] atom to the tabline, for random commands on clickZyX2016-02-01
| | | | Currently untested and undocumented.
* vim-patch:7.4.1089watiko2016-02-01
| | | | | | | Problem: Repeating CTRL-A doesn't work. Solution: Call prep_redo_cmd(). (Hirohito Higashi) https://github.com/vim/vim/commit/ef2b5036b3005f1ce15d146dce72379a9834c56d
* vim-patch:7.4.1087watiko2016-02-01
| | | | | | | | Problem: CTRL-A and CTRL-X do not work properly with blockwise visual selection if there is a mix of Tab and spaces. Solution: Add OP_NR_ADD and OP_NR_SUB. (Hirohito Higashi) https://github.com/vim/vim/commit/d79e55016cf8268cee935f1ac3b5b28712d1399e
* vim-patch:7.4.1084watiko2016-02-01
| | | | | | | | Problem: Using "." to repeat CTRL-A in Visual mode increments the wrong numbers. Solution: Append right size to the redo buffer. (Ozaki Kiichi) https://github.com/vim/vim/commit/e1edc1caba05c553fa60b1cf45a7670b1cfd63fe
* vim-patch:7.4.807watiko2016-02-01
| | | | | | | Problem: After CTRL-V CTRL-A mode isn't updated. (Hirohito Higashi) Solution: Clear the command line or update the displayed command. https://github.com/vim/vim/commit/0bbcb5c8efbfe5f1568f56b24ffd222d915916f6
* vim-patch:7.4.782watiko2016-02-01
| | | | | | | Problem: Still a few problems with CTRL-A and CTRL-X in Visual mode. Solution: Fix the reported problems. (Christian Brabandt) https://github.com/vim/vim/commit/5d1bc78a2b9fbe3e3112afcde7c80eb19d5989f4