aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/mark.c
Commit message (Collapse)AuthorAge
* refactor: remove some unused includes (#19747)zeertzjq2022-08-13
| | | | | - Remove autocmd.h from fileio.h - Remove normal.h from main.h - Move bufinfo_T from undo_defs.h to undo.c
* refactor: use CLEAR_FIELD and CLEAR_POINTER macros (#19709)zeertzjq2022-08-11
| | | | | | | vim-patch:8.2.0559: clearing a struct is verbose Problem: Clearing a struct is verbose. Solution: Define and use CLEAR_FIELD() and CLEAR_POINTER(). https://github.com/vim/vim/commit/a80faa8930ed5a554beeb2727762538873135e83
* refactor: fix clang and PVS warnings (#19532)zeertzjq2022-07-28
|
* fix(mark): give correct error message when mark is in another buffer (#19454)zeertzjq2022-07-21
|
* fix(mark): fix unexpected cursor movements (#19253)zeertzjq2022-07-06
|
* fix(mark): mark without a view restores at topline #19224zeertzjq2022-07-04
| | | | | For a local mark without a view, currently trying to restore its view will put the cursor at topline, which is not the correct behavior. Initialize `topline_offset` to `MAXLNUM` instead to fix this.
* fix(coverity): 353827 unnecessary null check #19209Javier Lopez2022-07-02
| | | | Previous checks make sure the index is not out of bounds. Therefore jmp is never NULL.
* refactor: replace char_uDundar Goc2022-07-02
| | | | Work on https://github.com/neovim/neovim/issues/459
* fix(mark): set mark fnum from buffer (#19195)Gregory Anders2022-07-01
|
* feat(marks): restore viewport on jump #15831Javier Lopez2022-06-30
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | ** Refactor Previously most functions used to "get" a mark returned a position, changed the line number and sometimes changed even the current buffer. Now functions return a {x}fmark_T making calling context aware whether the mark is in another buffer without arcane casting. A new function is provided for switching to the mark buffer and returning a flag style Enum to convey what happen in the movement. If the cursor changed, line, columns, if it changed buffer, etc. The function to get named mark was split into multiple functions. - mark_get() -> fmark_T - mark_get_global() -> xfmark_T - mark_get_local() -> fmark_T - mark_get_motion() -> fmark_T - mark_get_visual() -> fmark_T Functions that manage the changelist and jumplist were also modified to return mark types. - get_jumplist -> fmark_T - get_changelist -> fmark_T The refactor is also seen mainly on normal.c, where all the mark movement has been siphoned through one function nv_gomark, while the other functions handle getting the mark and setting their movement flags. To handle whether context marks should be left, etc. ** Mark View While doing the refactor the concept of a mark view was also implemented: The view of a mark currently implemented as the number of lines between the mark position on creation and the window topline. This allows for moving not only back to the position of a mark but having the window look similar to when the mark was defined. This is done by carrying and extra element in the fmark_T struct, which can be extended later to also restore horizontal shift. *** User space features 1. There's a new option, jumpoptions+=view enables the mark view restoring automatically when using the jumplist, changelist, alternate-file and mark motions. <C-O> <C-I> g; g, <C-^> '[mark] `[mark] ** Limitations - The view information is not saved in shada. - Calls to get_mark should copy the value in the pointer since we are using pos_to_mark() to wrap and provide a homogeneous interfaces. This was also a limitation in the previous state of things.
* refactor: replace char_u #18429dundargoc2022-06-28
| | | Work on https://github.com/neovim/neovim/issues/459
* vim-patch:8.2.1898: command modifier parsing always uses global cmdmodzeertzjq2022-06-14
| | | | | | Problem: Command modifier parsing always uses global cmdmod. Solution: Pass in cmdmod_T to use. Rename struct fields consistently. https://github.com/vim/vim/commit/e10044015841711b989f9a898d427bcc1fdb4c32
* refactor: change type of linenr_T from long to int32_tDundar Goc2022-06-10
| | | | | | | | | | | | | The size of long varies depending on architecture, in contrast to the MAXLNUM constant which sets the maximum allowable number of lines to 2^32-1. This discrepancy may lead to hard to detect bugs, for example https://github.com/neovim/neovim/issues/18454. Setting linenr_T to a fix maximum size of 2^32-1 will prevent this type of errors in the future. Also change the variables `amount` and `amount_after` to be linenr_T since they're referring to "the line number difference" between two texts.
* refactor(uncrustify): set maximum number of consecutive newlines to 2 (#18695)dundargoc2022-05-25
|
* refactor: replace char_u variables and functions with charDundar Goc2022-05-16
| | | | Work on https://github.com/neovim/neovim/issues/459
* refactor: replace char_u variables and functions with charDundar Goc2022-05-09
| | | | Work on https://github.com/neovim/neovim/issues/459
* refactor: replace char_u variables and functions with charDundar Goc2022-05-07
| | | | Work on https://github.com/neovim/neovim/issues/459
* refactor: replace char_u variables and functions with charDundar Goc2022-05-04
| | | | Work on https://github.com/neovim/neovim/issues/459
* refactor(uncrustify): change rules to better align with the style guideDundar Goc2022-04-29
| | | | | | | | | | | | | Add space around arithmetic operators '+' and '-'. Remove space between back-to-back parentheses, i.e. ')(' vs. ') ('. Remove space between '((' or '))' of control statements. Add space between ')' and '{' of control statements. Remove space between function name and '(' on function declaration. Collapse empty blocks between '{' and '}'. Remove newline at the end of the file. Remove newline between 'enum' and '{'. Remove newline between '}' and ')' in a function invocation. Remove newline between '}' and 'while' of 'do' statement.
* refactor: convert macros to all-caps (#17895)dundargoc2022-04-24
| | | Closes https://github.com/neovim/neovim/issues/6297
* vim-patch:8.2.4719: ">" marker sometimes not displayed in the jumplist (#18056)zeertzjq2022-04-10
| | | | | | | | Problem: ">" marker sometimes not displayed in the jumplist. Solution: If the buffer no longer exists show "-invalid-". (Christian Brabandt, closes vim/vim#10131, closes vim/vim#10100) https://github.com/vim/vim/commit/a0f659c76e22108880f857b8961422afc5ed8f5d Add a modeline to test_jumplist.vim
* fix(coverity): dead code and operands don't affect result #17662dundargoc2022-03-11
| | | | | | | | | | | | | | | | | | | | | * fix(coverity/349942): structurally dead code * fix(coverity/331396): operands don't affect result * fix(coverity/331393): operands don't affect result * fix(coverity/331392): operands don't affect result * fix(coverity/331384): operands don't affect result * fix(coverity/331374): operands don't affect result * fix(coverity/331372): operands don't affect result * fix(coverity/331371): operands don't affect result * fix(coverity/331364): operands don't affect result * fix(coverity/105585): operands don't affect result
* vim-patch:8.2.3532: the previous '' mark is restored after moving the cursor ↵zeertzjq2022-01-31
| | | | (#17246)
* refactor: saner options for uncrustify (#16204)dundargoc2021-11-19
| | | | | | | | | | | | | | | | | | | | | | | | * sp_enum_after_assign = force * sp_brace_typedef = force * nl_do_brace = remove * sp_do_brace_open = force * sp_brace_close_while = force * sp_before_semi = remove * sp_before_semi_for = remove * sp_before_semi_for_empty = remove * sp_between_semi_for_empty = remove * sp_after_semi_for_empty = remove * sp_before_square = remove * sp_before_squares = remove * sp_inside_square = remove * sp_inside_fparens = remove * sp_inside_fparen = remove * sp_inside_tparen = remove * sp_after_tparen_close = remove * sp_return_paren = force * pos_bool = lead * sp_pp_concat = remove * sp_pp_stringify = remove * fixup: disable formatting for the INIT section
* vim-patch:8.1.0779: argument for message functions is inconsistentJames McCoy2021-11-01
| | | | | | Problem: Argument for message functions is inconsistent. Solution: Make first argument to msg() "char *". https://github.com/vim/vim/commit/32526b3c1846025f0e655f41efd4e5428da16b6c
* vim-patch:8.1.0743: giving error messages is not flexibleJames McCoy2021-11-01
| | | | | | | | | Problem: Giving error messages is not flexible. Solution: Add semsg(). Change argument from "char_u *" to "char *", also for msg() and get rid of most MSG macros. (Ozaki Kiichi, closes vim/vim#3302) Also make emsg() accept a "char *" argument. Get rid of an enormous number of type casts. https://github.com/vim/vim/commit/f9e3e09fdc93be9f0d47afbc6c7df1188c2a5a0d
* Merge pull request #15930 from dundargoc/vim-patch/old-style-c-commentsJan Edmund Lazo2021-10-17
|\ | | | | vim-patch:8.1.2396,8.1.2395,8.1.2394,8.1.2392,8.1.2368,8.1.2388,8.1.2379
| * fixup! vim-patch:8.1.2388: using old C style commentsDundar Göc2021-10-16
| |
| * vim-patch:8.1.2388: using old C style commentsDundar Göc2021-10-06
| | | | | | | | | | | | Problem: Using old C style comments. Solution: Use // comments where appropriate. https://github.com/vim/vim/commit/4ba37b5833de99db9e9afe8928b31c864182405c
* | fix(buffer_updates): make `lockmarks` not affect extmarks and buffer ↵Anton Adamansky2021-10-07
|/ | | | | | updates. fixes #12861 Now mark_adjust() will trigger appropriate buf_updates_send_splice() called by extmark_adjust()
* feat(api): named marks set, get, delete #15346Javier Lopez2021-10-05
| | | | | | | | | | | | | | | | | | | | | | | Adds the following API functions. - nvim_buf_set_mark(buf, name, line, col) * Set marks in a buffer. - nvim_buf_del_mark(buf, name) * Delete a mark that belongs to buffer. - nvim_del_mark(name) * Delete a global mark. - nvim_get_mark(name) * Get a global mark. Tests: - Adds test to all the new api functions, and adds more for the existing nvim_buf_get_mark. * Tests include failure cases. Documentation: - Adds documentation for all the new functions, and improves the existing fucntion docs.
* refactor: format with uncrustify #15741dundargoc2021-09-22
|
* refactor: replace TRUE/FALSE with true/falseDundar Göc2021-07-30
|
* chore: use codespell to spell check #15016dundargoc2021-07-07
|
* vim-patch:8.2.0050: after deleting a file mark it is still in viminfoJan Edmund Lazo2021-01-05
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: After deleting a file mark it is still in viminfo. Solution: When a file mark was deleted more recently than the mark in the merged viminfo file was updated, do not store the mark. (Pavol Juhas, closes vim/vim#5401, closes vim/vim#1339) https://github.com/vim/vim/commit/8cd6cd8087ccf08e4303dbf5f732fc4b82b917e1 Neovim's ShaDa is incompatible with Vim's "viminfo" so "viminfo" tests fail. N/A patches for version.c: vim-patch:8.1.1731: command line history not read from viminfo on startup Problem: Command line history not read from viminfo on startup. Solution: Get history length after initializing it. https://github.com/vim/vim/commit/26b654a5df9414e43734eb4c956b67c331d70a50 vim-patch:8.1.1764: ":browse oldfiles" is not tested Problem: ":browse oldfiles" is not tested. Solution: Add a test. https://github.com/vim/vim/commit/5328cb8986d2620f45b41acf28778f8ce2f8cac1 vim-patch:8.1.2111: viminfo file not sufficiently tested Problem: Viminfo file not sufficiently tested. Solution: Add more tests. (Yegappan Lakshmanan, closes vim/vim#5009) https://github.com/vim/vim/commit/2a8d3b8997d4fe94bc9c02ae04e873eab2f13b09 vim-patch:8.1.2126: viminfo not sufficiently tested Problem: Viminfo not sufficiently tested. Solution: Add more test cases. Clean up comments. (Yegappan Lakshmanan, closes vim/vim#5032) https://github.com/vim/vim/commit/6bd1d7706766a7899904163e8fd55ea117fb1953
* vim-patch:8.2.0861: cannot easily get all the current marks (#13676)Jan Edmund Lazo2021-01-03
| | | | | | | | | | | Problem: Cannot easily get all the current marks. Solution: Add getmarklist(). (Yegappan Lakshmanan, closes #6032) https://github.com/vim/vim/commit/cfb4b47de08e4437c692d382067dc1692cd83c23 Cherry-pick the column number fix from patch v8.2.0871 because patch v8.2.0871 cannot be fully ported without the method patches. Co-authored-by: Peter Wolf <pwolf2310@gmail.com>
* vim-patch:8.2.1252: ":marks" may show '< and '> mixed upPeter Wolf2020-07-28
| | | | | | Problem: ":marks" may show '< and '> mixed up. Solution: Show the mark position as where '< and '> would jump. https://github.com/vim/vim/commit/54c3fcd852f9d986f81547429e850b3364f058d6
* shed biking: it's always extmarks, never marks extendedBjörn Linse2020-01-20
|
* extmarks/bufhl: reimplement using new marktree data structureBjörn Linse2020-01-16
| | | | | | | | | | | | | | | | | | | | Add new "splice" interface for tracking buffer changes at the byte level. This will later be reused for byte-resolution buffer updates. (Implementation has been started, but using undocumented "_on_bytes" option now as interface hasn't been finalized). Use this interface to improve many edge cases of extmark adjustment. Changed tests indicate previously incorrect behavior. Adding tests for more edge cases will be follow-up work (overlaps on_bytes tests) Don't consider creation/deletion of marks an undoable event by itself. This behavior was never documented, and imposes complexity for little gain. Add nvim__buf_add_decoration temporary API for direct access to the new implementation. This should be refactored into a proper API for decorations, probably involving a huge dict. fixes #11598
* 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.
* Merge #11340 'Factor out parse_one_cmd()'Justin M. Keyes2019-11-17
|\ | | | | | | | | This will allow us to reuse the parsing logic elsewhere, namely for 'inccommand' logic, so we don't need to duplicate it for changes such as the repeated colon fix in #11319.
| * vim-patch:8.1.0266: parsing Ex address range is not a separate functionJan Edmund Lazo2019-11-13
| | | | | | | | | | | | Problem: Parsing Ex address range is not a separate function. Solution: Refactor do_one_cmd() to separate address parsing. https://github.com/vim/vim/commit/ee8415bc5998792fab6f4dcf289d027856e05b89
* | nsmarks: initial committimeyyy2019-11-11
|/
* vim-patch:8.1.2058: function for ex command is named inconsistentlyJan Edmund Lazo2019-09-21
| | | | | | Problem: Function for ex command is named inconsistently. Solution: Rename do_marks() to ex_marks(). https://github.com/vim/vim/commit/4bd782339e370bde82c2a8976df9f335cc12eba9
* shada/context: fully remove jumplist duplicates #10898Abdelhakeem Osama2019-09-03
| | | | | | | | | | | | | | | | - Always load files when cleaning up jumplist. - For Shada: avoids writing duplicate entries, which happens when you read from a shada file with duplicate entries (merging the jumplist while writing sometimes produces duplicate entries, bug?) and then write right away (i.e.: without any `:jumps`, `getjumplist()`, or any jump movement, that is: nothing that calls `cleanup_jumplist` with `loadfiles == true`). - For Context: avoids non-idempotent behavior for the same reason (i.e.: first call to `shada_encode_jumps` does not remove duplicate entries). - Do not set pcmark when dumping jumplist for Context. - Retrieving current Context shouldn't add an entry to the jumplist (which will be removed by a subsequent `cleanup_jumplist` anyway, i.e.: tail entry matching current position), just act like `getjumplist` for instance.
* API: ContextJustin M. Keyes2019-07-27
|
* vim-patch:8.1.0833: memory leak when jumps output is filteredJan Edmund Lazo2019-07-15
| | | | | | Problem: Memory leak when jumps output is filtered. Solution: Free the filtered name. (Dominique Pelle, closes vim/vim#3869) https://github.com/vim/vim/commit/d93090f41f70c521cfad5b25efcb0024b9480082
* vim-patch:8.1.1221: filtering does not work when listing marksJan Edmund Lazo2019-07-15
| | | | | | Problem: Filtering does not work when listing marks. Solution: Implement filtering marks. (Marcin Szamotulski, closes vim/vim#3895) https://github.com/vim/vim/commit/ad6dc49a7564a99fca36c1928e3865787d3bd5b2
* vim-patch:8.1.0495: :filter only supports some commandsJan Edmund Lazo2019-07-15
| | | | | | | Problem: :filter only supports some commands. Solution: Add :filter support for more commands. (Marcin Szamotulski, closes vim/vim#2856) https://github.com/vim/vim/commit/f86db78fed78541cefdb706e4779ce5ae9ca7820