aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/mouse.c
Commit message (Collapse)AuthorAge
* refactor: move function macros out of vim_defs.h (#26300)zeertzjq2023-11-29
|
* refactor: fix headers with IWYUdundargoc2023-11-28
|
* refactor: rename types.h to types_defs.hdundargoc2023-11-27
|
* build(IWYU): fix includes for undo_defs.hdundargoc2023-11-27
|
* build(IWYU): fix includes for func_attr.hdundargoc2023-11-27
|
* fix(mouse): avoid dragging when clicking next to popupmenu (#26201)luukvbaal2023-11-25
|
* fix(mouse): avoid dragging after click label popupmenu callback (#26187)luukvbaal2023-11-24
|
* refactor: follow style guidedundargoc2023-11-19
| | | | | - reduce variable scope - prefer initialization over declaration and assignment
* build: remove PVSdundargoc2023-11-12
| | | | | | | We already have an extensive suite of static analysis tools we use, which causes a fair bit of redundancy as we get duplicate warnings. PVS is also prone to give false warnings which creates a lot of work to identify and disable.
* refactor: the long goodbyedundargoc2023-11-05
| | | | | | long is 32 bits on windows, while it is 64 bits on other architectures. This makes the type suboptimal for a codebase meant to be cross-platform. Replace it with more appropriate integer types.
* vim-patch:9.0.2032: cannot get mouse click pos for tab or virt text (#25653)zeertzjq2023-10-15
| | | | | | | | | 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: vim/vim#13335 https://github.com/vim/vim/commit/f5a94d5165bb9e390797da50a1fa7a87df3fbee4
* vim-patch:9.0.2022: getmousepos() returns wrong index for TAB char (#25636)zeertzjq2023-10-14
| | | | | | | | | | | 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: vim/vim#13321 https://github.com/vim/vim/commit/b583eda7031b1f6a3469a2537d0c10ca5fa5568e
* refactor: reorganize option header files (#25437)zeertzjq2023-09-30
| | | | | | - Move vimoption_T to option.h - option_defs.h is for option-related types - option_vars.h corresponds to Vim's option.h - option_defs.h and option_vars.h don't include each other
* build(iwyu): add a few more _defs.h mappings (#25435)zeertzjq2023-09-30
|
* vim-patch:9.0.1923: curswant wrong on click with 've' and 'nowrap' set (#25293)zeertzjq2023-09-22
| | | | | | | | Problem: curswant wrong on click with 've' and 'nowrap' set Solution: Add w_leftcol to mouse click column. closes: vim/vim#13142 https://github.com/vim/vim/commit/db54e989b5cff3cc6442dfc500e3962cc1c0b6d0
* fix(mouse): click on empty line with 'foldcolumn'zeertzjq2023-09-21
|
* vim-patch:9.0.1919: Wrong curswant when clicking on empty line or with vsplitszeertzjq2023-09-21
| | | | | | | | | | Problem: Wrong curswant when clicking on empty line or with vsplits. Solution: Don't check for ScreenCols[] before the start of the window and handle empty line properly. closes: vim/vim#13132 https://github.com/vim/vim/commit/03cd697d635f1b0e7ffe21cf8244a8fb755f2ddb
* refactor(grid): change schar_T representation to be more compactbfredl2023-09-19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously, a screen cell would occupy 28+4=32 bytes per cell as we always made space for up to MAX_MCO+1 codepoints in a cell. As an example, even a pretty modest 50*80 screen would consume 50*80*2*32 = 256000, i e a quarter megabyte With the factor of two due to the TUI side buffer, and even more when using msg_grid and/or ext_multigrid. This instead stores a 4-byte union of either: - a valid UTF-8 sequence up to 4 bytes - an escape char which is invalid UTF-8 (0xFF) plus a 24-bit index to a glyph cache This avoids allocating space for huge composed glyphs _upfront_, while still keeping rendering such glyphs reasonably fast (1 hash table lookup + one plain index lookup). If the same large glyphs are using repeatedly on the screen, this is still a net reduction of memory/cache consumption. The only case which really gets worse is if you blast the screen full with crazy emojis and zalgo text and even this case only leads to 4 extra bytes per char. When only <= 4-byte glyphs are used, plus the 4-byte attribute code, i e 8 bytes in total there is a factor of four reduction of memory use. Memory which will be quite hot in cache as the screen buffer is scanned over in win_line() buffer text drawing A slight complication is that the representation depends on host byte order. I've tested this manually by compling and running this in qemu-s390x and it works fine. We might add a qemu based solution to CI at some point.
* fix(mouse): click on 'statuscolumn' with 'rightleft' (#25090)zeertzjq2023-09-11
|
* refactor(memline): distinguish mutating uses of ml_get_buf()bfredl2023-08-24
| | | | | | | | | | | | | | ml_get_buf() takes a third parameters to indicate whether the caller wants to mutate the memline data in place. However the vast majority of the call sites is using this function just to specify a buffer but without any mutation. This makes it harder to grep for the places which actually perform mutation. Solution: Remove the bool param from ml_get_buf(). it now works like ml_get() except for a non-current buffer. Add a new ml_get_buf_mut() function for the mutating use-case, which can be grepped along with the other ml_replace() etc functions which can modify the memline.
* fix(terminal): handle horizontal scrolling in another window (#24828)zeertzjq2023-08-21
|
* vim-patch:9.0.0906: mouse scroll code is not optimalzeertzjq2023-08-21
| | | | | | | | | | Problem: Mouse scroll code is not optimal. Solution: Properly organise Normal mode, Insert mode and common code. (Christopher Plewright, closes vim/vim#11572) https://github.com/vim/vim/commit/ff95ce0930e6db0037fe8d1fc875a6522b054582 Co-authored-by: Christopher Plewright <chris@createng.com>
* vim-patch:9.0.0902: some mouse scroll code is not in a good placezeertzjq2023-08-21
| | | | | | | | | Problem: Some mouse scroll code is not in a good place. Solution: Refactor the code. (Christopher Plewright, closes vim/vim#11561) https://github.com/vim/vim/commit/696d0a86250636602d42e29e57d8923f538e0549 Co-authored-by: Christopher Plewright <chris@createng.com>
* vim-patch:9.0.0886: horizontal mouse scroll only works in the GUIzeertzjq2023-08-21
| | | | | | | | | | Problem: Horizontal mouse scroll only works in the GUI. Solution: Make horizontal mouse scroll also work in a terminal. (Christopher Plewright, closes vim/vim#11448) https://github.com/vim/vim/commit/44c2209352d56d70b1fc0215e81f1822d55aa563 Co-authored-by: Christopher Plewright <chris@createng.com>
* vim-patch:8.1.2062: the mouse code is spread out (#24817)zeertzjq2023-08-21
| | | | | | | | | | | | | | | | | | | | | Problem: The mouse code is spread out. Solution: Move all the mouse code to mouse.c. (Yegappan Lakshmanan, closes vim/vim#4959) https://github.com/vim/vim/commit/b20b9e14ddd8db111e886ad0494e15b955159426 Also move getmousepos() there. N/A patches for version.c: vim-patch:8.1.2070: mouse code is spread out Problem: Mouse code is spread out. Solution: Move mouse terminal code parsing to mouse.c. (Yegappan Lakshmanan, closes vim/vim#4966) https://github.com/vim/vim/commit/b8ff5c271ee5dcef6f63436b77e228e062ff9a0e Co-authored-by: Bram Moolenaar <Bram@vim.org>
* vim-patch:9.0.1725: cursor pos wrong after concealed text with 'virtualedit'zeertzjq2023-08-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: Wrong cursor position when clicking after concealed text with 'virtualedit'. Solution: Store virtual columns in ScreenCols[] instead of text columns, and always use coladvance() when clicking. This also fixes incorrect curswant when clicking on a TAB, so now Test_normal_click_on_ctrl_char() asserts the same results as the ones before patch 9.0.0048. closes: vim/vim#12808 https://github.com/vim/vim/commit/e500ae8e29ad921378085f5d70ee5c0c537be1ba Remove the mouse_adjust_click() function. There is a difference in behavior with the old mouse_adjust_click() approach: when clicking on the character immediately after concealed text that is completely hidden, cursor is put on the clicked character rather than at the start of the concealed text. The new behavior is better, but it causes unnecessary scrolling in a functional test (which is an existing issue unrelated to these patches), so adjust the test. Now fully merged: vim-patch:9.0.0177: cursor position wrong with 'virtualedit' and mouse click
* fix(mouse): drag vsep of window with 'statuscolumn' (#24462)zeertzjq2023-07-24
| | | | | | Problem: Cannot drag a vertical separator to the right of a window whose 'statuscolumn' is wider than itself. Solution: Never treat a click on a vertical separator as a click on 'statuscolumn'.
* fix(mouse): copy the line before syntax matching (#24320)zeertzjq2023-07-12
|
* refactor: remove longdundargoc2023-07-03
| | | | | long is 32-bits even on 64-bit windows which makes the type suboptimal for a codebase meant to be cross-platform.
* fix(mouse): handle folded lines with virt_lines attached to line above (#23912)zeertzjq2023-06-05
|
* fix(mouse): fix popup menu position check with winbar (#23456)zeertzjq2023-05-03
|
* fix(ui): adjust 'smoothscroll' for inner dimensionsLuuk van Baal2023-05-02
|
* vim-patch:9.0.0911: with 'smoothscroll' set mouse click position may be wrongLuuk van Baal2023-05-02
| | | | | | | | | Problem: With 'smoothscroll' set mouse click position may be wrong. Solution: Adjust computations for w_skipcol. (Yee Cheng Chin, closes vim/vim#11514) https://github.com/vim/vim/commit/e6392b102151ec69fad232bcf00591230cef8e1c Co-authored-by: Yee Cheng Chin <ychin.git@gmail.com>
* vim-patch:9.0.0901: setting w_leftcol and handling side effects is confusingLuuk van Baal2023-05-02
| | | | | | | | | Problem: Setting w_leftcol and handling side effects is confusing. Solution: Use a function to set w_leftcol() and handle side effects. https://github.com/vim/vim/commit/0c34d562647f029faca40f7733ccfb7b5377672b Co-authored-by: Bram Moolenaar <Bram@vim.org>
* fix(mouse): fix popup_setpos position check with ext_multigrid (#23436)zeertzjq2023-05-02
|
* refactor: uncrustifydundargoc2023-04-26
| | | | Notable changes: replace all infinite loops to `while(true)` and remove `int` from `unsigned int`.
* fix(statusline): also allow right click when 'mousemodel' is "popup*" (#23258)luukvbaal2023-04-25
| | | | | Problem: The 'statusline'-format ui elements do not receive right click events when "mousemodel" is "popup*" Solution: Do not draw popupmenu and handle click event instead.
* fix(mouse): cmdline click registered as statuscolumn (#23163)luukvbaal2023-04-18
|
* refactor(screen): screen.c delenda estbfredl2023-03-14
| | | | | | | | | | | | | drawscreen.c vs screen.c makes absolutely no sense. The screen exists only to draw upon it, therefore helper functions are distributed randomly between screen.c and the file that does the redrawing. In addition screen.c does a lot of drawing on the screen. It made more sense for vim/vim as our grid.c is their screen.c Not sure if we want to dump all the code for option chars into optionstr.c, so keep these in a optionchar.c for now.
* refactor: reduce scope of locals as per the style guide (#22206)dundargoc2023-02-11
|
* refactor: replace char_u with char 22 (#21786)dundargoc2023-01-17
| | | Work on https://github.com/neovim/neovim/issues/459
* refactor: fix IWYU mapping file and use IWYU (#21802)dundargoc2023-01-15
| | | Also add the EXITFREE definition to main_lib rather than the nvim target, as the header generation needs the EXITFREE flag to work properly.
* refactor: replace char_u with char 21 (#21779)dundargoc2023-01-14
| | | | | refactor: replace char_u with char Work on https://github.com/neovim/neovim/issues/459
* fix(mouse): statusline click registered as statuscolumn (#21748)luukvbaal2023-01-13
| | | | | | | | fix(statuscolumn): statusline click registered as statuscolumn Problem: Status line click is registered as status status column click. Solution: Check that mouse is not on the status line. Resolve https://github.com/luukvbaal/statuscol.nvim/issues/4.
* fix(statuscolumn): fix crashes and clang/PVS warnings (#21725)zeertzjq2023-01-10
|
* feat(ui): add 'statuscolumn' optionluukvbaal2023-01-09
| | | | | | | | Problem: Unable to customize the column next to a window ('gutter'). Solution: Add 'statuscolumn' option that follows the 'statusline' syntax, allowing to customize the status column. Also supporting the %@ click execute function label. Adds new items @C and @s which will print the fold and sign columns. Line numbers and signs can be clicked, highlighted, aligned, transformed, margined etc.
* vim-patch:9.0.0259: crash with mouse click when not initialized (#21282)zeertzjq2022-12-04
| | | | | | | | Problem: Crash with mouse click when not initialized. Solution: Check TabPageIdxs[] is not NULL. https://github.com/vim/vim/commit/80525751c5ce9ed82c41d83faf9ef38667bf61b1 Co-authored-by: Bram Moolenaar <Bram@vim.org>
* build: allow IWYU to fix includes for all .c filesdundargoc2022-11-15
| | | | | | | | | | Allow Include What You Use to remove unnecessary includes and only include what is necessary. This helps with reducing compilation times and makes it easier to visualise which dependencies are actually required. Work on https://github.com/neovim/neovim/issues/549, but doesn't close it since this only works fully for .c files and not headers.
* refactor: move tabline code to statusline.c (#21008)luukvbaal2022-11-10
| | | | | | | | * refactor: move tabline code to statusline.c Problem: Tabline code is closely related to statusline, but still left over in drawscreen.c and screen.c. Solution: Move it to statusline.c. * refactor: add statusline_defs.h
* refactor: fix clang-tidy warningsdundargoc2022-11-06
| | | | | | | | Enable and fix bugprone-misplaced-widening-cast warning. Fix some modernize-macro-to-enum and readability-else-after-return warnings, but don't enable them. While the warnings can be useful, they are in general too noisy to enable.