aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/drawline.c
Commit message (Collapse)AuthorAge
...
* feat(fold): transparent foldtextLewis Russell2024-01-22
| | | | | | | | | | | | | | | | | 'foldtext' can be set to an empty string to disable and render the line with: - extmark highlight - syntax highlighting - search highlighting - no line wrapping - spelling - conceal - inline virtual text - respects `fillchars:fold` Currently normal virtual text is not displayed Co-authored-by: zeertzjq <zeertzjq@outlook.com>
* refactor: use "csarg" for CharsizeArg variables (#27123)zeertzjq2024-01-22
|
* perf: reuse fast character size calculation algorithm from getvcol()VanaIgr2024-01-22
|
* perf: cache breakindent/showbreak width in win_lbr_chartabsizeVanaIgr2024-01-18
| | | | | | breakindent was recomputed on every call to win_lbr_charbabsize() when the character is past the end of the first row of a wrapped line. Even though the function for computing breakindent cached the last result, reusing the cached value required strcmp of the cached line with the given line.
* refactor(drawline): get_rightmost_vcol()Lewis Russell2024-01-18
|
* refactor(drawline): add more constsLewis Russell2024-01-18
|
* refactor(drawline): localise more variables in win_line()Lewis Russell2024-01-18
|
* refactor(drawline): more win_line() improvementsLewis Russell2024-01-18
| | | | | | | | `win_line()` previously used a conspicuous `ptrdiff_t v` variable in many different places for different reasons. The change encapsulates those uses and introduces local variables in each with a reduced scope. Also add `const` to some fields in winlinevars_T.
* fix(drawline): update prev_ptr after getting syntax attrs (#27072)zeertzjq2024-01-18
|
* fix(column): redraw 'statuscolumn' on wrapped lines with 'relativenumber'Luuk van Baal2024-01-16
| | | | | | | Problem: The 'statuscolumn' is not redrawn on the wrapped part of a line when moving the cursor with 'relativenumber' set. Solution: Redraw the 'statuscolumn' for the entire line height in the "col_rows" win_line() code path.
* refactor(IWYU): fix headersdundargoc2024-01-11
| | | | | | Remove `export` pramgas from defs headers as it causes IWYU to believe that the definitions from the defs headers comes from main header, which is not what we really want.
* refactor(screen): simplify grid_clear() and win_draw_end()bfredl2024-01-11
| | | | | | | | | | | grid_put_linebuf() used grid_clear() internally to handle clearing the left part of a rightleft line. By reimplementing that internally, we can instead use grid_put_linebuf() as the implementation of grid_clear(), which in the end is a net reduction of code as grid_fill() is used for nothing else. win_draw_end: Implement "draw_margin" on a per-row basis which closer reflects how terminals work. Also use the magic mirror for 'rightleft'
* fix(extmarks): blending space shouldn't overwrite wide char (#26960)zeertzjq2024-01-09
|
* refactor(drawline): remove unused save_extra argument (#26959)zeertzjq2024-01-09
|
* fix(extmarks): handle overwriting right half of wide char (#26951)zeertzjq2024-01-09
|
* refactor(options): use schar_T representation for fillchars and listcharsbfredl2024-01-08
| | | | | | | | | | | A bit big, but practically it was a lot simpler to change over all fillchars and all listchars at once, to not need to maintain two parallel implementations. This is mostly an internal refactor, but it also removes an arbitrary limitation: that 'fillchars' and 'listchars' values can only be single-codepoint characters. Now any character which fits into a single screen cell can be used.
* refactor(column): define and use maximum 'statuscolumn' widthLuuk van Baal2024-01-04
| | | | | Problem: The maximum 'statuscolumn' width and grow behavior is undocumented. Solution: Define, use and document the maximum 'statuscolumn' width and grow behavior.
* fix(drawline): consider position in linebuf for foldcolumn (#26803)luukvbaal2024-01-02
|
* refactor: follow style guidedundargoc2023-12-30
|
* refactor(drawline): remove maybe_wlv argument for foldcolumn (#26798)luukvbaal2023-12-30
| | | | Problem: fill_foldcolumn() has an optional winlinevars_T argument. Solution: Increment wlv->off at callsite.
* refactor(drawline): avoid writing foldopen before writing foldclosedLuuk van Baal2023-12-29
|
* vim-patch:9.0.2189: Wrong display with 'briopt=sbr' and 'nobreakindent' (#26785)zeertzjq2023-12-29
| | | | | | | | | | | Problem: Wrong display when 'breakindentopt' contains "sbr" and 'showbreak' and 'nobreakindent' are set. Solution: Always reset wlv->need_showbreak regardless of the values of 'breakindent' and 'showbreak', as they aren't checked when setting wlv->need_showbreak (zeertzjq) closes: vim/vim#13785 https://github.com/vim/vim/commit/7e4f62a2575e8ce9ebb842d4246288138b11dff3
* fix(drawline): don't use temporary "v" variable when not needed (#26777)zeertzjq2023-12-28
|
* vim-patch:9.0.2187: Visual not drawn with 'breakindent' when line doesn't ↵zeertzjq2023-12-28
| | | | | | | | | | | | fit (#26765) Problem: Visual selection isn't drawn with 'breakindent' when the line doesn't fit in the window (Jaehwang Jung) Solution: Adjust wlv->fromcol also for 'breakindent' (zeertzjq) closes: vim/vim#13767 closes: vim/vim#13768 https://github.com/vim/vim/commit/23627722d36b49e38ba6f8dc6bb3ebe19c98a83b
* fix(column): correct width after truncated 'statuscolumn' error (#26737)luukvbaal2023-12-26
| | | | | Problem: Default number column has incorrect width after 'statuscolumn' is unset due to an error, but was also truncated. Solution: Reverse 'statuscolumn' error and truncate return branches.
* feat(extmarks): add virt_text_repeat_linebreak flag (#26625)luukvbaal2023-12-26
| | | | | | Problem: Unable to predict which byte-offset to place virtual text to make it repeat visually in the wrapped part of a line. Solution: Add a flag to nvim_buf_set_extmark() that causes virtual text to repeat in wrapped lines.
* refactor(drawline): reduce size of wlv.extra[] (#26733)zeertzjq2023-12-25
| | | It's now only used for transchar_hex(), which only needs 11 bytes.
* refactor(IWYU): move evalarg_T to eval_defs.h (#26716)zeertzjq2023-12-23
|
* refactor(drawline): avoid storing info to draw 'statuscolumn' (#26712)luukvbaal2023-12-23
| | | | | We no longer return to the main loop in win_line() to put column characters on the screen. Simplify and sync statuscolumn drawing logic with that of statusline.
* fix(decor): allow adding providers during redrawLewis Russell2023-12-22
| | | | Fixes: #26652
* refactor(drawline): simplify draw_statuscol() and remove draw_state referencesLuuk van Baal2023-12-22
|
* refactor(drawline): remove LineDrawState and wlv->saved_n_extrabfredl2023-12-22
| | | | | | | | | | | | | | | | | | | | | | | We do not need an enum to keep track of what place in win_line() we currently are at. We already have a variable which keeps track where in the code we currently are (and thus what part of the line we are currently rendering), it is called the _program counter_. When we need non-linear or self-referential control-flow anyway for a laugh, we have a mechanism for that, it is called _function calls_. Do not "save" and "restore" the wlv->n_extra state every time the columns are to be drawn. This sort of thing needs to go away. Instead of setting the n_extra variables and then going to the outer while loop, the text in the columns can be rendered by just simply putting the text into the cells of the screen line, right away. Even in nvim this can be tricky sometimes, luckily we can use function calls to abstract this logic, which means that this handy data structure called the _call stack_ is handling saving away state temporarily, and restoring it back when we need it again. Lastly, but not least, as we now have direct control how signs are rendered, these can be stored as schar_T[2] and be directly put on screen as such.
* refactor(IWYU): move decor provider types to decoration_defs.h (#26692)zeertzjq2023-12-21
|
* refactor: use `bool` to represent boolean valuesdundargoc2023-12-19
|
* vim-patch:9.0.2151: 'breakindent' is not drawn after diff filler lines (#26412)zeertzjq2023-12-06
| | | | | | | | | | Problem: 'breakindent' is not drawn after diff filler lines. Solution: Correct check for whether 'breakindent' should be drawn. closes: vim/vim#13624 https://github.com/vim/vim/commit/588f20decebebedba3ad733f4f443a597e9747c3 Cherry-pick Test_diff_with_syntax() change from patch 9.0.1257.
* refactor: move some constants out of vim_defs.h (#26298)zeertzjq2023-11-29
|
* refactor: fix headers with IWYUdundargoc2023-11-28
|
* feat(decoration): allow conceal_char to be a composing charbfredl2023-11-28
| | | | | | | | decor->text.str pointer must go. This removes it for conceal char, in preparation for a larger PR which will also handle the sign case. By actually allowing composing chars for a conceal chars, this becomes a feature and not just a refactor, as a bonus.
* refactor: rename types.h to types_defs.hdundargoc2023-11-27
|
* build(IWYU): fix includes for undo_defs.hdundargoc2023-11-27
|
* refactor: move garray_T to garray_defs.h (#26227)zeertzjq2023-11-26
|
* build: rework IWYU mapping filesdundargoc2023-11-25
| | | | | Create mapping to most of the C spec and some POSIX specific functions. This is more robust than relying files shipped with IWYU.
* refactor(decorations): break up Decoration struct into smaller piecesbfredl2023-11-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Remove the monolithic Decoration struct. Before this change, each extmark could either represent just a hl_id + priority value as a inline decoration, or it would take a pointer to this monolitic 112 byte struct which has to be allocated. This change separates the decorations into two pieces: DecorSignHighlight for signs, highlights and simple set-flag decorations (like spell, ui-watched), and DecorVirtText for virtual text and lines. The main separation here is whether they are expected to allocate more memory. Currently this is not really true as sign text has to be an allocated string, but the plan is to get rid of this eventually (it can just be an array of two schar_T:s). Further refactors are expected to improve the representation of each decoration kind individually. The goal of this particular PR is to get things started by cutting the Gordian knot which was the monolithic struct Decoration. Now, each extmark can either contain chained indicies/pointers to these kinds of objects, or it can fit a subset of DecorSignHighlight inline. The point of this change is not only to make decorations smaller in memory. In fact, the main motivation is to later allow them to grow _larger_, but on a dynamic, on demand fashion. As a simple example, it would be possible to augment highlights to take a list of multiple `hl_group`:s, which then would trivially map to a chain of multiple DecorSignHighlight entries. One small feature improvement included with this refactor itself, is that the restriction that extmarks cannot be removed inside a decoration provider has been lifted. These are instead safely lifetime extended on a "to free" list until the current iteration of screen drawing is done. NB: flags is a mess. but DecorLevel is useless, this slightly less so
* refactor(sign): store 'signcolumn' width range when it is setLuuk van Baal2023-11-21
| | | | | Problem: Minimum and maximum signcolumn width is determined each redraw. Solution: Determine and store 'signcolumn' range when option is set.
* refactor: enable formatting for ternariesdundargoc2023-11-20
| | | | | | This requires removing the "Inner expression should be aligned" rule from clint as it prevents essentially any formatting regarding ternary operators.
* refactor: follow style guidedundargoc2023-11-19
| | | | | - reduce variable scope - prefer initialization over declaration and assignment
* Merge pull request #25724 from luukvbaal/signmergebfredl2023-11-18
|\ | | | | refactor(sign): move legacy signs to extmarks
| * refactor(sign): move legacy signs to extmarksLuuk van Baal2023-11-17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: The legacy signlist data structures and associated functions are redundant since the introduction of extmark signs. Solution: Store signs defined through the legacy commands in a hashmap, placed signs in the extmark tree. Replace signlist associated functions. Usage of the legacy sign commands should yield no change in behavior with the exception of: - "orphaned signs" are now always removed when the line it is placed on is deleted. This used to depend on the value of 'signcolumn'. - It is no longer possible to place multiple signs with the same identifier in a single group on multiple lines. This will now move the sign instead. Moreover, both signs placed through the legacy sign commands and through |nvim_buf_set_extmark()|: - Will show up in both |sign-place| and |nvim_buf_get_extmarks()|. - Are displayed by increasing sign identifier, left to right. Extmark signs used to be ordered decreasingly as opposed to legacy signs.
* | refactor(grid): make screen rendering more multibyte than ever beforebfredl2023-11-17
|/ | | | | | | | | | | | | | | | | | Problem: buffer text with composing chars are converted from UTF-8 to an array of up to seven UTF-32 values and then converted back to UTF-8 strings. Solution: Convert buffer text directly to UTF-8 based schar_T values. The limit of the text size is now in schar_T bytes, which is currently 31+1 but easily could be raised as it no longer multiplies the size of the entire screen grid when not used, the full size is only required for temporary scratch buffers. Also does some general cleanup to win_line text handling, which was unnecessarily complicated due to multibyte rendering being an "opt-in" feature long ago. Nowadays, a char is just a char, regardless if it consists of one ASCII byte or multiple bytes.
* refactor: follow style guidedundargoc2023-11-13
| | | | | | - reduce variable scope - prefer initialization over declaration and assignment - use bool to represent boolean values