Compare commits

...

3 Commits

Author SHA1 Message Date
Famiu Haque 425a6528e4
Merge 14a7bb4a63 into c18d7941ef 2024-05-09 23:08:52 +08: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
Famiu Haque 14a7bb4a63
fix(completion): stop completion when completion is exhausted
Problem: Currently, completion is not stopped when completion is exhausted (no matching completion items), which also means `CompleteDone` is not called either. Furthermore, `CompleteDone` is called when pressing a special character (Backspace, Space, Esc) instead.

Solution: Correctly stop completion and trigger `CompleteDone` when completion is exhausted.
2024-04-29 03:54:34 +06:00
4 changed files with 53 additions and 7 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

@ -1279,7 +1279,10 @@ void ins_compl_show_pum(void)
}
if (compl_match_array == NULL) {
if (compl_started && has_event(EVENT_COMPLETECHANGED)) {
// Stop completion when completion is exhausted
if (ctrl_x_mode_not_default()) {
ins_compl_prep(' ');
} else if (compl_started && has_event(EVENT_COMPLETECHANGED)) {
trigger_complete_changed_event(cur);
}
return;

View File

@ -1192,4 +1192,45 @@ describe('completion', function()
{3:-- INSERT --} |
]])
end)
it('is stopped when there are no more matches', function()
command([[
function Complete() abort
call complete(1, ['abcd', 'abdc', 'acbd'])
return ''
endfunction
inoremap <C-x> <C-r>=Complete()<CR>
set completeopt+=menuone,noselect
let g:completedone_count = 0
autocmd CompleteDone * let g:completedone_count += 1
]])
feed('i<C-x>')
screen:expect([[
^ |
{1:abcd }{0: }|
{1:abdc }{0: }|
{1:acbd }{0: }|
{0:~ }|*3
{3:-- INSERT --} |
]])
eq(0, eval('g:completedone_count'))
feed('ax')
screen:expect([[
ax^ |
{0:~ }|*6
{3:-- INSERT --} |
]])
eq(1, eval('g:completedone_count'))
feed('aa<ESC>')
screen:expect([[
axa^a |
{0:~ }|*6
|
]])
eq(1, eval('g:completedone_count'))
end)
end)