Compare commits

...

3 Commits

Author SHA1 Message Date
Luna Razzaghipour
f9ce939bf5 perf: scheduler priority clamping on macOS #35488
Problem:
All of Nvim’s threads are clamped to the Default QoS class. This means
that Nvim is forced to compete for CPU time with compilers and other
batch work, and is even prioritized beneath user-initiated work in GUI
apps like e.g. file imports. This significantly harms responsiveness.

Solution:
Tell the kernel that the Nvim process takes part in rendering a UI.

Implementation:
Remove the process-wide QoS clamp. This doesn’t directly do anything to
the main thread, but rather has the side-effect of letting the main
thread run at its actual QoS (User Interactive QoS).
2025-09-02 18:34:46 -07:00
zeertzjq
1ae09bf545 vim-patch:4c39d0c: runtime(doc): quote partial urls with a backtick (#35606)
closes: vim/vim#18194

4c39d0cc9b

Co-authored-by: Yochem van Rosmalen <git@yochem.nl>
2025-09-03 09:07:01 +08:00
Evgeni Chasnovski
431004dda2 fix: screenchar()/screenstring() with hidden floating windows #35560 2025-09-02 11:21:19 -07:00
6 changed files with 61 additions and 11 deletions

View File

@@ -649,11 +649,11 @@ ask you where to write the file (there must be a writable directory in
'runtimepath' for this).
The plugin has a default place where to look for spell files, on the Vim ftp
server. The protocol used is SSL (https://) for security. If you want to use
another location or another protocol, set the g:spellfile_URL variable to the
directory that holds the spell files. You can use http:// or ftp://, but you
are taking a security risk then. The |netrw| plugin is used for getting the
file, look there for the specific syntax of the URL. Example: >
server. The protocol used is TLS (`https://`) for security. If you want to
use another location or another protocol, set the g:spellfile_URL variable to
the directory that holds the spell files. You can use `http://` or `ftp://`,
but you are taking a security risk then. The |netrw| plugin is used for
getting the file, look there for the specific syntax of the URL. Example: >
let g:spellfile_URL = 'https://ftp.nluug.nl/vim/runtime/spell'
You may need to escape special characters.

View File

@@ -136,10 +136,10 @@ might want to try the manual way of downloading the file.
Accessing files over the internet works with the netrw plugin. Currently URLs
with these formats are recognized:
ftp:// uses ftp
rcp:// uses rcp
scp:// uses scp
http:// uses wget (reading only)
`ftp://` uses ftp
`rcp://` uses rcp
`scp://` uses scp
`http://` uses wget (reading only)
Vim doesn't do the communication itself, it relies on the mentioned programs
to be available on your computer. On most Unix systems "ftp" and "rcp" will
@@ -147,7 +147,7 @@ be present. "scp" and "wget" might need to be installed.
Vim detects these URLs for each command that starts editing a new file, also
with ":edit" and ":split", for example. Write commands also work, except for
http://.
`http://`.
For more information, also about passwords, see |netrw|.

View File

@@ -188,6 +188,7 @@ static bool event_teardown(void)
/// Needed for unit tests.
void early_init(mparm_T *paramp)
{
os_hint_priority();
estack_init();
cmdline_init();
eval_init(); // init global variables

View File

@@ -39,6 +39,10 @@
# include "nvim/fileio.h"
#endif
#ifdef __APPLE__
# include <mach/task.h>
#endif
#ifdef HAVE__NSGETENVIRON
# include <crt_externs.h>
#endif
@@ -367,6 +371,18 @@ int64_t os_get_pid(void)
#endif
}
/// Signals to the OS that Nvim is an application for "interactive work"
/// which should be prioritized similar to a GUI app.
void os_hint_priority(void)
{
#ifdef __APPLE__
// By default, processes have the TASK_UNSPECIFIED "role", which means all of its threads are
// clamped to Default QoS. Setting the role to TASK_DEFAULT_APPLICATION removes this clamp.
integer_t policy = TASK_DEFAULT_APPLICATION;
task_policy_set(mach_task_self(), TASK_CATEGORY_POLICY, &policy, 1);
#endif
}
/// Gets the hostname of the current machine.
///
/// @param hostname Buffer to store the hostname.

View File

@@ -335,7 +335,8 @@ ScreenGrid *ui_comp_get_grid_at_coord(int row, int col)
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
ScreenGrid *grid = &wp->w_grid_alloc;
if (row >= grid->comp_row && row < grid->comp_row + grid->rows
&& col >= grid->comp_col && col < grid->comp_col + grid->cols) {
&& col >= grid->comp_col && col < grid->comp_col + grid->cols
&& !wp->w_config.hide) {
return grid;
}
}

View File

@@ -76,7 +76,39 @@ describe('screenchar() and family respect floating windows', function()
describe('with ext_multigrid', function()
with_ext_multigrid(true)
end)
describe('without ext_multigrid', function()
with_ext_multigrid(false)
end)
describe('hidden windows', function()
before_each(function()
clear()
Screen.new(40, 7, {})
api.nvim_buf_set_lines(0, 0, -1, true, { 'aaa', 'aaa' })
end)
local assert_screen_funcs = function()
eq('a', fn.screenstring(1, 1))
eq(97, fn.screenchar(1, 1))
eq({ 97 }, fn.screenchars(1, 1))
eq(fn.screenattr(2, 1), fn.screenattr(1, 1))
end
it('manual', function()
local bufnr = api.nvim_create_buf(false, true)
api.nvim_buf_set_lines(bufnr, 0, -1, true, { 'bb' })
local win_opts = { relative = 'editor', row = 0, col = 0, height = 1, width = 2, hide = true }
api.nvim_open_win(bufnr, false, win_opts)
assert_screen_funcs()
end)
it('from ui2', function()
n.exec_lua('require("vim._extui").enable({ enable = true })')
command('echo "foo"')
assert_screen_funcs()
end)
end)
end)