aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/normal.c
Commit message (Collapse)AuthorAge
...
* 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
* vim-patch:7.4.765watiko2016-02-01
| | | | | | | Problem: CTRL-A and CTRL-X in Visual mode do not always work well. Solution: Improvements for increment and decrement. (Christian Brabandt) https://github.com/vim/vim/commit/9bb1930af908338b68588e988be9601ad144af07
* vim-patch:7.4.754watiko2016-02-01
| | | | | | | | Problem: Using CTRL-A in Visual mode does not work well. (Gary Johnson) Solution: Make it increment all numbers in the Visual area. (Christian Brabandt) https://github.com/vim/vim/commit/3a304b23823b089e499063e8211c5695d049f3ba
* vim-patch:7.4.753watiko2016-01-28
| | | | | | | | Problem: Appending in Visual mode with 'linebreak' set does not work properly. Also when 'selection' is "exclusive". (Ingo Karkat) Solution: Recalculate virtual columns. (Christian Brabandt) https://github.com/vim/vim/commit/74db34cc9162445e3d500ab2d61c5c19ce9af0ca
* fileio: Replace some event checking functions with one has_eventCharles Joachim2016-01-11
|
* normal: use oap->motion_type also to represent block motion typeBjörn Linse2016-01-01
| | | | | Previously oap->motion_type == MCHAR would be blockwise if oap->block_mode was set.
* Merge #3718 'vim-patch:7.4.655'Justin M. Keyes2015-12-13
|\
| * vim-patch:7.4.655Johan Klokkhammer Helsing2015-11-22
| | | | | | | | | | | | | | | | | | Problem: Text deleted by "dit" depends on indent of closing tag. (Jan Parthey) Solution: Do not adjust oap->end in do_pending_operator(). (Christian Brabandt) https://github.com/vim/vim/commit/b6c2735c56f1541159e1ad95c3f17a52b3a94f1d
* | src/*: Remove `VIM - Vi improved ...` headerMichael Reed2015-11-27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Regarding the individual items in the header: `Vim - Vi improved by Bram Moolenar` Bram Moolenar is already mentioned throughout the documentation, as well as the intro screen. `:help uganda` It's already shown to all users who don't use `shortmess+=I` upon starting nvim, and is already placed prominently in help.txt, i.e., `:help` run with no arguments. `:help credits` Already mentioned near the top of help.txt. `README.md` Already mentioned in develop.txt.
* | Remove unnecessary includes for errno.hRui Abreu Ferreira2015-11-25
| |
* | src: README.txt -> README.mdMichael Reed2015-11-23
|/ | | | | The former no longer exists in this repo; see the top of src/nvim/README.md.
* Implement handling of terminal focus eventsJoe Hermaszewski2015-11-17
| | | | | | | | | | | | | | | | | | | | Two new keys have been added to key_name_entry in keymap.c: `FocusGained` and `FocusLost`. Two cases have been added to the key handing switch in edit.c each applying their respective autocmds. In normal.c two functions have been added alongside nv_cursorhold doing a similar job of applying the autocmd for the appropriate key. tui/input.c has a new function `handle_focus_event` which eats either of the control sequences for focus gained or lost. This function is checked before handle_bracketed_paste and handle_forced_escape. tui.c registers neovim as able to receive these control sequences in terminfo_start and undoes that in terminfo_stop. Closes #2302
* normal.c: No garbage collection while handling an event in normal modeoni-link2015-11-13
| | | | | | Patch by @tarruda Fixes #3588
* vim-patch:7.4.686 #3629Johan Klokkhammer Helsing2015-11-08
| | | | | | | | Problem: "zr" and "zm" do not take a count. Solution: Implement the count, restrict the fold level to the maximum nesting depth. (Marcin Szamotulski) https://github.com/vim/vim/commit/7d2757a47204d00cd47e3db94f1bd248c499d4e3
* normal: Extract some functions from `normal_finish_command`Thiago de Arruda2015-10-26
| | | | | - `normal_need_redraw_mode_message` - `normal_redraw_mode_message`
* normal: Extract `normal_finish_command` from `normal_execute`Thiago de Arruda2015-10-26
|
* normal: Extract `normal_get_command_count` from `normal_execute`Thiago de Arruda2015-10-26
|
* normal: Extract some functions from `normal_execute`Thiago de Arruda2015-10-26
| | | | | | | - `normal_handle_special_visual_command` - `normal_need_aditional_char` - `normal_get_additional_char` - `normal_invert_horizontal`
* normal: Split `normal_check` into multiple functionsThiago de Arruda2015-10-26
| | | | | | | | | | | Split most code in `normal_check` in: - `normal_check_stuff_buffer` - `normal_check_interrupt` - `normal_check_cursor_moved` - `normal_check_text_changed` - `normal_check_folds` - `normal_redraw`
* main: Start modeling Nvim as pushdown automatonThiago de Arruda2015-10-26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | From a very high level point of view, Vim/Nvim can be described as state machines following these instructions in a loop: - Read user input - Peform some action. The action is determined by the current state and can switch states. - Possibly display some feedback to the user. This is not immediately visible because these instructions spread across dozens of nested loops and function calls, making it very hard to modify the state machine(to support more event types, for example). So far, the approach Nvim has taken to allow more events is this: - At the very core function that blocks for input, poll for arbitrary events. - If the event received from the OS is user input, just return it normally to the callers. - If the event is not direct result of user input(possibly a vimscript function call coming from a msgpack-rpc socket or a job control callback), return a special key code(`K_EVENT`) that is handled by callers where it is safer to perform arbitrary actions. One problem with this approach is that the `K_EVENT` signal is being sent across multiple states that may be unaware of it. This was partially fixed with the `input_enable_events`/`input_disable_events` functions, which were added as a mechanism that the upper layers can use to tell the core input functions that it is ready to accept `K_EVENT`. Another problem is that the mapping engine is implemented in getchar.c which is called from every state, but the mapping engine is not aware of `K_EVENT` so events can break mappings. While it is theoretically possible to modify getchar.c to make it aware of `K_EVENT`, this commit fixes the problem with a different approach: Model Nvim as a pushdown automaton(https://en.wikipedia.org/wiki/Pushdown_automaton). This design has many advantages which include: - Decoupling the event loop from the states reponsible for handling events. - Better control of state transition with less dependency on global variable hacks(eg: 'restart_edit' global variable). - Easier removal of global variables and function splitting. That is because many variables are for state-specific information, and probably ended up being global to simplify communication between functions, which we fix by storing state-specific information in specialized structures. The final goal is to let Nvim have a single top-level event loop represented by the following pseudo-code: ``` while not quitting let event = read_event current_state(event) update_screen() ``` This closely mirrors the state machine description above and makes it easier to understand, extend and debug the program. Note that while the pseudo code suggests an explicit stack of states that doesn't rely on return addresses(as suggested by the principles of automata-based programming: https://en.wikipedia.org/wiki/Automata-based_programming), for now we'll use the call stack as a structure to manage state transitioning as it would be very difficult to refactor Nvim to use an explicit stack of states, and the benefits would be small. While this change may seem like an endless amount of work, it is possible to do it incrementally as was shown in the previous commits. The general procedure is: 1- Find a blocking `vgetc()`(or derivatives) call. This call represents an implicit state of the program. 2- Split the code before and after the `vgetc()` call into functions that match the signature of `state_check_callback` and `state_execute_callback. Only `state_execute_callback` is required. 3- Create a `VimState` "subclass" and a initializer function that sets the function pointers and performs any other required initialization steps. If the state has no local variables, just use `VimState` without subclassing. 4- Instead of calling the original function containing the `vgetc()`, initialize a stack-allocated `VimState` subclass, then call `state_enter` to begin processing events in the state. 5- The check/execute callbacks can return 1 to continue normally, 0 to break the loop or -1 to skip to the next iteration. These callbacks contain code that execute before and after the old `vgetc()` call. The functions created in step 2 may contain other `vgetc()` calls. These represent implicit sub-states of the current state, but it is fine to remove them later in smaller steps since we didn't break compatibility with existing code.
* main: Refactor normal_enter to call `os_inchar` directlyThiago de Arruda2015-10-26
| | | | | | | | | This makes it impossible for K_EVENT to interfere with mappings, but it also disables processing of events while in the middle of a mapping (Though this will be fixed later as this refactoring progresses). `may_sync_undo` is now called when K_EVENT is received. This is necessary to correctly update undo entry lists before executing some action.
* main: Call `normal_execute` from `normal_enter`Thiago de Arruda2015-10-26
| | | | | | | | | | `normal_prepare` is now called by `normal_check` before returning 1(to continue). Also remove `input_{enable,disable}_events` calls from `normal_cmd`, which only exists now as a compatibility function to run normal commands with keys inserted into the typeahead buffer(We don't want to process events in these cases anyway).
* input: Remove CURSORHOLD keyThiago de Arruda2015-10-26
| | | | | | | | | | | Refactor input.c, normal.c and edit.c to use the K_EVENT special key to trigger the CURSORHOLD event. In normal and edit mode, K_EVENT is treated as K_CURSORHOLD, which enables better handling of arbitrary actions in those states(eg: In normal mode the previous operator counts will be restored). Also fix a test in vim_spec.lua. The test had a wrong assumption: cmdheight is only used to determine when the press enter screen will be shown, not to limit how many lines or control pagination.
* normal: Fix code style in `normal_prepare` and `normal_execute`Thiago de Arruda2015-10-26
| | | | | This was done separately to make it easier to follow the changes in the previous commit.
* normal: Extract most `normal_cmd` logic into two functionsThiago de Arruda2015-10-26
| | | | | The new functions are `normal_prepare` and `normal_execute` which contain code executed before and after input is received in normal mode.
* main: Extract `normal_check` from `main_loop`Thiago de Arruda2015-10-26
| | | | | | The new function contains logic that must be executed after handling input in normal mode and also before the first main loop iteration. Also rename `main_loop` to `normal_enter` and move it to normal.c
* vim-patch:7.4.793Johan Klokkhammer Helsing2015-10-18
| | | | | | | Problem: Can't specify when not to ring the bell. Solution: Add the 'belloff' option. (Christian Brabandt) https://github.com/vim/vim/commit/165bc69d1b7f70ca9d5b657f35d0584ecb7b5183