summaryrefslogtreecommitdiffstats
path: root/src/move.c
AgeCommit message (Collapse)Author
2024-02-06patch 9.1.0077: Unnecessary call to redraw_for_cursorline() in nv_mousescroll()v9.1.0077zeertzjq
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>
2024-01-23patch 9.1.0047: issues with temp curwin/buf while cmdwin is openv9.1.0047Sean Dewar
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>
2023-12-12patch 9.0.2159: screenpos() may crash with neg. columnv9.0.2159zeertzjq
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>
2023-11-16patch 9.0.2107: [security]: FPE in adjust_plines_for_skipcolv9.0.2107Christian Brabandt
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>
2023-11-14patch 9.0.2105: skipcol not reset when topline changedv9.0.2105Luuk van Baal
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>
2023-10-15patch 9.0.2032: cannot get mouse click pos for tab or virt textv9.0.2032zeertzjq
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>
2023-10-14patch 9.0.2022: getmousepos() returns wrong index for TAB charv9.0.2022zeertzjq
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>
2023-10-09patch 9.0.2005: partially revert patch v9.0.1997v9.0.2005Christian Brabandt
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>
2023-10-06patch 9.0.1997: Some unused code in move.c and string.cv9.0.1997dundargoc
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>
2023-10-04patch 9.0.1983: scrolling inactive window not possible with cursorbindv9.0.1983zeertzjq
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>
2023-10-04patch 9.0.1981: not being able to scroll up in diff modev9.0.1981zeertzjq
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>
2023-10-02patch 9.0.1973: Clean up cmdline option completion codev9.0.1973Yee Cheng Chin
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>
2023-08-27patch 9.0.1800: Cursor position still wrong with 'showbreak' and virtual textv9.0.1800zeertzjq
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>
2023-08-23patch 9.0.1785: wrong cursor position with 'showbreak' and lcs-eolv9.0.1785zeertzjq
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>
2023-08-19patch 9.0.1747: screenpos() may cause unnecessary redrawv9.0.1747zeertzjq
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>
2023-08-17patch 9.0.1729: screenpos() wrong when w_skipcol and cpoptions+=nv9.0.1729zeertzjq
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>
2023-08-15patch 9.0.1717: virtcol2col returns last byte of a multi-byte charv9.0.1717Yegappan Lakshmanan
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>
2023-06-24patch 9.0.1664: divide by zero when scrolling with 'smoothscroll' setv9.0.1664fullwaywang
Problem: Divide by zero when scrolling with 'smoothscroll' set. Solution: Avoid using a negative width. (closes #12540, closes #12528)
2023-06-05patch 9.0.1612: "skipcol" not reset when using multi-byte charactersv9.0.1612Bram Moolenaar
Problem: "skipcol" not reset when using multi-byte characters. Solution: Compare with w_virtcol instead of w_cursor.col. (closes #12457)
2023-06-05patch 9.0.1610: display is wrong when 'smoothscroll' is setv9.0.1610zeertzjq
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)
2023-06-04patch 9.0.1607: screenpos() returns wrong row with diff filler linesv9.0.1607zeertzjq
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)
2023-06-03patch 9.0.1603: display wrong if scrolling multiple lines with 'smoothscroll'v9.0.1603zeertzjq
Problem: Display wrong when scrolling multiple lines with 'smoothscroll' set. Solution: Redraw when w_skipcol changed. (closes #12477, closes #12468)
2023-06-03patch 9.0.1600: screenpos() does not take w_skipcol into accountv9.0.1600zeertzjq
Problem: screenpos() does not take w_skipcol into account. Solution: Subtract w_skipcol from column. (closes #12486, closes #12476)
2023-06-01patch 9.0.1597: cursor ends up below the window after a putv9.0.1597Bram Moolenaar
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)
2023-05-19patch 9.0.1568: with 'smoothscroll' cursor may move below botlinev9.0.1568Luuk van Baal
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)
2023-05-18patch 9.0.1564: display moves up and down with 'incsearch' and 'smoothscroll'v9.0.1564Luuk van Baal
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)
2023-05-15patch 9.0.1561: display wrong when moving cursor to above the top linev9.0.1561Luuk van Baal
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)
2023-05-13patch 9.0.1551: position of marker for 'smoothscroll' not computed correctlyv9.0.1551Luuk van Baal
Problem: Position of marker for 'smoothscroll' not computed correctly. Solution: Take 'list' and other options into account. (Luuk van Baal, closes #12393)
2023-05-11patch 9.0.1542: line not fully displayed if it doesn't fit in the screenv9.0.1542Luuk van Baal
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)
2023-05-09patch 9.0.1530: cursor moves to wrong line when 'foldmethod' is "diff"v9.0.1530Luuk van Baal
Problem: Cursor moves to wrong line when 'foldmethod' is "diff". (Rick Howe) Solution: Adjust logic for scrolling. (Luuk van Baal, closes #12364, closes #12218)
2023-05-08patch 9.0.1525: 'smoothscroll' does not always work properlyv9.0.1525Luuk van Baal
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)
2023-05-06patch 9.0.1512: inserting lines when scrolling with 'smoothscroll' setv9.0.1512Luuk van Baal
Problem: Inserting lines when scrolling with 'smoothscroll' set. Solution: Adjust line height computation for w_skipcol. (Luuk van Baal, closes #12350)
2023-04-01patch 9.0.1435: scrolling too many lines when 'wrap' and 'diff' are setv9.0.1435Bram Moolenaar
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)
2023-03-12patch 9.0.1403: unused variables and functionsv9.0.1403Dominique Pelle
Problem: Unused variables and functions. Solution: Delete items and adjust #ifdefs. (Dominique Pellé, closes #12145)
2023-03-01patch 9.0.1367: divide by zero in zero-width windowv9.0.1367Bram Moolenaar
Problem: Divide by zero in zero-width window. Solution: Check the width is positive.
2023-02-14patch 9.0.1309: scrolling two lines with even line count and 'scrolloff' setv9.0.1309Bram Moolenaar
Problem: Scrolling two lines with even line count and 'scrolloff' set. Solution: Adjust how the topline is computed. (closes #10545)
2023-01-26patch 9.0.1247: divide by zero with 'smoothscroll' set and a narrow windowv9.0.1247Bram Moolenaar
Problem: Divide by zero with 'smoothscroll' set and a narrow window. Solution: Bail out when the window is too narrow.
2023-01-14patch 9.0.1196: code is indented more than necessaryv9.0.1196Yegappan Lakshmanan
Problem: Code is indented more than necessary. Solution: Use an early return where it makes sense. (Yegappan Lakshmanan, closes #11813)
2022-12-31patch 9.0.1121: cursor positioning and display problems with 'smoothscroll'v9.0.1121Bram Moolenaar
Problem: Cursor positioning and display problems with 'smoothscroll' and using "zt", "zb" or "zz". Solution: Adjust computations and conditions. (Yee Cheng Chin, closes #11764)
2022-12-18patch 9.0.1072: screenpos() column result in fold may be too smallv9.0.1072zeertzjq
Problem: screenpos() column result in fold may be too small. Solution: Add space of 'number', sign column, etc. (closes #11715)
2022-12-05patch 9.0.1016: screenpos() does not count filler lines for diff modev9.0.1016Bram Moolenaar
Problem: screenpos() does not count filler lines for diff mode. Solution: Add filler lines. (closes 11658)
2022-12-05patch 9.0.1011: ml_get error when using screenpos()v9.0.1011Bram Moolenaar
Problem: ml_get error when using screenpos(). Solution: Give an error for the line number. (closes #11661)
2022-12-03patch 9.0.1000: with 'smoothscroll' skipcol may be reset unnecessarilyv9.0.1000Bram Moolenaar
Problem: With 'smoothscroll' skipcol may be reset unnecessarily. Solution: Check the line does actually fit in the window.
2022-12-03patch 9.0.0998: "gk" may reset skipcol when not neededv9.0.0998Bram Moolenaar
Problem: "gk" may reset skipcol when not needed. Solution: Only reset skipcol if the cursor column is less.
2022-12-02patch 9.0.0993: display errors when adding or removing text property typev9.0.0993Bram Moolenaar
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)
2022-11-19patch 9.0.0908: with 'smoothscroll' cursor may end up in wrong positionv9.0.0908Yee Cheng Chin
Problem: With 'smoothscroll' cursor may end up in wrong position. Solution: Correct the computation of screen lines. (Yee Cheng Chin, closes #11502)
2022-11-18patch 9.0.0904: various comment and indent flawsv9.0.0904Bram Moolenaar
Problem: Various comment and indent flaws. Solution: Improve comments and indenting.
2022-11-18patch 9.0.0900: cursor moves too far with 'smoothscroll'v9.0.0900Yee Cheng Chin
Problem: Cursor moves too far with 'smoothscroll'. Solution: Only move as far as really needed. (Yee Cheng Chin, closes #11504)
2022-11-17patch 9.0.0893: 'smoothscroll' cursor calculations wrong when 'number' is setv9.0.0893Yee Cheng Chin
Problem: 'smoothscroll' cursor calculations wrong when 'number' is set. Solution: Correct the code that computes the width. (closes #11492)
2022-11-17patch 9.0.0892: may redraw when not neededv9.0.0892Bram Moolenaar
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)