Age | Commit message (Collapse) | Author |
|
Problem: The call to redraw_for_cursorline() in nv_mousescroll() is
unnecessary because redraw_for_cursorline() only sets redraw
type to UPD_VALID, and all code paths in do_mousescroll()
already set redraw type to at least UPD_VALID.
Solution: Remove call to redraw_for_cursorline() in nv_mousescroll().
(zeertzjq)
closes: #13979
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
|
|
Problem: Things that temporarily change/restore curwin/buf (e.g:
win_execute, some autocmds) may break assumptions that
curwin/buf is the cmdwin when "cmdwin_type != 0", causing
issues.
Solution: Expose the cmdwin's real win/buf and check that instead. Also
try to ensure these variables are NULL if "cmdwin_type == 0",
allowing them to be used directly in most cases without
checking cmdwin_type. (Sean Dewar)
Alternatively, we could ban win_execute in the cmdwin and audit all places that
temporarily change/restore curwin/buf, but I didn't notice any problems arising
from allowing this (standard cmdwin restrictions still apply, so things that may
actually break the cmdwin are still forbidden).
closes: #12819
Signed-off-by: Sean Dewar <seandewar@users.noreply.github.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
|
|
Problem: screenpos() may crash with neg. column
Solution: validate and correct column
closes: #13669
Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
|
|
Problem: [security]: FPE in adjust_plines_for_skipcol
Solution: don't divide by zero, return zero
Prevent a floating point exception when calculating w_skipcol (which can
happen with a small window when the number option is set and cpo+=n).
Add a test to verify
Signed-off-by: Christian Brabandt <cb@256bit.org>
|
|
Problem: Skipcol is not reset when topline changed scrolling cursor to top
Solution: reset skipcol
closes: #13528
closes: #13532
Signed-off-by: Luuk van Baal <luukvbaal@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
|
|
Problem: Cannot accurately get mouse clicking position when clicking on
a TAB or with virtual text.
Solution: Add a "coladd" field to getmousepos() result.
closes: #13335
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
|
|
Problem: When clicking in the middle of a TAB, getmousepos() returns
the column of the next char instead of the TAB.
Solution: Break out of the loop when the vcol to find is inside current
char. Fix invalid memory access when calling virtcol2col() on
an empty line.
closes: #13321
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
|
|
Problem: partially revert patch v9.0.1997
Solution: add a comment, to make clear it's not used
related: #13288
Signed-off-by: Christian Brabandt <cb@256bit.org>
|
|
Problem: Some unused code in move.c and string.c
Solution: Remove it
closes: #13288
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: dundargoc <gocdundar@gmail.com>
|
|
Problem: Scrolling non-current window using mouse is inconsistent
depending on 'scrollbind'/'scrolloff' and different from GUI
vertical scrollbar when 'cursorbind' is set.
Solution: Don't move cursor in non-current windows for 'cursorbind' if
cursor in the current window didn't move.
closes: #13219
closes: #13210
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
|
|
Problem: Cannot scroll up in diff mode with many filler lines and zero
'scrolloff'.
Solution: Invalidate w_cline_row before calling comp_botline().
closes: #13256
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
|
|
Problem: Clean up cmdline option completion code
Solution: Fix various minor problems
- Fix manual array size calculations to just use `ARRAY_LENGTH()`.
- Fix unintentional typo in comments due to copy-paste error.
- Fix assert_equal() usages to pass the expected value to first
parameter instead of 2nd one to avoid confusion.
- Fix signed vs unsigned warnings
- Correct misplaced comments about set_op_T and set_prefix_T
and fix a typo in another comment
closes: #13249
closes: #13237
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
|
|
Problem: Cursor position still wrong with 'showbreak' and virtual text
after last character or 'listchars' "eol".
Solution: Remove unnecessary w_wcol adjustment in curs_columns(). Also
fix first char of virtual text not shown at the start of a screen
line.
closes: #12478
closes: #12532
closes: #12904
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
|
|
Problem: wrong cursor position with 'showbreak' and lcs-eol
Solution: Add size of 'showbreak' before when 'listchars' "eol" is used.
Also fix wrong cursor position with wrapping virtual text on
empty line and 'showbreak'.
closes: #12891
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
|
|
Problem: screenpos() may cause unnecessary redraw.
Solution: Don't unnecessarily reset VALID_WROW flag.
VALID_WROW flag is only used by two functions: validate_cursor() and
cursor_valid(), and cursor_valid() is only used once in ex_sleep().
When adjust_plines_for_skipcol() was first added in patch 9.0.0640, it
was called in two functions: comp_botline() and curs_rows().
- comp_botline() is called in two places:
- onepage(), which resets VALID_WROW flag immediately afterwards.
- validate_botline_win(), where resetting a VALID_ flag is strange.
- curs_rows() is called in two places:
- curs_columns(), which sets VALID_WROW flag afterwards.
- validate_cline_row(), which is only used by GUI mouse focus.
Therefore resetting VALID_WROW there doesn't seem to do anything useful.
Also, a w_skipcol check (which resets VALID_WROW flag) was added to
check_cursor_moved() in patch 9.0.0734, which seems to make more sense
than resetting that flag in the middle of a computation.
While at it make adjust_plines_for_skipcol() and textpos2screenpos() a
bit less confusing:
- Make adjust_plines_for_skipcol() return "off" instead of "n - off".
- Use 0-based "row" in textpos2screenpos() until W_WINROW is added.
closes: #12832
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
|
|
Problem: screenpos() wrong result with w_skipcol and cpoptions+=n
Solution: Use adjust_plines_for_skipcol() instead of subtracting
w_skipcol.
closes: #12625
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: zeertzjq <zeertzjq@outlook.com>
|
|
Problem: virtcol2col returns last byte of a multi-byte char
Solution: Make it return the first byte for a multi-byte char
closes: #12786
closes: #12799
Signed-off-by: Christian Brabandt <cb@256bit.org>
Co-authored-by: Yegappan Lakshmanan <yegappan@yahoo.com>
|
|
Problem: Divide by zero when scrolling with 'smoothscroll' set.
Solution: Avoid using a negative width. (closes #12540, closes #12528)
|
|
Problem: "skipcol" not reset when using multi-byte characters.
Solution: Compare with w_virtcol instead of w_cursor.col. (closes #12457)
|
|
Problem: Display is wrong when 'smoothscroll' is set and scrolling multiple
lines.
Solution: Redraw with UPD_NOT_VALID when "skipcol" is or was set.
(closes #12490, closes #12468)
|
|
Problem: screenpos() returns wrong row with diff filler lines.
Solution: Only add filler lines when appropriate. Also don't add the
'smoothscroll' marker when w_skipcol is zero. (closes #12485,
closes #12484)
|
|
Problem: Display wrong when scrolling multiple lines with 'smoothscroll'
set.
Solution: Redraw when w_skipcol changed. (closes #12477, closes #12468)
|
|
Problem: screenpos() does not take w_skipcol into account.
Solution: Subtract w_skipcol from column. (closes #12486, closes #12476)
|
|
Problem: Cursor ends up below the window after a put.
Solution: Mark w_crow and w_botline invalid when changing the cursor line.
(closes #12465)
|
|
Problem: With 'smoothscroll' cursor may move below botline.
Solution: Call redraw_later() if needed, Compute cursor row with adjusted
condition. (Luuk van Baal, closes #12415)
|
|
Problem: Display moves up and down with 'incsearch' and 'smoothscroll'.
Solution: Do not check if w_skipcol changed. (Luuk van Baal, closes #12410,
closes #12409)
|
|
Problem: Display wrong when moving cursor to above the top line and
'smoothscroll' is set.
Solution: Call adjust_skipcol() in more places and make it work better.
(Luuk van Baal, closes #12395)
|
|
Problem: Position of marker for 'smoothscroll' not computed correctly.
Solution: Take 'list' and other options into account. (Luuk van Baal,
closes #12393)
|
|
Problem: Line not fully displayed if it doesn't fit in the screen.
Solution: Do not reset s_skipcol if not needed. (Luuk van Baal,
closes #12376)
|
|
Problem: Cursor moves to wrong line when 'foldmethod' is "diff". (Rick
Howe)
Solution: Adjust logic for scrolling. (Luuk van Baal, closes #12364,
closes #12218)
|
|
Problem: 'smoothscroll' does not always work properly.
Solution: Do not reset w_skipcol after it was intentionally set. (Luuk van
Baal, closes #12360, closes #12199, closes #12323)
|
|
Problem: Inserting lines when scrolling with 'smoothscroll' set.
Solution: Adjust line height computation for w_skipcol. (Luuk van Baal,
closes #12350)
|
|
Problem: Scrolling too many lines when 'wrap' and 'diff' are set.
Solution: Only scroll by screenlines for 'diff' when 'wrap' is not set.
(closes #12211)
|
|
Problem: Unused variables and functions.
Solution: Delete items and adjust #ifdefs. (Dominique Pellé, closes #12145)
|
|
Problem: Divide by zero in zero-width window.
Solution: Check the width is positive.
|
|
Problem: Scrolling two lines with even line count and 'scrolloff' set.
Solution: Adjust how the topline is computed. (closes #10545)
|
|
Problem: Divide by zero with 'smoothscroll' set and a narrow window.
Solution: Bail out when the window is too narrow.
|
|
Problem: Code is indented more than necessary.
Solution: Use an early return where it makes sense. (Yegappan Lakshmanan,
closes #11813)
|
|
Problem: Cursor positioning and display problems with 'smoothscroll' and
using "zt", "zb" or "zz".
Solution: Adjust computations and conditions. (Yee Cheng Chin,
closes #11764)
|
|
Problem: screenpos() column result in fold may be too small.
Solution: Add space of 'number', sign column, etc. (closes #11715)
|
|
Problem: screenpos() does not count filler lines for diff mode.
Solution: Add filler lines. (closes 11658)
|
|
Problem: ml_get error when using screenpos().
Solution: Give an error for the line number. (closes #11661)
|
|
Problem: With 'smoothscroll' skipcol may be reset unnecessarily.
Solution: Check the line does actually fit in the window.
|
|
Problem: "gk" may reset skipcol when not needed.
Solution: Only reset skipcol if the cursor column is less.
|
|
Problem: Display errors when adding or removing text property type.
Solution: Perform a full redraw. Only use text properties for which the
type is defined. (closes #11655)
|
|
Problem: With 'smoothscroll' cursor may end up in wrong position.
Solution: Correct the computation of screen lines. (Yee Cheng Chin,
closes #11502)
|
|
Problem: Various comment and indent flaws.
Solution: Improve comments and indenting.
|
|
Problem: Cursor moves too far with 'smoothscroll'.
Solution: Only move as far as really needed. (Yee Cheng Chin, closes #11504)
|
|
Problem: 'smoothscroll' cursor calculations wrong when 'number' is set.
Solution: Correct the code that computes the width. (closes #11492)
|
|
Problem: May redraw when not needed, causing slow scrolling.
Solution: Do not redraw when w_skipcol doesn't change. When w_skipcol
changes only redraw from the top. (issue #11559)
|