diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2016-05-01 17:30:38 -0400 |
---|---|---|
committer | Justin M. Keyes <justinkz@gmail.com> | 2016-05-01 17:30:38 -0400 |
commit | d542de4a76dd9e600ebcf1405efdc9d3090ad9a8 (patch) | |
tree | 60b1d2aad6205c74b7c2611fbbed45759a302f4f /src/nvim/message.c | |
parent | 91afb30b667bbc321d351708f694d00b256be585 (diff) | |
parent | cf4e1fb0f4962319eee292248d9c1f73be3a8d0c (diff) | |
download | rneovim-d542de4a76dd9e600ebcf1405efdc9d3090ad9a8.tar.gz rneovim-d542de4a76dd9e600ebcf1405efdc9d3090ad9a8.tar.bz2 rneovim-d542de4a76dd9e600ebcf1405efdc9d3090ad9a8.zip |
Merge pull request #4688 from ZyX-I/clint-checks
Add check for boolean operators placement
Diffstat (limited to 'src/nvim/message.c')
-rw-r--r-- | src/nvim/message.c | 75 |
1 files changed, 32 insertions, 43 deletions
diff --git a/src/nvim/message.c b/src/nvim/message.c index 97b098c6d2..f60b128712 100644 --- a/src/nvim/message.c +++ b/src/nvim/message.c @@ -1570,39 +1570,31 @@ static void msg_puts_display(char_u *str, int maxlen, int attr, int recurse) int wrap; int did_last_char; - did_wait_return = FALSE; + did_wait_return = false; while ((maxlen < 0 || (int)(s - str) < maxlen) && *s != NUL) { - /* - * We are at the end of the screen line when: - * - When outputting a newline. - * - When outputting a character in the last column. - */ - if (!recurse && msg_row >= Rows - 1 && (*s == '\n' || ( - cmdmsg_rl - ? ( - msg_col <= 1 - || (*s == TAB && msg_col <= 7) - || (has_mbyte && - (*mb_ptr2cells)(s) > 1 && - msg_col <= 2) - ) - : - (msg_col + t_col >= Columns - 1 - || (*s == TAB && msg_col + - t_col >= ((Columns - 1) & ~7)) - || (has_mbyte && - (*mb_ptr2cells)(s) > 1 - && msg_col + t_col >= - Columns - 2) - )))) { - /* - * The screen is scrolled up when at the last row (some terminals - * scroll automatically, some don't. To avoid problems we scroll - * ourselves). - */ - if (t_col > 0) - /* output postponed text */ + // We are at the end of the screen line when: + // - When outputting a newline. + // - When outputting a character in the last column. + if (!recurse && msg_row >= Rows - 1 + && (*s == '\n' || (cmdmsg_rl + ? (msg_col <= 1 + || (*s == TAB && msg_col <= 7) + || (has_mbyte + && (*mb_ptr2cells)(s) > 1 + && msg_col <= 2)) + : (msg_col + t_col >= Columns - 1 + || (*s == TAB + && msg_col + t_col >= ((Columns - 1) & ~7)) + || (has_mbyte + && (*mb_ptr2cells)(s) > 1 + && msg_col + t_col >= Columns - 2))))) { + // The screen is scrolled up when at the last row (some terminals + // scroll automatically, some don't. To avoid problems we scroll + // ourselves). + if (t_col > 0) { + // output postponed text t_puts(&t_col, t_s, s, attr); + } /* When no more prompt and no more room, truncate here */ if (msg_no_more && lines_left == 0) @@ -1709,18 +1701,15 @@ static void msg_puts_display(char_u *str, int maxlen, int attr, int recurse) cw = 1; l = 1; } - /* When drawing from right to left or when a double-wide character - * doesn't fit, draw a single character here. Otherwise collect - * characters and draw them all at once later. */ - if ( - cmdmsg_rl - || - (cw > 1 && msg_col + t_col >= Columns - 1) - ) { - if (l > 1) + // When drawing from right to left or when a double-wide character + // doesn't fit, draw a single character here. Otherwise collect + // characters and draw them all at once later. + if (cmdmsg_rl || (cw > 1 && msg_col + t_col >= Columns - 1)) { + if (l > 1) { s = screen_puts_mbyte(s, l, attr) - 1; - else + } else { msg_screen_putchar(*s, attr); + } } else { /* postpone this character until later */ if (t_col == 0) @@ -3382,8 +3371,8 @@ int vim_vsnprintf(char *str, size_t str_m, const char *fmt, va_list ap, // leave negative numbers for sprintf to handle, to // avoid handling tricky cases like (short int)-32768 } else if (alternate_form) { - if (arg_sign != 0 && (fmt_spec == 'x' || fmt_spec == 'X' || - fmt_spec == 'b' || fmt_spec == 'B')) { + if (arg_sign != 0 && (fmt_spec == 'x' || fmt_spec == 'X' + || fmt_spec == 'b' || fmt_spec == 'B')) { tmp[str_arg_l++] = '0'; tmp[str_arg_l++] = fmt_spec; } |