Compare commits

...

3 Commits

Author SHA1 Message Date
luukvbaal 3cb9658b64
Merge aa072372bd into c18d7941ef 2024-05-09 12:08:54 -04:00
dundargoc c18d7941ef build: allow sccache as compiler cache
Also enable caching for dependencies.

Closes https://github.com/neovim/neovim/issues/28670
2024-05-09 16:39:45 +02:00
Luuk van Baal aa072372bd fix(ui): flush ext_cmdline events before doing 'cmdpreview'
Problem:  The ephemeral 'cmdpreview' screen state may be cleared by an
          external command line implementation that updates the screen.
Solution: Flush the cmdline UI before updating the screen for cmdpreview.
2024-05-05 02:36:12 +02:00
4 changed files with 65 additions and 6 deletions

View File

@ -50,11 +50,6 @@ file(GLOB DOCFILES CONFIGURE_DEPENDS ${PROJECT_SOURCE_DIR}/runtime/doc/*.txt)
set_directory_properties(PROPERTIES
EP_PREFIX "${DEPS_BUILD_DIR}")
find_program(CCACHE_PRG ccache)
if(CCACHE_PRG)
set(CMAKE_C_COMPILER_LAUNCHER ${CMAKE_COMMAND} -E env CCACHE_SLOPPINESS=pch_defines,time_macros ${CCACHE_PRG})
endif()
if(NOT CI_BUILD)
set(CMAKE_INSTALL_MESSAGE NEVER)
endif()

View File

@ -23,6 +23,12 @@ if(POLICY CMP0092)
list(APPEND DEPS_CMAKE_ARGS -D CMAKE_POLICY_DEFAULT_CMP0092=NEW)
endif()
find_program(CACHE_PRG NAMES ccache sccache)
if(CACHE_PRG)
set(CMAKE_C_COMPILER_LAUNCHER ${CMAKE_COMMAND} -E env CCACHE_SLOPPINESS=pch_defines,time_macros ${CACHE_PRG})
list(APPEND DEPS_CMAKE_CACHE_ARGS -DCMAKE_C_COMPILER_LAUNCHER:STRING=${CMAKE_C_COMPILER_LAUNCHER})
endif()
# MAKE_PRG
if(UNIX)
find_program(MAKE_PRG NAMES gmake make)
@ -58,7 +64,8 @@ function(get_externalproject_options name DEPS_IGNORE_SHA)
set(EXTERNALPROJECT_OPTIONS
DOWNLOAD_NO_PROGRESS TRUE
EXTERNALPROJECT_OPTIONS URL ${${name_allcaps}_URL})
EXTERNALPROJECT_OPTIONS URL ${${name_allcaps}_URL}
CMAKE_CACHE_ARGS ${DEPS_CMAKE_CACHE_ARGS})
if(NOT ${DEPS_IGNORE_SHA})
list(APPEND EXTERNALPROJECT_OPTIONS URL_HASH SHA256=${${name_allcaps}_SHA256})

View File

@ -2562,6 +2562,10 @@ static bool cmdpreview_may_show(CommandLineState *s)
cmdpreview_ns = (int)nvim_create_namespace((String)STRING_INIT);
}
// Flush now: external cmdline may itself wish to update the screen which is
// currently disallowed during cmdpreview(no longer needed in case that changes).
cmdline_ui_flush();
// Set cmdpreview state.
cmdpreview = true;

View File

@ -37,6 +37,9 @@ describe('vim.ui_attach', function()
[2] = { bold = true },
[3] = { background = Screen.colors.Grey },
[4] = { background = Screen.colors.LightMagenta },
[5] = { reverse = true },
[6] = { reverse = true, bold = true },
[7] = { background = Screen.colors.Yellow1 },
})
screen:attach()
end)
@ -188,6 +191,56 @@ describe('vim.ui_attach', function()
feed('version<CR><CR>v<Esc>')
n.assert_alive()
end)
it("preserved 'incsearch/command' screen state after :redraw from ext_cmdline", function()
exec_lua([[
vim.cmd.norm('ifoobar')
vim.cmd('1split cmdline')
local buf = vim.api.nvim_get_current_buf()
vim.cmd.wincmd('p')
vim.ui_attach(ns, { ext_cmdline = true }, function(event, ...)
if event == 'cmdline_show' then
local content = select(1, ...)
vim.api.nvim_buf_set_lines(buf, -2, -1, false, {content[1][2]})
vim.cmd('redraw')
end
return true
end)
]])
-- Updates a cmdline window
feed(':cmdline')
screen:expect({
grid = [[
cmdline |
{5:cmdline [+] }|
fooba^r |
{6:[No Name] [+] }|
|
]],
})
-- Does not clear 'incsearch' highlighting
feed('<Esc>/foo')
screen:expect({
grid = [[
foo |
{5:cmdline [+] }|
{5:foo}ba^r |
{6:[No Name] [+] }|
|
]],
})
-- Does not clear 'inccommand' screen
feed('<Esc>:%s/bar/baz')
screen:expect({
grid = [[
%s/bar/baz |
{5:cmdline [+] }|
foo{7:ba^z} |
{6:[No Name] [+] }|
|
]],
})
end)
end)
describe('vim.ui_attach', function()