aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/tui
diff options
context:
space:
mode:
authordundargoc <gocdundar@gmail.com>2023-11-16 10:59:11 +0100
committerdundargoc <33953936+dundargoc@users.noreply.github.com>2023-11-20 19:57:09 +0100
commita6e3d93421ba13c407a96fac9cc01fa41ec7ad98 (patch)
treee84209969b11fe2f0dabcad00a271468b2199bc9 /src/nvim/tui
parentec79ff893d5906e1f0d90953cffa535ffae47823 (diff)
downloadrneovim-a6e3d93421ba13c407a96fac9cc01fa41ec7ad98.tar.gz
rneovim-a6e3d93421ba13c407a96fac9cc01fa41ec7ad98.tar.bz2
rneovim-a6e3d93421ba13c407a96fac9cc01fa41ec7ad98.zip
refactor: enable formatting for ternaries
This requires removing the "Inner expression should be aligned" rule from clint as it prevents essentially any formatting regarding ternary operators.
Diffstat (limited to 'src/nvim/tui')
-rw-r--r--src/nvim/tui/input.c4
-rw-r--r--src/nvim/tui/tui.c22
2 files changed, 15 insertions, 11 deletions
diff --git a/src/nvim/tui/input.c b/src/nvim/tui/input.c
index 6b9361848a..9d34cf926f 100644
--- a/src/nvim/tui/input.c
+++ b/src/nvim/tui/input.c
@@ -725,8 +725,8 @@ static void tinput_read_cb(Stream *stream, RBuffer *buf, size_t count_, void *da
if (rbuffer_size(input->read_stream.buffer)) {
// If 'ttimeout' is not set, start the timer with a timeout of 0 to process
// the next input.
- int64_t ms = input->ttimeout ?
- (input->ttimeoutlen >= 0 ? input->ttimeoutlen : 0) : 0;
+ int64_t ms = input->ttimeout
+ ? (input->ttimeoutlen >= 0 ? input->ttimeoutlen : 0) : 0;
// Stop the current timer if already running
time_watcher_stop(&input->timer_handle);
time_watcher_start(&input->timer_handle, tinput_timer_cb, (uint32_t)ms, 0);
diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c
index 21b820d71e..8e13ce0d1d 100644
--- a/src/nvim/tui/tui.c
+++ b/src/nvim/tui/tui.c
@@ -334,7 +334,7 @@ static void terminfo_start(TUIData *tui)
|| os_getenv("KONSOLE_DBUS_SESSION");
const char *konsolev_env = os_getenv("KONSOLE_VERSION");
int konsolev = konsolev_env ? (int)strtol(konsolev_env, NULL, 10)
- : (konsole ? 1 : 0);
+ : (konsole ? 1 : 0);
patch_terminfo_bugs(tui, term, colorterm, vtev, konsolev, iterm_env, nsterm);
augment_terminfo(tui, term, vtev, konsolev, iterm_env, nsterm);
@@ -792,11 +792,15 @@ static void cursor_goto(TUIData *tui, int row, int col)
if (grid->row == -1) {
goto safe_move;
}
- if (0 == col ? col != grid->col :
- row != grid->row ? false :
- 1 == col ? 2 < grid->col && cheap_to_print(tui, grid->row, 0, col) :
- 2 == col ? 5 < grid->col && cheap_to_print(tui, grid->row, 0, col) :
- false) {
+ if (0 == col
+ ? col != grid->col
+ : (row != grid->row
+ ? false
+ : (1 == col
+ ? (2 < grid->col && cheap_to_print(tui, grid->row, 0, col))
+ : (2 == col
+ ? (5 < grid->col && cheap_to_print(tui, grid->row, 0, col))
+ : false)))) {
// Motion to left margin from anywhere else, or CR + printing chars is
// even less expensive than using BSes or CUB.
unibi_out(tui, unibi_carriage_return);
@@ -2226,9 +2230,9 @@ static void augment_terminfo(TUIData *tui, const char *term, int vte_version, in
"\x1b[?2004l");
// For urxvt send BOTH xterm and old urxvt sequences. #8695
tui->unibi_ext.enable_focus_reporting = (int)unibi_add_ext_str(ut, "ext.enable_focus",
- rxvt ?
- "\x1b[?1004h\x1b]777;focus;on\x7" :
- "\x1b[?1004h");
+ rxvt
+ ? "\x1b[?1004h\x1b]777;focus;on\x7"
+ : "\x1b[?1004h");
tui->unibi_ext.disable_focus_reporting =
(int)unibi_add_ext_str(ut, "ext.disable_focus",
rxvt ? "\x1b[?1004l\x1b]777;focus;off\x7" : "\x1b[?1004l");