| Commit message (Collapse) | Author | Age |
| |
|
|
|
|
|
|
|
|
| |
Problem:
Redundant logic.
Solution:
Deduplicate.
Also: `winrestview()` no longer forces a status-line redraw and
resending `win_pos` (`win_new_width()` on unchanged width).
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#41920)
Problem: When scrolling, comp_botline() recomputes the display height of
every line in the window on each cursor movement, which is
slower than necessary.
Solution: Reuse the line heights computed for the previous redraw, stored
in w_lines[], the same way curs_rows() already does. (Julien Voisin).
comp_botline() computes w_botline by calling plines_correct_topline() for
every line from the top (or cursor) to the bottom of the window. This walks
every character of every line to measure its display width, and it runs on
every scroll. When the display is up to date the heights are already known
in w_lines[].wl_size and are equal to what plines() would return, so they
can be reused, avoiding the per-line width computation. The cache is only
trusted when redrawing, the buffer was not changed, no "$" is displayed and
w_lines[] starts at or above w_topline; otherwise the previous computation
is used.
Benchmark: 1500 real keystrokes sent to a terminal Vim scrolling a 60000-line
syntax-highlighted C file in a 120x40 window. Instructions retired were
measured with "perf stat", with the constant startup cost subtracted;
run-to-run variation was under 0.01%.
instructions per key
command baseline patched change
j (line down) 252883 117800 -53%
CTRL-E (view down) 210580 114017 -46%
V then j (visual) 320142 184959 -42%
CTRL-D (half page) 634489 585040 -8%
CTRL-F (full page) 1179034 1173068 -1%
k (line up) 4289 4289 0%
The same test without syntax highlighting drops "j" from 217149 to 116598
instructions per key (-46%), and on a file of long wrapped lines from 374952
to 175579 (-53%).
The win scales with how much of the window is reused: a line- or view-scroll
keeps all but one line, a half page keeps half, and a full page or an upward
scroll reuse nothing, so those are unchanged.
closes: vim/vim#21207
https://github.com/vim/vim/commit/6e67c47e6edd163706345dcf84f305f128583396
Co-authored-by: Julien Voisin <julien.voisin@dustri.org>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
`scroll_cursor_halfway()` resets its `above` and `below` row counters on
every iteration of the `topline` scan, because they are declared inside
the loop. Each iteration then takes one line from each side regardless
of how many screen rows those lines occupy, so tall wrapped lines below
the cursor leave it near the top of the window instead of centered.
Affects the default `nosmoothscroll` path, reached from "zz" and from
`update_topline()`. Regression from 9b9ccac6256 (vim-patch:9.0.1121),
which moved the declarations to their first use while porting; the
upstream patch did not touch them.
Solution:
Declare the counters at function scope, as Vim does, so they accumulate
across iterations.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Problem: Cursor correction can move the cursor up at the end of the
buffer when 'scrolloffpad' is enabled (gx089).
Solution: Allow missing context below EOF in cursor_correct(). Add
regression tests for CTRL-D and CTRL-E (Seunghee Kim).
fixes: vim/vim#21096
closes: vim/vim#21188
https://github.com/vim/vim/commit/6a3db67a52cc5a2de13ce42f93ccf07493b8d2a4
Co-authored-by: SeungheeKim <ksh368@naver.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
after undo (#41282)
Problem: In diff mode with 'cursorbind' the cursor in the other window is
not updated after an undo that changes which lines correspond.
Solution: Also check whether the text changed before skipping the update
(Hirohito Higashi).
fixes: vim/vim#20982
related: vim/vim#13219
related: vim/vim#13210
closes: vim/vim#21004
https://github.com/vim/vim/commit/2045a20d4bf604c47828bfc22d2da25f0294bc01
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#41143)
Problem: "zb" scrolls incorrectly with cursor just above fold.
Solution: Handle boff.lnum being set to the last line of a fold
(zeertzjq).
With the cursor just above fold, botline_forw() moves boff.lnum to the
last line of the fold, but curwin->w_botline is at the first line of the
fold, so the boff.lnum == curwin->w_botline condition never holds.
Instead, check that boff.lnum has just moved to or past w_botline by
comparing its previous value with w_botline.
Also make a similar change to the loff.lnum check above for symmetry.
That one doesn't change behavior, as topline_back() sets loff.lnum to
the first line of a fold.
related: neovim/neovim#41122
closes: vim/vim#20923
https://github.com/vim/vim/commit/aee686334c2137f8a94b04de130a3f51d928a7ed
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
is squeezed
Problem: With 'smoothscroll' the scroll position in a long line is lost when
a window is temporarily squeezed to a couple of lines, for example
when opening and closing a help window.
Solution: When the cursor ends up in the skipped columns, skip up to the
screen line the cursor is in instead of showing the start of the
line.
closes: vim/vim#20892
https://github.com/vim/vim/commit/15f8ba5cec35feea22622fbc7c78f3204aad50df
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem: cursor_correct() checks for 'smoothscroll' with 'wrap' off, a
combination where 'smoothscroll' has no effect.
Solution: Remove the check, adjust_skipcol() already handles the case where
the cursor line just fits in the window.
closes: vim/vim#20891
https://github.com/vim/vim/commit/2ea497f072f102220a683822fd201bfb530894b2
Co-authored-by: Hirohito Higashi <h.east.727@gmail.com>
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
Options parsing is still painful for dict-style options.
Solution:
schema-maxxing => better `opt:get()` (will be the basis for `vim.o()`),
unified (and more-detailed) err msgs.
- Drop bespoke structure-builder in `_core/options.lua`.
- Define `schema` for all non-primitive options (except 'guicursor' and
statusline-style options); generate reified keysets `OptKeyDict`).
- Generate 'fillchars' => `fcs_tab`, 'listchars' => `lcs_tab`.
- `nvim_set_option_value`:
- Return the improved structures. Also from `vim.opt.x:get()`.
- Eliminate api <=> lua roundtrip, centralize option structure
handling.
- Improve/unify errors.
- Bump ERR_BUFLEN 80 → 256 so the "one of" list isn't truncated.
- Eliminate old 'diffopt' order-dependence (`iwhiteall` before `iwhite`)
Error samples:
Typed-key path (opt_strings_check → diffopt/mousescroll/breakindentopt):
E474: Unknown item 'foo'
E474: 'context' requires a number
E474: 'ver' number is out of range
E474: 'algorithm' must be one of: myers, minimal, patience, histogram
E474: 'filler' does not take a value
Related:
- #31084
- #34661
- #31820
- #14739
- #20107
- fix #18875
- :get() returns `{ sbr = true, shift = '3' }` (reified-keyset) instead of `{'sbr', 'shift:3'}`
- Setting via table now works too. `object_as_optval_for` `is_map` now recognizes struct options.
- fix #30296
- instead of `E474: Invalid argument`, errors now look like:
```
E474: Invalid value 'x', expected one of: single, double: ambiwidth=x
E474: Unknown item 'foo': diffopt=foo
E474: 'context' requires a number: diffopt=context:x
```
simplify `win_float_parse_option` from #26799.
|
| | |
|
| |
|
|
|
|
|
|
|
|
| |
Problem:
- `edit.c` is an unnecessarily misleading and less-discoverable name
than `insert.c`.
- Numerous insert-mode related things are named with a `ins_` prefix.
- There is already a `insexpand.c` module...
Solution:
Rename `edit.c` => `insert.c`.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Problem:
`getchar.c` is a quirky name and doesn't align with our existing
`os/input.c` and `tui/input.c` modules, which encompass the same topic
at different layers.
Solution:
Rename `getchar.c` => `input.c` for discoverability.
Introduce `dialog.c` for functionality related to showing confirm
prompts, dialogs, etc.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
cmdwin (the `:q` cmdline buffer) has various limitations which require
special-casing all over the codebase.
Besides complicating the code, it also breaks async plugins if they try
to create buffers/windows after some work is done, if the user happens
to open cmdwin at the wrong the moment:
Lua callback: …/guh.nvim/lua/guh/util.lua:531:
E11: Invalid in command-line window; <CR> executes, CTRL-C quits
stack traceback:
[C]: in function 'nvim_buf_delete'
…/guh.nvim/lua/guh/util.lua:531: in function <…/guh.nvim/lua/guh/util.lua:526>
Solution:
Just say no to "inception". Reimplement cmdwin as a normal buffer+window.
All of the cmdwin contortions (in both core, and innocent plugins) exist
literally only to support "inception": recursive
cmdwin-in-cmdline-things, like `<c-r>=`, `/`, search-during-substitute,
`:input()`, etc. So we just won't support that (though I have
a potential plan for that later, which I call "modal parking lot").
The benefit is that plugins, and core, no longer have to care about
cmdwin.
BONUS:
- mouse-drag on vertical separators works (it only worked for
horizontal/statusline before)
- inccommand-in-cmdwin now works correctly, for free (thus don't need
#40077).
POTENTIAL FOLLOWUPS
- Drop `CHECK_CMDWIN` ("E11: Invalid in command-line window"), allow chaos.
- Unify `BUFLOCK_OK` / `LOCK_OK` ?
DESIGN:
- Eliminate lots of C globals, `EX_CMDWIN`, etc.
- `text_locked()` no longer reports true for cmdwin.
- cmdwin = a normal window with 'winfixbuf', 'bufhidden=wipe',
'buftype=nofile'. Invariants come from those options rather than
special cases throughout the codebase.
- `nv_record` for q:/q//q? calls Lua
`nlua_call_vimfn("vim._core.cmdwin", …)`. No `K_CMDWIN`
/ cmdline-reader detour.
- `cedit_key` (`c_CTRL-F`) schedules a deferred event that calls
`vim._core.cmdwin.open(type, content, pos)` and returns `Ctrl_C` so
the in-flight cmdline cancels. Reader state is not serialized; instead
the captured `(type, line, col)` is replayed via
`nvim_feedkeys(type..line.."<CR>", "nt", …)` after user confirms.
- On confirm/cancel: `<CR>` / `<C-C>` calls into Lua which closes the
window and re-feeds the cmdline.
BREAKING CHANGES:
- Expression-register cmdline (`<C-R>=` from insert-mode) no longer
supports cmdwin. Same applies to `input()` / `inputlist()` (already
covered by `text_locked`).
- Usage of cmdwin in macros/mappings will probably break (assuming they
ever worked).
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Problem: srolljump=-100 only scrolls half a page going up, but works
fine going down. update_topline() always falls back to
scroll_cursor_halfway() when the cursor is far above topline.
Solution: Only center when sj is smaller than half the window. Otherwise
call scroll_cursor_top like the downward path does (glepnir).
fixes: vim/vim#1527
closes: vim/vim#20366
https://github.com/vim/vim/commit/a4a60c0fdb8aeec21dcd14871c465fe0f2e6fbc3
|
| |
|
|
|
|
|
|
| |
Problem: strange indent in update_topline()
Solution: Fix the indentation (zeertzjq)
closes: vim/vim#20033
https://github.com/vim/vim/commit/f194676c936d9f3a8479a72afbbe9f244039e27e
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Problem: Cannot apply 'scrolloff' context lines at end of file
Solution: Add the 'scrolloffpad' option to keep 'scrolloff' context even
when at the end of the file (McAuley Penney).
closes: vim/vim#19040
https://github.com/vim/vim/commit/a414630393f81c9a5b8fa4d0fcc1287155f67751
Co-authored-by: McAuley Penney <jacobmpenney@gmail.com>
|
| |
|
|
|
|
|
|
|
|
| |
(#39289)
Problem: Integer overflow with "ze" and large 'sidescrolloff'.
Solution: Check for overflow to avoid negative w_leftcol (zeertzjq).
closes: vim/vim#20026
https://github.com/vim/vim/commit/33f3965087b01dccf4382ed419d34799ffd66cd9
|
| | |
|
| |
|
|
| |
Since Nvim uses a compositor, redrawing windows won't lead to flicker in
the popup menu, so the pum_visible() checks in move.c can be removed.
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
(#38749)
Problem: 'linebreak' may lead to wrong Visual block highlighting when
end char occupies multiple cells (after 7.4.467).
Solution: Exclude 'linebreak' from the ending column instead of setting
'virtualedit' temporarily (zeertzjq).
fixes: vim/vim#19898
closes: vim/vim#19900
https://github.com/vim/vim/commit/23be1889d1a1212445ca8bb9cd378484d3755f79
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
*** CID 645128: Integer handling issues (INTEGER_OVERFLOW)
/src/nvim/move.c: 2071 in scroll_cursor_bot()
2065 used += boff.height;
2066 if (used > wp->w_view_height) {
2067 break;
2068 }
2069 if (extra < (mouse_dragging > 0 ? mouse_dragging - 1 : so)
2070 || scrolled < min_scroll) {
>>> CID 645128: Integer handling issues (INTEGER_OVERFLOW)
>>> Expression "extra", where "boff.height" is known to be equal to 2147483647, overflows the type of "extra", which is type "int".
2071 extra += boff.height;
2072 if (boff.lnum >= wp->w_botline
2073 || (boff.lnum + 1 == wp->w_botline
2074 && boff.fill > wp->w_filler_rows)) {
2075 // Count screen lines that are below the window.
2076 scrolled += boff.height;
|
| |
|
|
|
|
|
|
|
| |
Problem: "zb" scrolls incorrectly with cursor on fold.
Solution: Set w_botline to the line below the fold (zeertzjq).
related: neovim/neovim#38413
closes: vim/vim#19785
https://github.com/vim/vim/commit/5a3b75d67b98777b319eb9c4e5e0d7a130aaec5e
|
| |
|
|
|
|
|
|
|
|
|
| |
Problem: Page scrolling in Insert mode beeps (after 9.1.0211).
Solution: Fix incorrect return value of pagescroll(). Also invert the
return value of scroll_with_sms() to be less confusing and
match comments (zeertzjq).
fixes: vim/vim#19326
closes: vim/vim#19327
https://github.com/vim/vim/commit/a8ce914db16898de47ff270f3c19e6683012dff8
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem: ml_get error when resizing window and using text property.
Solution: Validate botline of the right window. (closes vim/vim#7528)
https://github.com/vim/vim/commit/23999d799cfe844b604f193183f8f84052c8e746
Migrate to Vim's (in)validate_botline_win() API.
Nvim wants to pass "curwin" instead of hiding them
behind alias/macro/inline-function.
https://github.com/neovim/neovim/pull/37164#discussion_r2655006908
Co-authored-by: Bram Moolenaar <Bram@vim.org>
|
| |
|
|
|
|
|
|
|
| |
Problem: Invalid memory access in Ex mode with global command.
Solution: Make sure the cursor is on a valid line. (closes vim/vim#7238)
https://github.com/vim/vim/commit/3b6d57f2ce87dc5a4b1a50e1b0fd2aeaf72faae2
Co-authored-by: Bram Moolenaar <Bram@vim.org>
|
| | |
|
| |
|
|
|
|
|
|
| |
Problem: Wrong display with 'smoothscroll' when FEAT_DIFF is disabled.
Solution: Use plines_correct_topline() (zeertzjq).
closes: vim/vim#18649
https://github.com/vim/vim/commit/e06e70f7b129e983b307be405c44449348ac470f
|
| |
|
|
| |
Problem: May check for concealed lines on invalid line numbers.
Solution: Move checks after line number validation.
|
| |
|
|
|
|
|
|
|
|
|
| |
Problem: 'cursorlineopt' "screenline" isn't redrawn when moving cursor
and then using line("w0") and :retab that does nothing.
Solution: Call redraw_for_cursorcolumn() when setting a valid w_virtcol
(zeertzjq).
closes: vim/vim#18506
https://github.com/vim/vim/commit/a0849143614e687a305b6195dd8724840786e372
|
| |
|
|
|
|
|
|
|
| |
These are not needed after #35129 but making uncrustify still play nice
with them was a bit tricky.
Unfortunately `uncrustify --update-config-with-doc` breaks strings
with backslashes. This issue has been reported upstream,
and in the meanwhile auto-update on every single run has been disabled.
|
| |
|
|
|
| |
Problem: When scrolling (the text) down with 'smoothscroll', filler
lines are revealed before the text skipped with `w_skipcol`.
Solution: Check `w_skipcol` before filler lines.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
scrolling (#34023)
Problem: One-off error in "count" to make "w_skipcol" zero with
'nosmoothscroll' page scrolling when last virtual line
in a buffer line is exactly the entire window width.
(Hirohito Higashi)
Solution: Properly compute the smallest integer value necessary
to make "w_skipcol" zero (Luuk van Baal)
https://github.com/vim/vim/commit/c6c72d165c90e94eee1d9107d82fb180ed138190
|
| |
|
|
|
|
|
|
| |
Problem: Loop that ensures "w_skipcol" is zero with 'nosmoothscroll'
for (half)-page scrolling is inefficient.
Solution: Calculate the required "count" instead of looping until
"w_skipcol" is zero (Luuk van Baal).
https://github.com/vim/vim/commit/acf0ebe8a8f4dd389a8fe8cea52ff43bc8bfe1be
|
| | |
|
| |
|
|
|
|
|
|
|
| |
Problem: cursor_correct() calculates a valid cursor position which
is later changed by update_topline() and causes Ctrl-D
scrolling to be stuck (Daniel Steinberg, after v9.1.0258).
Solution: Update the valid cursor position before validating topline
(Luuk van Baal).
https://github.com/vim/vim/commit/c98250377d32007490da46b3334771ba3b2667fe
|
| |
|
|
|
|
| |
Problem: Scrolling up does not adjust `w_topline` for concealed lines
directly above it, resulting in (non-visual) asymmetry when
scrolling up/down.
Solution: Adjust `w_topline` for concealed lines after scrolling up.
|
| |
|
|
|
|
|
| |
(#32642)
Problem: f58e7d5f passed `&botline` to `plines_win_full()`, (probably)
assuming it would be set to the first line of the fold.
Solution: Reinstate call to `hasFolding()` to do so.
|
| |
|
|
| |
Problem: Cursor row calculation does not take into account concealed lines.
Solution: Break the loop when the next calculated line is concealed.
|
| |
|
|
| |
Implement an extmark property that conceals lines vertically.
|
| |
|
|
|
|
|
|
|
|
| |
Problem: 'smoothscroll' gets stuck with 'listchars' "eol".
Solution: Count size of 'listchars' "eol" in line size when scrolling.
(zeertzjq)
related: neovim/neovim#32405
closes: vim/vim#16627
https://github.com/vim/vim/commit/2c47ab8fcd7188fa87053c757ea86b0d846c06c1
|
| |
|
|
|
|
|
|
|
|
| |
Problem: Crash after scrolling and pasting in silent Ex mode.
(fizz-is-on-the-way)
Solution: Don't move cursor to line 0 when scrolling.
(zeertzjq)
closes: vim/vim#16506
https://github.com/vim/vim/commit/df098fedbc2c481e91ea7e6207dab90359a92cc3
|
| |
|
| |
Result of `make iwyu` (after some "fixups").
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem: Option metadata like list of valid values for an option and
option flags are not listed in the `options.lua` file and are instead
manually defined in C, which means option metadata is split between
several places.
Solution: Put metadata such as list of valid values for an option and
option flags in `options.lua`, and autogenerate the corresponding C
variables and enums.
Supersedes #28659
Co-authored-by: glepnir <glephunter@gmail.com>
|
| | |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Problem:
Variables are often assigned multiple places in common patterns.
Solution:
Replace these common patterns with different patterns that reduce the
number of assignments.
Use `MAX` and `MIN`:
```c
if (x < y) {
x = y;
}
// -->
x = MAX(x, y);
```
```c
if (x > y) {
x = y;
}
// -->
x = MIN(x, y);
```
Use ternary:
```c
int a;
if (cond) {
a = b;
} els {
a = c;
}
// -->
int a = cond ? b : c;
```
|
| |
|
|
|
|
|
|
|
|
| |
buffer (#29569)
Problem: Cursor is moved to bottom of window trying to pagescroll when
already at the start of the buffer (Asheq Imran, after v9.1.0357)
Solution: Don't move cursor when buffer content did not move.
(Luuk van Baal)
https://github.com/vim/vim/commit/8ccb89016e4b4b7f87acd1da78486c077350ceef
|
| |
|
|
|
|
|
|
|
|
|
| |
Problem: Current instance of last search pattern not easily spotted.
Solution: Add CurSearch highlighting. (closes vim/vim#10133)
https://github.com/vim/vim/commit/a43993897aa372159f682df37562f159994dc85c
Some code is superseded by later patches that are already ported.
Co-authored-by: LemonBoy <thatlemon@gmail.com>
|
| | |
|
|