aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/option.c3
-rw-r--r--src/nvim/screen.c11
-rw-r--r--src/nvim/tui/terminfo.c27
-rw-r--r--src/nvim/tui/terminfo.h2
-rw-r--r--src/nvim/tui/tui.c34
5 files changed, 40 insertions, 37 deletions
diff --git a/src/nvim/option.c b/src/nvim/option.c
index 0c423c900f..cc7f8333ff 100644
--- a/src/nvim/option.c
+++ b/src/nvim/option.c
@@ -969,7 +969,8 @@ void set_init_2(bool headless)
p_window = Rows - 1;
}
set_number_default("window", Rows - 1);
-#if 0 // This bodges around problems that should properly be fixed in the TUI layer.
+#if 0
+ // This bodges around problems that should be fixed in the TUI layer.
if (!headless && !os_term_is_nice()) {
set_string_option_direct((char_u *)"guicursor", -1, (char_u *)"",
OPT_GLOBAL, SID_NONE);
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index e8cd6b4e9c..537b13f33d 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -5824,13 +5824,12 @@ static void screen_char(unsigned off, int row, int col)
if (row >= screen_Rows || col >= screen_Columns)
return;
- /* Outputting the last character on the screen may scrollup the screen.
- * Don't to it! Mark the character invalid (update it when scrolled up)
- * FIXME: The premise here is not actually true. c.f. deferred wrap */
+ // Outputting the last character on the screen may scrollup the screen.
+ // Don't to it! Mark the character invalid (update it when scrolled up)
+ // FIXME: The premise here is not actually true (cf. deferred wrap).
if (row == screen_Rows - 1 && col == screen_Columns - 1
- /* account for first command-line character in rightleft mode */
- && !cmdmsg_rl
- ) {
+ // account for first command-line character in rightleft mode
+ && !cmdmsg_rl) {
ScreenAttrs[off] = (sattr_T)-1;
return;
}
diff --git a/src/nvim/tui/terminfo.c b/src/nvim/tui/terminfo.c
index ac1bdaa6bb..b8fffcb7d6 100644
--- a/src/nvim/tui/terminfo.c
+++ b/src/nvim/tui/terminfo.c
@@ -84,37 +84,38 @@ unibi_term *load_builtin_terminfo(const char * term)
{
if (terminfo_is_term_family(term, "xterm")) {
return unibi_from_mem((const char *)xterm_256colour_terminfo,
- sizeof xterm_256colour_terminfo);
+ sizeof xterm_256colour_terminfo);
} else if (terminfo_is_term_family(term, "screen")) {
return unibi_from_mem((const char *)screen_256colour_terminfo,
- sizeof screen_256colour_terminfo);
+ sizeof screen_256colour_terminfo);
} else if (terminfo_is_term_family(term, "tmux")) {
return unibi_from_mem((const char *)tmux_256colour_terminfo,
- sizeof tmux_256colour_terminfo);
+ sizeof tmux_256colour_terminfo);
} else if (terminfo_is_term_family(term, "rxvt")) {
return unibi_from_mem((const char *)rxvt_256colour_terminfo,
- sizeof rxvt_256colour_terminfo);
+ sizeof rxvt_256colour_terminfo);
} else if (terminfo_is_term_family(term, "putty")) {
return unibi_from_mem((const char *)putty_256colour_terminfo,
- sizeof putty_256colour_terminfo);
+ sizeof putty_256colour_terminfo);
} else if (terminfo_is_term_family(term, "linux")) {
return unibi_from_mem((const char *)linux_16colour_terminfo,
- sizeof linux_16colour_terminfo);
+ sizeof linux_16colour_terminfo);
} else if (terminfo_is_term_family(term, "interix")) {
return unibi_from_mem((const char *)interix_8colour_terminfo,
- sizeof interix_8colour_terminfo);
+ sizeof interix_8colour_terminfo);
} else if (terminfo_is_term_family(term, "iterm")
- || terminfo_is_term_family(term, "iTerm.app")) {
+ || terminfo_is_term_family(term, "iTerm.app")) {
return unibi_from_mem((const char *)iterm_256colour_terminfo,
- sizeof iterm_256colour_terminfo);
+ sizeof iterm_256colour_terminfo);
} else if (terminfo_is_term_family(term, "st")) {
return unibi_from_mem((const char *)st_256colour_terminfo,
- sizeof st_256colour_terminfo);
+ sizeof st_256colour_terminfo);
} else if (terminfo_is_term_family(term, "gnome")
- || terminfo_is_term_family(term, "vte")) {
+ || terminfo_is_term_family(term, "vte")) {
return unibi_from_mem((const char *)vte_256colour_terminfo,
- sizeof vte_256colour_terminfo);
+ sizeof vte_256colour_terminfo);
} else {
- return unibi_from_mem((const char *)ansi_terminfo, sizeof ansi_terminfo);
+ return unibi_from_mem((const char *)ansi_terminfo,
+ sizeof ansi_terminfo);
}
}
diff --git a/src/nvim/tui/terminfo.h b/src/nvim/tui/terminfo.h
index 78f6b9c245..099df8967f 100644
--- a/src/nvim/tui/terminfo.h
+++ b/src/nvim/tui/terminfo.h
@@ -1,6 +1,8 @@
#ifndef NVIM_TUI_TERMINFO_H
#define NVIM_TUI_TERMINFO_H
+#include <unibilium.h>
+
#ifdef INCLUDE_GENERATED_DECLARATIONS
# include "tui/terminfo.h.generated.h"
#endif
diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c
index b885861a23..499dffa18a 100644
--- a/src/nvim/tui/tui.c
+++ b/src/nvim/tui/tui.c
@@ -162,7 +162,7 @@ UI *tui_start(void)
}
static size_t unibi_pre_fmt_str(TUIData *data, unsigned int unibi_index,
- char * buf, size_t len)
+ char * buf, size_t len)
{
const char *str = unibi_get_str(data->ut, unibi_index);
if (!str) {
@@ -223,9 +223,9 @@ static void terminfo_start(UI *ui)
terminfo_is_term_family(term, "cygwin")
|| terminfo_is_term_family(term, "interix");
data->normlen = unibi_pre_fmt_str(data, unibi_cursor_normal,
- data->norm, sizeof data->norm);
+ data->norm, sizeof data->norm);
data->invislen = unibi_pre_fmt_str(data, unibi_cursor_invisible,
- data->invis, sizeof data->invis);
+ data->invis, sizeof data->invis);
// Set 't_Co' from the result of unibilium & fix_terminfo.
t_colors = unibi_get_num(data->ut, unibi_max_colors);
// Enter alternate screen and clear
@@ -539,7 +539,7 @@ static void cursor_goto(UI *ui, int row, int col)
if (n <= (row == grid->row ? 4 : 2)
&& cheap_to_print(ui, grid->row, grid->col, n)) {
UGRID_FOREACH_CELL(grid, grid->row, grid->row,
- grid->col, col - 1, {
+ grid->col, col - 1, {
print_cell(ui, cell);
});
}
@@ -1254,7 +1254,8 @@ static int unibi_find_ext_bool(unibi_term *ut, const char *name)
/// external or a built-in database. In an ideal world, the real terminfo data
/// would be correct and complete, and this function would be almost empty.
static void patch_terminfo_bugs(TUIData *data, const char *term,
- const char *colorterm, long vte_version, bool konsole, bool iterm_env)
+ const char *colorterm, long vte_version,
+ bool konsole, bool iterm_env)
{
unibi_term *ut = data->ut;
const char * xterm_version = os_getenv("XTERM_VERSION");
@@ -1296,7 +1297,7 @@ static void patch_terminfo_bugs(TUIData *data, const char *term,
if (linuxvt
&& strlen(fix_normal) >= (sizeof LINUXSET0C - 1)
&& !memcmp(strchr(fix_normal, 0) - (sizeof LINUXSET0C - 1),
- LINUXSET0C, sizeof LINUXSET0C - 1)) {
+ LINUXSET0C, sizeof LINUXSET0C - 1)) {
// The Linux terminfo entry similarly includes a Linux-idiosyncractic
// cursor shape reset in cnorm, which similarly interferes with
// set_cursor_style.
@@ -1308,7 +1309,7 @@ static void patch_terminfo_bugs(TUIData *data, const char *term,
if (linuxvt
&& strlen(fix_invisible) >= (sizeof LINUXSET1C - 1)
&& !memcmp(strchr(fix_invisible, 0) - (sizeof LINUXSET1C - 1),
- LINUXSET1C, sizeof LINUXSET1C - 1)) {
+ LINUXSET1C, sizeof LINUXSET1C - 1)) {
// The Linux terminfo entry similarly includes a Linux-idiosyncractic
// cursor shape reset in cinvis, which similarly interferes with
// set_cursor_style.
@@ -1411,8 +1412,7 @@ static void patch_terminfo_bugs(TUIData *data, const char *term,
unibi_set_num(ut, unibi_max_colors, 256);
unibi_set_str(ut, unibi_set_a_foreground, XTERM_SETAF_256);
unibi_set_str(ut, unibi_set_a_background, XTERM_SETAB_256);
- } else
- if (konsole || xterm || gnome || rxvt || st || putty
+ } else if (konsole || xterm || gnome || rxvt || st || putty
|| linuxvt // Linux 4.8+ supports 256-colour SGR.
|| mate_pretending_xterm || gnome_pretending_xterm
|| tmux || tmux_pretending_screen
@@ -1455,23 +1455,23 @@ static void patch_terminfo_bugs(TUIData *data, const char *term,
// console-terminal-emulator from the nosh toolset, which does indeed
// implement the xterm extension:
|| (linuxvt && (xterm_version || (vte_version > 0) || colorterm))) {
- data->unibi_ext.set_cursor_style = (int)unibi_add_ext_str(ut, "Ss",
- "\x1b[%p1%d q");
+ data->unibi_ext.set_cursor_style =
+ (int)unibi_add_ext_str(ut, "Ss", "\x1b[%p1%d q");
if (-1 == data->unibi_ext.reset_cursor_style) {
data->unibi_ext.reset_cursor_style = (int)unibi_add_ext_str(ut, "Se",
"");
}
unibi_set_ext_str(ut, (size_t)data->unibi_ext.reset_cursor_style,
- "\x1b[ q");
- } else
- if (putty // per MinTTY 0.4.3-1 release notes from 2009
+ "\x1b[ q");
+ } else if (
+ // per MinTTY 0.4.3-1 release notes from 2009
+ putty
// per https://bugzilla.gnome.org/show_bug.cgi?id=720821
|| (vte_version >= 3900)
// per tmux manual page and per
// https://lists.gnu.org/archive/html/screen-devel/2013-03/msg00000.html
|| screen) {
- // Since we use the xterm extension, we have to map it to the unextended
- // form.
+ // Since we use the xterm extension, we must map it to the unextended form
data->unibi_ext.set_cursor_style = (int)unibi_add_ext_str(ut, "Ss",
"\x1b[%?"
"%p1%{4}%>" "%t%p1%{2}%-" // a bit of a bodge for extension values
@@ -1676,7 +1676,7 @@ static void flush_buf(UI *ui, bool toggle_cursor)
}
uv_write(&req, STRUCT_CAST(uv_stream_t, &data->output_handle),
- bufs, (unsigned)(bufp - bufs), NULL);
+ bufs, (unsigned)(bufp - bufs), NULL);
uv_run(&data->write_loop, UV_RUN_DEFAULT);
data->bufpos = 0;
}