aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/screen.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/nvim/screen.c')
-rw-r--r--src/nvim/screen.c57
1 files changed, 29 insertions, 28 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c
index eb4eef6e31..0c35a08d40 100644
--- a/src/nvim/screen.c
+++ b/src/nvim/screen.c
@@ -155,8 +155,6 @@ void win_draw_end(win_T *wp, int c1, int c2, bool draw_margin, int row, int endr
} else {
grid_fill(&wp->w_grid, row, endrow, n, wp->w_grid.cols, c1, c2, attr);
}
-
- set_empty_rows(wp, row);
}
/// Compute the width of the foldcolumn. Based on 'foldcolumn' and how much
@@ -277,7 +275,7 @@ static int wildmenu_match_len(expand_T *xp, char_u *s)
/// These are backslashes used for escaping. Do show backslashes in help tags.
static int skip_wildmenu_char(expand_T *xp, char_u *s)
{
- if ((rem_backslash(s) && xp->xp_context != EXPAND_HELP)
+ if ((rem_backslash((char *)s) && xp->xp_context != EXPAND_HELP)
|| ((xp->xp_context == EXPAND_MENUS
|| xp->xp_context == EXPAND_MENUNAMES)
&& (s[0] == '\t'
@@ -442,7 +440,7 @@ void redraw_wildmenu(expand_T *xp, int num_matches, char **matches, int match, i
// Put the wildmenu just above the command line. If there is
// no room, scroll the screen one line up.
if (cmdline_row == Rows - 1) {
- msg_scroll_up(false);
+ msg_scroll_up(false, false);
msg_scrolled++;
} else {
cmdline_row++;
@@ -469,10 +467,10 @@ void redraw_wildmenu(expand_T *xp, int num_matches, char **matches, int match, i
ScreenGrid *grid = (wild_menu_showing == WM_SCROLLED)
? &msg_grid_adj : &default_grid;
- grid_puts(grid, buf, row, 0, attr);
+ grid_puts(grid, (char *)buf, row, 0, attr);
if (selstart != NULL && highlight) {
*selend = NUL;
- grid_puts(grid, selstart, row, selstart_col, HL_ATTR(HLF_WM));
+ grid_puts(grid, (char *)selstart, row, selstart_col, HL_ATTR(HLF_WM));
}
grid_fill(grid, row, row + 1, clen, Columns,
@@ -620,7 +618,7 @@ void setcursor_mayforce(bool force)
// With 'rightleft' set and the cursor on a double-wide character,
// position it on the leftmost column.
col = curwin->w_width_inner - curwin->w_wcol
- - ((utf_ptr2cells((char *)get_cursor_pos_ptr()) == 2
+ - ((utf_ptr2cells(get_cursor_pos_ptr()) == 2
&& vim_isprintc(gchar_cursor())) ? 2 : 1);
}
@@ -734,13 +732,13 @@ int showmode(void)
length = (Rows - msg_row) * Columns - 3;
}
if (edit_submode_extra != NULL) {
- length -= vim_strsize((char *)edit_submode_extra);
+ length -= vim_strsize(edit_submode_extra);
}
if (length > 0) {
if (edit_submode_pre != NULL) {
- length -= vim_strsize((char *)edit_submode_pre);
+ length -= vim_strsize(edit_submode_pre);
}
- if (length - vim_strsize((char *)edit_submode) > 0) {
+ if (length - vim_strsize(edit_submode) > 0) {
if (edit_submode_pre != NULL) {
msg_puts_attr((const char *)edit_submode_pre, attr);
}
@@ -1022,7 +1020,7 @@ void draw_tabline(void)
if (modified || wincount > 1) {
if (wincount > 1) {
vim_snprintf((char *)NameBuff, MAXPATHL, "%d", wincount);
- len = (int)STRLEN(NameBuff);
+ len = (int)strlen(NameBuff);
if (col + len >= Columns - 3) {
break;
}
@@ -1031,7 +1029,7 @@ void draw_tabline(void)
col += len;
}
if (modified) {
- grid_puts_len(&default_grid, (char_u *)"+", 1, 0, col++, attr);
+ grid_puts_len(&default_grid, "+", 1, 0, col++, attr);
}
grid_putchar(&default_grid, ' ', 0, col++, attr);
}
@@ -1042,7 +1040,7 @@ void draw_tabline(void)
get_trans_bufname(cwp->w_buffer);
shorten_dir(NameBuff);
len = vim_strsize((char *)NameBuff);
- p = NameBuff;
+ p = (char_u *)NameBuff;
while (len > room) {
len -= ptr2cells((char *)p);
MB_PTR_ADV(p);
@@ -1051,7 +1049,7 @@ void draw_tabline(void)
len = Columns - col - 1;
}
- grid_puts_len(&default_grid, p, (int)STRLEN(p), 0, col, attr);
+ grid_puts_len(&default_grid, (char *)p, (int)STRLEN(p), 0, col, attr);
col += len;
}
grid_putchar(&default_grid, ' ', 0, col++, attr);
@@ -1173,7 +1171,9 @@ bool redrawing(void)
/// Return true if printing messages should currently be done.
bool messaging(void)
{
- return !(p_lz && char_avail() && !KeyTyped) && ui_has_messages();
+ // TODO(bfredl): with general support for "async" messages with p_ch,
+ // this should be re-enabled.
+ return !(p_lz && char_avail() && !KeyTyped) && (p_ch > 0 || ui_has(kUIMessages));
}
#define COL_RULER 17 // columns needed by standard ruler
@@ -1270,7 +1270,7 @@ static int get_encoded_char_adv(const char_u **p)
int64_t num = 0;
for (int bytes = s[1] == 'x' ? 1 : s[1] == 'u' ? 2 : 4; bytes > 0; bytes--) {
*p += 2;
- int n = hexhex2nr(*p);
+ int n = hexhex2nr((char *)(*p));
if (n < 0) {
return 0;
}
@@ -1295,13 +1295,13 @@ static int get_encoded_char_adv(const char_u **p)
/// @param varp either the global or the window-local value.
/// @param apply if false, do not store the flags, only check for errors.
/// @return error message, NULL if it's OK.
-char *set_chars_option(win_T *wp, char_u **varp, bool apply)
+char *set_chars_option(win_T *wp, char **varp, bool apply)
{
const char_u *last_multispace = NULL; // Last occurrence of "multispace:"
const char_u *last_lmultispace = NULL; // Last occurrence of "leadmultispace:"
int multispace_len = 0; // Length of lcs-multispace string
int lead_multispace_len = 0; // Length of lcs-leadmultispace string
- const bool is_listchars = (varp == (char_u **)&p_lcs || varp == (char_u **)&wp->w_p_lcs);
+ const bool is_listchars = (varp == &p_lcs || varp == &wp->w_p_lcs);
struct chars_tab {
int *cp; ///< char value
@@ -1329,6 +1329,7 @@ char *set_chars_option(win_T *wp, char_u **varp, bool apply)
{ &wp->w_p_fcs_chars.msgsep, "msgsep", ' ' },
{ &wp->w_p_fcs_chars.eob, "eob", '~' },
{ &wp->w_p_fcs_chars.colorcol, "colorcol", ' ' },
+ { &wp->w_p_fcs_chars.lastline, "lastline", '@' },
};
struct chars_tab lcs_tab[] = {
@@ -1345,17 +1346,17 @@ char *set_chars_option(win_T *wp, char_u **varp, bool apply)
struct chars_tab *tab;
int entries;
- const char_u *value = *varp;
+ const char_u *value = (char_u *)(*varp);
if (is_listchars) {
tab = lcs_tab;
entries = ARRAY_SIZE(lcs_tab);
- if (varp == (char_u **)&wp->w_p_lcs && wp->w_p_lcs[0] == NUL) {
+ if (varp == &wp->w_p_lcs && wp->w_p_lcs[0] == NUL) {
value = (char_u *)p_lcs; // local value is empty, use the global value
}
} else {
tab = fcs_tab;
entries = ARRAY_SIZE(fcs_tab);
- if (varp == (char_u **)&wp->w_p_fcs && wp->w_p_fcs[0] == NUL) {
+ if (varp == &wp->w_p_fcs && wp->w_p_fcs[0] == NUL) {
value = (char_u *)p_fcs; // local value is empty, use the global value
}
}
@@ -1395,7 +1396,7 @@ char *set_chars_option(win_T *wp, char_u **varp, bool apply)
while (*p) {
int i;
for (i = 0; i < entries; i++) {
- const size_t len = STRLEN(tab[i].name);
+ const size_t len = strlen(tab[i].name);
if (STRNCMP(p, tab[i].name, len) == 0
&& p[len] == ':'
&& p[len + 1] != NUL) {
@@ -1437,8 +1438,8 @@ char *set_chars_option(win_T *wp, char_u **varp, bool apply)
}
if (i == entries) {
- const size_t len = STRLEN("multispace");
- const size_t len2 = STRLEN("leadmultispace");
+ const size_t len = strlen("multispace");
+ const size_t len2 = strlen("leadmultispace");
if (is_listchars
&& STRNCMP(p, "multispace", len) == 0
&& p[len] == ':'
@@ -1521,17 +1522,17 @@ char *set_chars_option(win_T *wp, char_u **varp, bool apply)
/// @return an untranslated error message if any of them is invalid, NULL otherwise.
char *check_chars_options(void)
{
- if (set_chars_option(curwin, (char_u **)&p_lcs, false) != NULL) {
+ if (set_chars_option(curwin, &p_lcs, false) != NULL) {
return e_conflicts_with_value_of_listchars;
}
- if (set_chars_option(curwin, (char_u **)&p_fcs, false) != NULL) {
+ if (set_chars_option(curwin, &p_fcs, false) != NULL) {
return e_conflicts_with_value_of_fillchars;
}
FOR_ALL_TAB_WINDOWS(tp, wp) {
- if (set_chars_option(wp, (char_u **)&wp->w_p_lcs, true) != NULL) {
+ if (set_chars_option(wp, &wp->w_p_lcs, true) != NULL) {
return e_conflicts_with_value_of_listchars;
}
- if (set_chars_option(wp, (char_u **)&wp->w_p_fcs, true) != NULL) {
+ if (set_chars_option(wp, &wp->w_p_fcs, true) != NULL) {
return e_conflicts_with_value_of_fillchars;
}
}