mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
commit
a3b58cd60a
@ -26,6 +26,8 @@ if(NOT HAVE_SYS_WAIT_H AND UNIX)
|
|||||||
message(SEND_ERROR "header sys/wait.h is required for Unix")
|
message(SEND_ERROR "header sys/wait.h is required for Unix")
|
||||||
endif()
|
endif()
|
||||||
check_include_files(sys/utsname.h HAVE_SYS_UTSNAME_H)
|
check_include_files(sys/utsname.h HAVE_SYS_UTSNAME_H)
|
||||||
|
check_include_files(termio.h HAVE_TERMIO_H)
|
||||||
|
check_include_files(termios.h HAVE_TERMIOS_H)
|
||||||
check_include_files(utime.h HAVE_UTIME_H)
|
check_include_files(utime.h HAVE_UTIME_H)
|
||||||
check_include_files(sys/uio.h HAVE_SYS_UIO_H)
|
check_include_files(sys/uio.h HAVE_SYS_UIO_H)
|
||||||
|
|
||||||
|
@ -43,6 +43,8 @@
|
|||||||
#cmakedefine HAVE_STRNCASECMP
|
#cmakedefine HAVE_STRNCASECMP
|
||||||
#cmakedefine HAVE_SYS_UTSNAME_H
|
#cmakedefine HAVE_SYS_UTSNAME_H
|
||||||
#cmakedefine HAVE_SYS_WAIT_H
|
#cmakedefine HAVE_SYS_WAIT_H
|
||||||
|
#cmakedefine HAVE_TERMIO_H
|
||||||
|
#cmakedefine HAVE_TERMIOS_H
|
||||||
#cmakedefine HAVE_UTIME
|
#cmakedefine HAVE_UTIME
|
||||||
#cmakedefine HAVE_UTIME_H
|
#cmakedefine HAVE_UTIME_H
|
||||||
#cmakedefine HAVE_UTIMES
|
#cmakedefine HAVE_UTIMES
|
||||||
|
@ -123,29 +123,23 @@ function! s:check_tmux() abort
|
|||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
function! s:check_terminfo() abort
|
function! s:check_terminal() abort
|
||||||
if !executable('infocmp')
|
if !executable('infocmp')
|
||||||
return
|
return
|
||||||
endif
|
endif
|
||||||
call health#report_start('terminfo')
|
call health#report_start('terminal')
|
||||||
let suggestions = [
|
|
||||||
\ "Set key_backspace to \\177 (ASCII BACKSPACE). Run these commands:\n"
|
|
||||||
\ .'infocmp $TERM | sed ''s/kbs=^[hH]/kbs=\\177/'' > $TERM.ti'
|
|
||||||
\ ."\n"
|
|
||||||
\ .'tic $TERM.ti',
|
|
||||||
\ s:suggest_faq]
|
|
||||||
let cmd = 'infocmp -L'
|
let cmd = 'infocmp -L'
|
||||||
let out = system(cmd)
|
let out = system(cmd)
|
||||||
let kbs_entry = matchstr(out, 'key_backspace=\S*')
|
let kbs_entry = matchstr(out, 'key_backspace=[^,[:space:]]*')
|
||||||
|
let kdch1_entry = matchstr(out, 'key_dc=[^,[:space:]]*')
|
||||||
|
|
||||||
if v:shell_error
|
if v:shell_error
|
||||||
call health#report_error('command failed: '.cmd."\n".out)
|
call health#report_error('command failed: '.cmd."\n".out)
|
||||||
elseif !empty(matchstr(out, '\Vkey_backspace=^H'))
|
|
||||||
call health#report_error('key_backspace (kbs) entry is ^H (ASCII DELETE): '
|
|
||||||
\ .kbs_entry, suggestions)
|
|
||||||
else
|
else
|
||||||
call health#report_info('key_backspace terminfo entry: '
|
call health#report_info('key_backspace (kbs) terminfo entry: '
|
||||||
\ .(empty(kbs_entry) ? '? (not found)' : kbs_entry))
|
\ .(empty(kbs_entry) ? '? (not found)' : kbs_entry))
|
||||||
|
call health#report_info('key_dc (kdch1) terminfo entry: '
|
||||||
|
\ .(empty(kbs_entry) ? '? (not found)' : kdch1_entry))
|
||||||
endif
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -153,6 +147,6 @@ function! health#nvim#check() abort
|
|||||||
call s:check_config()
|
call s:check_config()
|
||||||
call s:check_performance()
|
call s:check_performance()
|
||||||
call s:check_rplugin_manifest()
|
call s:check_rplugin_manifest()
|
||||||
call s:check_terminfo()
|
call s:check_terminal()
|
||||||
call s:check_tmux()
|
call s:check_tmux()
|
||||||
endfunction
|
endfunction
|
||||||
|
@ -39,8 +39,6 @@ static int events_enabled = 0;
|
|||||||
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
#ifdef INCLUDE_GENERATED_DECLARATIONS
|
||||||
# include "os/input.c.generated.h"
|
# include "os/input.c.generated.h"
|
||||||
#endif
|
#endif
|
||||||
// Helper function used to push bytes from the 'event' key sequence partially
|
|
||||||
// between calls to os_inchar when maxlen < 3
|
|
||||||
|
|
||||||
void input_init(void)
|
void input_init(void)
|
||||||
{
|
{
|
||||||
@ -389,6 +387,8 @@ static void process_interrupts(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Helper function used to push bytes from the 'event' key sequence partially
|
||||||
|
// between calls to os_inchar when maxlen < 3
|
||||||
static int push_event_key(uint8_t *buf, int maxlen)
|
static int push_event_key(uint8_t *buf, int maxlen)
|
||||||
{
|
{
|
||||||
static const uint8_t key[3] = { K_SPECIAL, KS_EXTRA, KE_EVENT };
|
static const uint8_t key[3] = { K_SPECIAL, KS_EXTRA, KE_EVENT };
|
||||||
|
@ -32,7 +32,14 @@ void term_input_init(TermInput *input, Loop *loop)
|
|||||||
term = ""; // termkey_new_abstract assumes non-null (#2745)
|
term = ""; // termkey_new_abstract assumes non-null (#2745)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if TERMKEY_VERSION_MAJOR > 0 || TERMKEY_VERSION_MINOR > 18
|
||||||
|
input->tk = termkey_new_abstract(term,
|
||||||
|
TERMKEY_FLAG_UTF8 | TERMKEY_FLAG_NOSTART);
|
||||||
|
termkey_hook_terminfo_getstr(input->tk, input->tk_ti_hook_fn, NULL);
|
||||||
|
termkey_start(input->tk);
|
||||||
|
#else
|
||||||
input->tk = termkey_new_abstract(term, TERMKEY_FLAG_UTF8);
|
input->tk = termkey_new_abstract(term, TERMKEY_FLAG_UTF8);
|
||||||
|
#endif
|
||||||
|
|
||||||
int curflags = termkey_get_canonflags(input->tk);
|
int curflags = termkey_get_canonflags(input->tk);
|
||||||
termkey_set_canonflags(input->tk, curflags | TERMKEY_CANON_DELBS);
|
termkey_set_canonflags(input->tk, curflags | TERMKEY_CANON_DELBS);
|
||||||
|
@ -12,6 +12,7 @@ typedef struct term_input {
|
|||||||
bool paste_enabled;
|
bool paste_enabled;
|
||||||
bool waiting;
|
bool waiting;
|
||||||
TermKey *tk;
|
TermKey *tk;
|
||||||
|
TermKey_Terminfo_Getstr_Hook *tk_ti_hook_fn; ///< libtermkey terminfo hook
|
||||||
TimeWatcher timer_handle;
|
TimeWatcher timer_handle;
|
||||||
Loop *loop;
|
Loop *loop;
|
||||||
Stream read_stream;
|
Stream read_stream;
|
||||||
|
@ -7,9 +7,13 @@
|
|||||||
|
|
||||||
#include <uv.h>
|
#include <uv.h>
|
||||||
#include <unibilium.h>
|
#include <unibilium.h>
|
||||||
|
#if defined(HAVE_TERMIOS_H)
|
||||||
|
# include <termios.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include "nvim/lib/kvec.h"
|
#include "nvim/lib/kvec.h"
|
||||||
|
|
||||||
|
#include "nvim/ascii.h"
|
||||||
#include "nvim/vim.h"
|
#include "nvim/vim.h"
|
||||||
#include "nvim/log.h"
|
#include "nvim/log.h"
|
||||||
#include "nvim/ui.h"
|
#include "nvim/ui.h"
|
||||||
@ -195,6 +199,9 @@ static void tui_terminal_start(UI *ui)
|
|||||||
terminfo_start(ui);
|
terminfo_start(ui);
|
||||||
update_size(ui);
|
update_size(ui);
|
||||||
signal_watcher_start(&data->winch_handle, sigwinch_cb, SIGWINCH);
|
signal_watcher_start(&data->winch_handle, sigwinch_cb, SIGWINCH);
|
||||||
|
|
||||||
|
data->input.tk_ti_hook_fn = tui_tk_ti_getstr;
|
||||||
|
term_input_init(&data->input, data->loop);
|
||||||
term_input_start(&data->input);
|
term_input_start(&data->input);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -227,8 +234,6 @@ static void tui_main(UIBridgeData *bridge, UI *ui)
|
|||||||
signal_watcher_init(data->loop, &data->winch_handle, ui);
|
signal_watcher_init(data->loop, &data->winch_handle, ui);
|
||||||
signal_watcher_init(data->loop, &data->cont_handle, data);
|
signal_watcher_init(data->loop, &data->cont_handle, data);
|
||||||
signal_watcher_start(&data->cont_handle, sigcont_cb, SIGCONT);
|
signal_watcher_start(&data->cont_handle, sigcont_cb, SIGCONT);
|
||||||
// initialize input reading structures
|
|
||||||
term_input_init(&data->input, &tui_loop);
|
|
||||||
tui_terminal_start(ui);
|
tui_terminal_start(ui);
|
||||||
data->stop = false;
|
data->stop = false;
|
||||||
// allow the main thread to continue, we are ready to start handling UI
|
// allow the main thread to continue, we are ready to start handling UI
|
||||||
@ -957,3 +962,50 @@ static void flush_buf(UI *ui, bool toggle_cursor)
|
|||||||
unibi_out(ui, unibi_cursor_invisible);
|
unibi_out(ui, unibi_cursor_invisible);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Try to get "kbs" code from stty because "the terminfo kbs entry is extremely
|
||||||
|
/// unreliable." (Vim, Bash, and tmux also do this.)
|
||||||
|
///
|
||||||
|
/// @see tmux/tty-keys.c fe4e9470bb504357d073320f5d305b22663ee3fd
|
||||||
|
/// @see https://bugzilla.redhat.com/show_bug.cgi?id=142659
|
||||||
|
static const char *tui_get_stty_erase(void)
|
||||||
|
{
|
||||||
|
static char stty_erase[2] = { 0 };
|
||||||
|
#if defined(ECHOE) && defined(ICANON) \
|
||||||
|
&& (defined(HAVE_TERMIO_H) || defined(HAVE_TERMIOS_H))
|
||||||
|
struct termios t;
|
||||||
|
if (tcgetattr(input_global_fd(), &t) != -1) {
|
||||||
|
stty_erase[0] = (char)t.c_cc[VERASE];
|
||||||
|
stty_erase[1] = '\0';
|
||||||
|
ILOG("stty/termios:erase=%s", stty_erase);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
return stty_erase;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// libtermkey hook to override terminfo entries.
|
||||||
|
/// @see TermInput.tk_ti_hook_fn
|
||||||
|
static const char *tui_tk_ti_getstr(const char *name, const char *value,
|
||||||
|
void *data)
|
||||||
|
{
|
||||||
|
static const char *stty_erase = NULL;
|
||||||
|
if (stty_erase == NULL) {
|
||||||
|
stty_erase = tui_get_stty_erase();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strcmp(name, "key_backspace") == 0) {
|
||||||
|
ILOG("libtermkey:kbs=%s", value);
|
||||||
|
if (stty_erase != NULL && stty_erase[0] != 0) {
|
||||||
|
return stty_erase;
|
||||||
|
}
|
||||||
|
} else if (strcmp(name, "key_dc") == 0) {
|
||||||
|
ILOG("libtermkey:kdch1=%s", value);
|
||||||
|
// Vim: "If <BS> and <DEL> are now the same, redefine <DEL>."
|
||||||
|
if (stty_erase != NULL && strcmp(stty_erase, value) == 0) {
|
||||||
|
return stty_erase[0] == DEL ? (char *)CTRL_H_STR : (char *)DEL_STR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return value;
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -6,6 +6,7 @@ local clear, eq, eval, execute, feed, insert, neq, next_msg, nvim,
|
|||||||
helpers.nvim_dir, helpers.ok, helpers.source,
|
helpers.nvim_dir, helpers.ok, helpers.source,
|
||||||
helpers.write_file, helpers.mkdir, helpers.rmdir
|
helpers.write_file, helpers.mkdir, helpers.rmdir
|
||||||
local command = helpers.command
|
local command = helpers.command
|
||||||
|
local wait = helpers.wait
|
||||||
local Screen = require('test.functional.ui.screen')
|
local Screen = require('test.functional.ui.screen')
|
||||||
|
|
||||||
if helpers.pending_win32(pending) then return end
|
if helpers.pending_win32(pending) then return end
|
||||||
@ -271,7 +272,7 @@ describe('jobs', function()
|
|||||||
screen:set_default_attr_ids({
|
screen:set_default_attr_ids({
|
||||||
[1] = {bold=true, foreground=Screen.colors.Blue},
|
[1] = {bold=true, foreground=Screen.colors.Blue},
|
||||||
})
|
})
|
||||||
local script = [[
|
source([[
|
||||||
function! g:JobHandler(job_id, data, event)
|
function! g:JobHandler(job_id, data, event)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
@ -281,26 +282,14 @@ describe('jobs', function()
|
|||||||
\ 'on_exit': function('g:JobHandler')
|
\ 'on_exit': function('g:JobHandler')
|
||||||
\ }
|
\ }
|
||||||
let job = jobstart('cat -', g:callbacks)
|
let job = jobstart('cat -', g:callbacks)
|
||||||
]]
|
|
||||||
source(script)
|
|
||||||
feed(':function! g:JobHandler(job_id, data, event)<cr>')
|
|
||||||
feed(':endfunction<cr>')
|
|
||||||
screen:expect([[
|
|
||||||
^ |
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
{1:~ }|
|
|
||||||
|
|
|
||||||
]])
|
]])
|
||||||
|
wait()
|
||||||
|
source([[
|
||||||
|
function! g:JobHandler(job_id, data, event)
|
||||||
|
endfunction
|
||||||
|
]])
|
||||||
|
|
||||||
|
eq("", eval("v:errmsg"))
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('requires funcrefs for script-local (s:) functions', function()
|
it('requires funcrefs for script-local (s:) functions', function()
|
||||||
|
4
third-party/CMakeLists.txt
vendored
4
third-party/CMakeLists.txt
vendored
@ -105,8 +105,8 @@ set(LUAROCKS_SHA256 cae709111c5701235770047dfd7169f66b82ae1c7b9b79207f9df0afb722
|
|||||||
set(UNIBILIUM_URL https://github.com/mauke/unibilium/archive/v1.2.0.tar.gz)
|
set(UNIBILIUM_URL https://github.com/mauke/unibilium/archive/v1.2.0.tar.gz)
|
||||||
set(UNIBILIUM_SHA256 623af1099515e673abfd3cae5f2fa808a09ca55dda1c65a7b5c9424eb304ead8)
|
set(UNIBILIUM_SHA256 623af1099515e673abfd3cae5f2fa808a09ca55dda1c65a7b5c9424eb304ead8)
|
||||||
|
|
||||||
set(LIBTERMKEY_URL http://www.leonerd.org.uk/code/libtermkey/libtermkey-0.18.tar.gz)
|
set(LIBTERMKEY_URL http://www.leonerd.org.uk/code/libtermkey/libtermkey-0.19.tar.gz)
|
||||||
set(LIBTERMKEY_SHA256 239746de41c845af52bb3c14055558f743292dd6c24ac26c2d6567a5a6093926)
|
set(LIBTERMKEY_SHA256 c505aa4cb48c8fa59c526265576b97a19e6ebe7b7da20f4ecaae898b727b48b7)
|
||||||
|
|
||||||
set(LIBVTERM_URL https://github.com/neovim/libvterm/archive/a9c7c6fd20fa35e0ad3e0e98901ca12dfca9c25c.tar.gz)
|
set(LIBVTERM_URL https://github.com/neovim/libvterm/archive/a9c7c6fd20fa35e0ad3e0e98901ca12dfca9c25c.tar.gz)
|
||||||
set(LIBVTERM_SHA256 1a4272be91d9614dc183a503786df83b6584e4afaab7feaaa5409f841afbd796)
|
set(LIBVTERM_SHA256 1a4272be91d9614dc183a503786df83b6584e4afaab7feaaa5409f841afbd796)
|
||||||
|
Loading…
Reference in New Issue
Block a user