aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/api/win_config.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: fix includes for api/autocmd.hdundargoc2023-11-27
|
* build(IWYU): export generated headersdundargoc2023-11-27
|
* build(IWYU): fix includes for undo_defs.hdundargoc2023-11-27
|
* build(IWYU): fix includes for func_attr.hdundargoc2023-11-27
|
* refactor: move Arena and ArenaMem to memory_defs.h (#26240)zeertzjq2023-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: iwyu (#26062)zeertzjq2023-11-16
|
* refactor: move some functions to winfloat.c (#26020)Raphael2023-11-16
|
* 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.
* docs: small fixes (#25585)dundargoc2023-10-29
| | | | Co-authored-by: tmummert <doczook@gmx.de> Co-authored-by: parikshit adhikari <parikshitadhikari@gmail.com>
* refactor: allow not having a `default` case for enumFamiu Haque2023-10-10
| | | | | | Problem: The style guide states that all switch statements that are not conditional on an enum must have a `default` case, but does not give any explicit guideline for switch statements that are conditional on enums. As a result, a `default` case is added in many enum switch statements, even when the switch statement is exhaustive. This is not ideal because it removes the ability to have compiler errors to easily detect unchanged switch statements when a new possible value for an enum is added. Solution: Add explicit guidelines for switch statements that are conditional on an enum, clarifying that a `default` case is not necessary if the switch statement is exhaustive. Also refactor pre-existing code with unnecessary `default` cases.
* Merge pull request #25386 from glepnir/toggle_floatbfredl2023-09-30
|\ | | | | feat(float): support toggle show float window
| * feat(float): support toggle show float windowglepnir2023-09-30
| |
* | build(iwyu): add a few more _defs.h mappings (#25435)zeertzjq2023-09-30
|/
* fix(api): get virtual text with multiple hl properly (#25307)zeertzjq2023-09-22
|
* Merge pull request #25096 from glepnir/float_winnewbfredl2023-09-20
|\ | | | | fix(float): trigger winnew event when float window create
| * fix(float): trigger winnew event when float window createglepnir2023-09-19
| |
* | Merge pull request #25214 from bfredl/glyphcachebfredl2023-09-19
|\ \ | | | | | | refactor(grid): change schar_T representation to be more compact
| * | 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.
* | Merge pull request #25148 from glepnir/fixed_optbfredl2023-09-19
|\ \ | |/ |/| fix(float): add fixed option
| * fix(float): add fixd optionglepnir2023-09-18
| |
* | Merge pull request #25078 from glepnir/aubfredl2023-09-16
|\ \ | | | | | | fix(float): don't trigger au event when enter is false
| * | fix(ui): doesn't trigger au event when enter is falseglepnir2023-09-15
| |/
* / docs: replace <pre> with ``` (#25136)Gregory Anders2023-09-14
|/
* feat(highlight): add `FloatFooter` highlight groupEvgeni Chasnovski2023-08-26
| | | | | | Problem: No clear separation of floating title and footer highlighting. Solution: Add new `FloatFooter` highlight group.
* feat(float): implement footerEvgeni Chasnovski2023-08-26
| | | | | | | | Problem: Now way to show text at the bottom part of floating window border (a.k.a. "footer"). Solution: Allows `footer` and `footer_pos` config fields similar to `title` and `title_pos`.
* refactor(float): extract "title" and "title_pos" handlingEvgeni Chasnovski2023-08-26
|
* refactor(api): use typed keysetsbfredl2023-08-07
| | | | | Initially this is just for geting rid of boilerplate, but eventually the types could get exposed as metadata
* feat(api): allow open_win/win_set_buf in the cmdwin in some casesSean Dewar2023-07-26
| | | | | | | | | | | | | | | | | | | | | | Problem: As discussed on Matrix, there was some interest in having `nvim_open_win` again be able to open floats in the cmdwin (e.g: displaying a hover doc related to what's in the cmdwin). After #23228, this was disallowed. Solution: Allow `nvim_open_win` in the cmdwin as long as `!enter` and `buffer != curbuf` (the former can cause all sorts of issues, and the latter can crash Nvim after closing cmdwin). Also allow `nvim_win_set_buf` in a similar fashion. Note that we're not *entirely* sure if this is 100% safe (cmdwin is a global-state-using-main-loop-calling beast), but this seems to work OK..? Also: - Check the buffer argument of `nvim_open_win` earlier, and abort if it's invalid (it used to still open a window in this case). - Untranslate `e_cmdwin` errors in the API (other errors in the API are not translated: although not detailed in the API contract yet, errors are supposed to be stable).
* fix(api): use text_locked() to check textlockSean Dewar2023-07-05
| | | | | | | | | | | | | | | Problem: some API functions that check textlock (usually those that can change curwin or curbuf) can break the cmdwin. Solution: make FUNC_API_CHECK_TEXTLOCK call text_locked() instead, which already checks for textlock, cmdwin and `<expr>` status. Add FUNC_API_TEXTLOCK_ALLOW_CMDWIN to allow such functions to be usable in the cmdwin if they can work properly there; the opt-in nature of this attribute should hopefully help mitigate future bugs. Also fix a regression in #22634 that made functions checking textlock usable in `<expr>` mappings, and rename FUNC_API_CHECK_TEXTLOCK to FUNC_API_TEXTLOCK.
* refactor(api): new helper macrosFamiu Haque2023-05-23
| | | | Adds new API helper macros `CSTR_AS_OBJ()`, `STATIC_CSTR_AS_OBJ()`, and `STATIC_CSTR_TO_OBJ()`, which cleans up a lot of the current code. These macros will also be used extensively in the upcoming option refactor PRs because then API Objects will be used to get/set options. This PR also modifies pre-existing code to use old API helper macros like `CSTR_TO_OBJ()` to make them cleaner.
* Merge pull request #22865 from MunifTanjim/issue-20370bfredl2023-04-10
|\ | | | | fix(api): do not re-apply win_config.style when missing
| * fix(api): do not re-apply win_config.style when missingMunif Tanjim2023-04-10
| |
* | refactor: remove redundant const char * castsii142023-04-07
|/
* refactor: replace char_u with char 23 (#21798)dundargoc2023-01-18
| | | Work on https://github.com/neovim/neovim/issues/459
* feat(float): open float relative to mouse #21531Sebastian Lyng Johansen2023-01-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Problem: No easy way to position a LSP hover window relative to mouse. Solution: Introduce another option to the `relative` key in `nvim_open_win()`. With this PR it should be possible to override the handler and do something similar to this https://github.com/neovim/neovim/pull/19481#issuecomment-1193248674 to have hover information displayed from the mouse. Test case: ```lua local util = require('vim.lsp.util') local function make_position_param(window, offset_encoding) window = window or 0 local buf = vim.api.nvim_win_get_buf(window) local row, col local mouse = vim.fn.getmousepos() row = mouse.line col = mouse.column offset_encoding = offset_encoding or util._get_offset_encoding(buf) row = row - 1 local line = vim.api.nvim_buf_get_lines(buf, row, row + 1, true)[1] if not line then return { line = 0, character = 0 } end if #line < col then return { line = 0, character = 0 } end col = util._str_utfindex_enc(line, col, offset_encoding) return { line = row, character = col } end local make_params = function(window, offset_encoding) window = window or 0 local buf = vim.api.nvim_win_get_buf(window) offset_encoding = offset_encoding or util._get_offset_encoding(buf) return { textDocument = util.make_text_document_params(buf), position = make_position_param(window, offset_encoding), } end local hover_timer = nil vim.o.mousemoveevent = true vim.keymap.set({ '', 'i' }, '<MouseMove>', function() if hover_timer then hover_timer:close() end hover_timer = vim.defer_fn(function() hover_timer = nil local params = make_params() vim.lsp.buf_request( 0, 'textDocument/hover', params, vim.lsp.with(vim.lsp.handlers.hover, { silent = true, focusable = false, relative = 'mouse', }) ) end, 500) return '<MouseMove>' end, { expr = true }) ```
* fix(ui): set stc to empty in floatwin with minimal style (#21720)Raphael2023-01-10
| | | fix(ui): set stc to emtpy in floatwin with minimal style
* fix: use enum typeRaphael2023-01-09
|
* fix: formatRaphael2023-01-09
|
* fix(ui): convert title_pos string in nvim_win_get_configRaphael2023-01-09
|
* docs(api): fix treesitter parsing errorsChristian Clason2023-01-01
|
* docs(gen): support language annotation in docstringsChristian Clason2022-12-02
|
* fix: pvs warnings (#21145)dundargoc2022-11-22
| | | | | | | | | | | * fix(PVS/V009): start file with special comment * fix(PVS/V501): identical sub-expressions for comparison * fix(PVS/V560): part of conditional expression is always true/false * fix(PVS/V593): review expression of type A = B < C * fix(PVS/V614): potentially uninitialized variable used
* 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(highlight): rename FloatBorderTitle #20988Raphael2022-11-07
| | | requested in https://github.com/neovim/neovim/pull/20184
* feat(ui): add support to display a title in the border of a float (#20184)Raphael2022-11-06
| | | add "title" and "title_pos" keys to win config dict.
* fix(docs): invalid :help links #20345Justin M. Keyes2022-09-25
| | | | | Fix those naughty single quotes. closes #20159