From 8b21de33bb288738c1445bc7241d3d5106124d66 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 22 Sep 2017 11:13:52 +0200 Subject: [PATCH 01/12] Missing part of 8.0.1131. --- src/terminal.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/terminal.c b/src/terminal.c index 0cdb43ab23..9b5e4ce363 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -448,6 +448,12 @@ term_start(typval_T *argvar, jobopt_T *opt, int forceit) * a deadlock if the job is waiting for Vim to read. */ channel_set_nonblock(term->tl_job->jv_channel, PART_IN); +#ifdef FEAT_AUTOCMD + ++curbuf->b_locked; + apply_autocmds(EVENT_BUFWINENTER, NULL, NULL, FALSE, curbuf); + --curbuf->b_locked; +#endif + if (old_curbuf != NULL) { --curbuf->b_nwindows; From f3d769a585040ac47f7054057758809024ef6377 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 22 Sep 2017 13:44:56 +0200 Subject: [PATCH 02/12] patch 8.0.1133: syntax timeout not used correctly Problem: Syntax timeout not used correctly. Solution: Do not pass the timeout to syntax_start() but set it explicitly. (Yasuhiro Matsumoto, closes #2139) --- src/proto/syntax.pro | 3 ++- src/screen.c | 35 ++++++++++++++++------------------- src/syntax.c | 27 ++++++++++++++++++--------- src/version.c | 2 ++ 4 files changed, 38 insertions(+), 29 deletions(-) diff --git a/src/proto/syntax.pro b/src/proto/syntax.pro index f6ecb8c491..966a5cb0a5 100644 --- a/src/proto/syntax.pro +++ b/src/proto/syntax.pro @@ -1,5 +1,6 @@ /* syntax.c */ -void syntax_start(win_T *wp, linenr_T lnum, proftime_T *syntax_tm); +void syn_set_timeout(proftime_T *tm); +void syntax_start(win_T *wp, linenr_T lnum); void syn_stack_free_all(synblock_T *block); void syn_stack_apply_changes(buf_T *buf); void syntax_end_parsing(linenr_T lnum); diff --git a/src/screen.c b/src/screen.c index 9f39edf04f..fb9241637c 100644 --- a/src/screen.c +++ b/src/screen.c @@ -131,7 +131,7 @@ static void fold_line(win_T *wp, long fold_count, foldinfo_T *foldinfo, linenr_T static void fill_foldcolumn(char_u *p, win_T *wp, int closed, linenr_T lnum); static void copy_text_attr(int off, char_u *buf, int len, int attr); #endif -static int win_line(win_T *, linenr_T, int, int, int nochange, proftime_T *syntax_tm); +static int win_line(win_T *, linenr_T, int, int, int nochange); static int char_needs_redraw(int off_from, int off_to, int cols); static void draw_vsep_win(win_T *wp, int row); #ifdef FEAT_STL_OPT @@ -930,6 +930,7 @@ update_single_line(win_T *wp, linenr_T lnum) #ifdef SYN_TIME_LIMIT /* Set the time limit to 'redrawtime'. */ profile_setlimit(p_rdt, &syntax_tm); + syn_set_timeout(&syntax_tm); #endif update_prepare(); @@ -944,13 +945,7 @@ update_single_line(win_T *wp, linenr_T lnum) start_search_hl(); prepare_search_hl(wp, lnum); # endif - win_line(wp, lnum, row, row + wp->w_lines[j].wl_size, FALSE, -#ifdef SYN_TIME_LIMIT - &syntax_tm -#else - NULL -#endif - ); + win_line(wp, lnum, row, row + wp->w_lines[j].wl_size, FALSE); # if defined(FEAT_SEARCH_EXTRA) end_search_hl(); # endif @@ -960,6 +955,10 @@ update_single_line(win_T *wp, linenr_T lnum) } update_finish(); + +#ifdef SYN_TIME_LIMIT + syn_set_timeout(NULL); +#endif } need_cursor_line_redraw = FALSE; } @@ -1805,6 +1804,7 @@ win_update(win_T *wp) #ifdef SYN_TIME_LIMIT /* Set the time limit to 'redrawtime'. */ profile_setlimit(p_rdt, &syntax_tm); + syn_set_timeout(&syntax_tm); #endif #ifdef FEAT_FOLDING win_foldinfo.fi_level = 0; @@ -2109,13 +2109,7 @@ win_update(win_T *wp) /* * Display one line. */ - row = win_line(wp, lnum, srow, wp->w_height, mod_top == 0, -#ifdef SYN_TIME_LIMIT - &syntax_tm -#else - NULL -#endif - ); + row = win_line(wp, lnum, srow, wp->w_height, mod_top == 0); #ifdef FEAT_FOLDING wp->w_lines[idx].wl_folded = FALSE; @@ -2275,6 +2269,10 @@ win_update(win_T *wp) win_draw_end(wp, '~', ' ', row, wp->w_height, HLF_EOB); } +#ifdef SYN_TIME_LIMIT + syn_set_timeout(NULL); +#endif + /* Reset the type of redrawing required, the window has been updated. */ wp->w_redr_type = 0; #ifdef FEAT_DIFF @@ -3000,8 +2998,7 @@ win_line( linenr_T lnum, int startrow, int endrow, - int nochange UNUSED, /* not updating for changed text */ - proftime_T *syntax_tm UNUSED) + int nochange UNUSED) /* not updating for changed text */ { int col = 0; /* visual column on screen */ unsigned off; /* offset in ScreenLines/ScreenAttrs */ @@ -3216,7 +3213,7 @@ win_line( * error, stop syntax highlighting. */ save_did_emsg = did_emsg; did_emsg = FALSE; - syntax_start(wp, lnum, syntax_tm); + syntax_start(wp, lnum); if (did_emsg) wp->w_s->b_syn_error = TRUE; else @@ -3614,7 +3611,7 @@ win_line( # ifdef FEAT_SYN_HL /* Need to restart syntax highlighting for this line. */ if (has_syntax) - syntax_start(wp, lnum, syntax_tm); + syntax_start(wp, lnum); # endif } #endif diff --git a/src/syntax.c b/src/syntax.c index 6361bd7aaf..d9a7b4fd8c 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -368,7 +368,7 @@ static win_T *syn_win; /* current window for highlighting */ static buf_T *syn_buf; /* current buffer for highlighting */ static synblock_T *syn_block; /* current buffer for highlighting */ #ifdef FEAT_RELTIME -static proftime_T *syn_tm; +static proftime_T *syn_tm; /* timeout limit */ #endif static linenr_T current_lnum = 0; /* lnum of current state */ static colnr_T current_col = 0; /* column of current state */ @@ -489,6 +489,18 @@ static int get_id_list(char_u **arg, int keylen, short **list, int skip); static void syn_combine_list(short **clstr1, short **clstr2, int list_op); static void syn_incl_toplevel(int id, int *flagsp); +#if defined(FEAT_RELTIME) || defined(PROTO) +/* + * Set the timeout used for syntax highlighting. + * Use NULL to reset, no timeout. + */ + void +syn_set_timeout(proftime_T *tm) +{ + syn_tm = tm; +} +#endif + /* * Start the syntax recognition for a line. This function is normally called * from the screen updating, once for each displayed line. @@ -497,7 +509,7 @@ static void syn_incl_toplevel(int id, int *flagsp); * window. */ void -syntax_start(win_T *wp, linenr_T lnum, proftime_T *syntax_tm UNUSED) +syntax_start(win_T *wp, linenr_T lnum) { synstate_T *p; synstate_T *last_valid = NULL; @@ -527,9 +539,6 @@ syntax_start(win_T *wp, linenr_T lnum, proftime_T *syntax_tm UNUSED) } changedtick = CHANGEDTICK(syn_buf); syn_win = wp; -#ifdef FEAT_RELTIME - syn_tm = syntax_tm; -#endif /* * Allocate syntax stack when needed. @@ -6569,7 +6578,7 @@ syn_get_id( if (wp->w_buffer != syn_buf || lnum != current_lnum || col < current_col) - syntax_start(wp, lnum, NULL); + syntax_start(wp, lnum); else if (wp->w_buffer == syn_buf && lnum == current_lnum && col > current_col) @@ -6645,7 +6654,7 @@ syn_get_foldlevel(win_T *wp, long lnum) # endif ) { - syntax_start(wp, lnum, NULL); + syntax_start(wp, lnum); for (i = 0; i < current_state.ga_len; ++i) if (CUR_STATE(i).si_flags & HL_FOLD) @@ -7006,7 +7015,7 @@ static char *(highlight_init_light[]) = { CENT("ToolbarLine term=underline ctermbg=LightGrey", "ToolbarLine term=underline ctermbg=LightGrey guibg=LightGrey"), CENT("ToolbarButton cterm=bold ctermfg=White ctermbg=DarkGrey", - "ToolbarButton cterm=bold ctermfg=White ctermbg=DarkGrey gui=bold guifg=White guibg=DarkGrey"), + "ToolbarButton cterm=bold ctermfg=White ctermbg=DarkGrey gui=bold guifg=White guibg=Grey40"), #endif NULL }; @@ -7102,7 +7111,7 @@ static char *(highlight_init_dark[]) = { #endif #ifdef FEAT_MENU CENT("ToolbarLine term=underline ctermbg=DarkGrey", - "ToolbarLine term=underline ctermbg=DarkGrey guibg=DarkGrey"), + "ToolbarLine term=underline ctermbg=DarkGrey guibg=Grey50"), CENT("ToolbarButton cterm=bold ctermfg=Black ctermbg=LightGrey", "ToolbarButton cterm=bold ctermfg=Black ctermbg=LightGrey gui=bold guifg=Black guibg=LightGrey"), #endif diff --git a/src/version.c b/src/version.c index b90665e51f..8901bb5965 100644 --- a/src/version.c +++ b/src/version.c @@ -761,6 +761,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1133, /**/ 1132, /**/ From 76301956f0c079d893cfd927b11456328bed4f9b Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 22 Sep 2017 13:53:37 +0200 Subject: [PATCH 03/12] patch 8.0.1134: superfluous call to syn_get_final_id() Problem: Superfluous call to syn_get_final_id(). Solution: Remove it. (Ken Takata) --- src/syntax.c | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/syntax.c b/src/syntax.c index d9a7b4fd8c..e0736cb63b 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -9556,7 +9556,7 @@ syn_name2attr(char_u *name) int id = syn_name2id(name); if (id != 0) - return syn_id2attr(syn_get_final_id(id)); + return syn_id2attr(id); return 0; } diff --git a/src/version.c b/src/version.c index 8901bb5965..044b98c9cb 100644 --- a/src/version.c +++ b/src/version.c @@ -761,6 +761,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1134, /**/ 1133, /**/ From 53f8174eaeb93b381cf74c58863f8fe82748a22a Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 22 Sep 2017 14:35:51 +0200 Subject: [PATCH 04/12] patch 8.0.1135: W_WINCOL() is always the same Problem: W_WINCOL() is always the same. Solution: Expand the macro. --- src/edit.c | 2 +- src/ex_docmd.c | 2 +- src/gui_gtk.c | 2 +- src/gui_w32.c | 2 +- src/if_py_both.h | 2 +- src/netbeans.c | 2 +- src/popupmnu.c | 6 +++--- src/screen.c | 44 ++++++++++++++++++++++---------------------- src/structs.h | 3 +-- src/term.c | 4 ++-- src/terminal.c | 4 ++-- src/ui.c | 2 +- src/version.c | 2 ++ src/vim.h | 1 - src/window.c | 2 +- 15 files changed, 40 insertions(+), 40 deletions(-) diff --git a/src/edit.c b/src/edit.c index 447e2ee29e..8486e34aaf 100644 --- a/src/edit.c +++ b/src/edit.c @@ -1776,7 +1776,7 @@ edit_putchar(int c, int highlight) else attr = 0; pc_row = W_WINROW(curwin) + curwin->w_wrow; - pc_col = W_WINCOL(curwin); + pc_col = curwin->w_wincol; #if defined(FEAT_RIGHTLEFT) || defined(FEAT_MBYTE) pc_status = PC_STATUS_UNSET; #endif diff --git a/src/ex_docmd.c b/src/ex_docmd.c index dbdd4034a9..adf42799e4 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -9111,7 +9111,7 @@ ex_sleep(exarg_T *eap) { n = W_WINROW(curwin) + curwin->w_wrow - msg_scrolled; if (n >= 0) - windgoto((int)n, W_WINCOL(curwin) + curwin->w_wcol); + windgoto((int)n, curwin->w_wincol + curwin->w_wcol); } len = eap->line2; diff --git a/src/gui_gtk.c b/src/gui_gtk.c index af8fcae11b..b321da0d58 100644 --- a/src/gui_gtk.c +++ b/src/gui_gtk.c @@ -1954,7 +1954,7 @@ popup_menu_position_func(GtkMenu *menu UNUSED, # endif { /* Find the cursor position in the current window */ - *x += FILL_X(W_WINCOL(curwin) + curwin->w_wcol + 1) + 1; + *x += FILL_X(curwin->w_wincol + curwin->w_wcol + 1) + 1; *y += FILL_Y(W_WINROW(curwin) + curwin->w_wrow + 1) + 1; } } diff --git a/src/gui_w32.c b/src/gui_w32.c index d9ac8465ee..aa09488433 100644 --- a/src/gui_w32.c +++ b/src/gui_w32.c @@ -6608,7 +6608,7 @@ gui_make_popup(char_u *path_name, int mouse_pos) } else if (curwin != NULL) { - p.x += TEXT_X(W_WINCOL(curwin) + curwin->w_wcol + 1); + p.x += TEXT_X(curwin->w_wincol + curwin->w_wcol + 1); p.y += TEXT_Y(W_WINROW(curwin) + curwin->w_wrow + 1); } msg_scroll = FALSE; diff --git a/src/if_py_both.h b/src/if_py_both.h index aa6f06bbce..ea8752d98a 100644 --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -3877,7 +3877,7 @@ WindowAttr(WindowObject *self, char *name) else if (strcmp(name, "width") == 0) return PyLong_FromLong((long)(W_WIDTH(self->win))); else if (strcmp(name, "col") == 0) - return PyLong_FromLong((long)(W_WINCOL(self->win))); + return PyLong_FromLong((long)(self->win->w_wincol)); else if (strcmp(name, "vars") == 0) return NEW_DICTIONARY(self->win->w_vars); else if (strcmp(name, "options") == 0) diff --git a/src/netbeans.c b/src/netbeans.c index 3685e151a8..1a86727b7a 100644 --- a/src/netbeans.c +++ b/src/netbeans.c @@ -2872,7 +2872,7 @@ netbeans_button_release(int button) if (bufno >= 0 && curwin != NULL && curwin->w_buffer == curbuf) { - int col = mouse_col - W_WINCOL(curwin) + int col = mouse_col - curwin->w_wincol - ((curwin->w_p_nu || curwin->w_p_rnu) ? 9 : 1); long off = pos2off(curbuf, &curwin->w_cursor); diff --git a/src/popupmnu.c b/src/popupmnu.c index 23e8711906..0467c39845 100644 --- a/src/popupmnu.c +++ b/src/popupmnu.c @@ -190,10 +190,10 @@ redo: /* Calculate column */ #ifdef FEAT_RIGHTLEFT if (curwin->w_p_rl) - col = W_WINCOL(curwin) + W_WIDTH(curwin) - curwin->w_wcol - 1; + col = curwin->w_wincol + W_WIDTH(curwin) - curwin->w_wcol - 1; else #endif - col = W_WINCOL(curwin) + curwin->w_wcol; + col = curwin->w_wincol + curwin->w_wcol; /* if there are more items than room we need a scrollbar */ if (pum_height < size) @@ -312,7 +312,7 @@ pum_redraw(void) #ifdef FEAT_RIGHTLEFT if (curwin->w_p_rl) { - if (pum_col < W_WINCOL(curwin) + W_WIDTH(curwin) - 1) + if (pum_col < curwin->w_wincol + W_WIDTH(curwin) - 1) screen_putchar(' ', row, pum_col + 1, attr); } else diff --git a/src/screen.c b/src/screen.c index fb9241637c..260471acef 100644 --- a/src/screen.c +++ b/src/screen.c @@ -2211,10 +2211,10 @@ win_update(win_T *wp) /* * Last line isn't finished: Display "@@@" in the last screen line. */ - screen_puts_len((char_u *)"@@", 2, scr_row, W_WINCOL(wp), + screen_puts_len((char_u *)"@@", 2, scr_row, wp->w_wincol, HL_ATTR(HLF_AT)); screen_fill(scr_row, scr_row + 1, - (int)W_WINCOL(wp) + 2, (int)W_ENDCOL(wp), + (int)wp->w_wincol + 2, (int)W_ENDCOL(wp), '@', ' ', HL_ATTR(HLF_AT)); set_empty_rows(wp, srow); wp->w_botline = lnum; @@ -2375,7 +2375,7 @@ win_draw_end( } # endif screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, - W_WINCOL(wp), W_ENDCOL(wp) - 1 - FDC_OFF, + wp->w_wincol, W_ENDCOL(wp) - 1 - FDC_OFF, c2, c2, HL_ATTR(hl)); screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, W_ENDCOL(wp) - 1 - FDC_OFF, W_ENDCOL(wp) - FDC_OFF, @@ -2392,7 +2392,7 @@ win_draw_end( if (n > wp->w_width) n = wp->w_width; screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, - W_WINCOL(wp), (int)W_WINCOL(wp) + n, + wp->w_wincol, (int)wp->w_wincol + n, cmdwin_type, ' ', HL_ATTR(HLF_AT)); } #endif @@ -2405,7 +2405,7 @@ win_draw_end( if (nn > W_WIDTH(wp)) nn = W_WIDTH(wp); screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, - W_WINCOL(wp) + n, (int)W_WINCOL(wp) + nn, + wp->w_wincol + n, (int)wp->w_wincol + nn, ' ', ' ', HL_ATTR(HLF_FC)); n = nn; } @@ -2419,13 +2419,13 @@ win_draw_end( if (nn > W_WIDTH(wp)) nn = W_WIDTH(wp); screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, - W_WINCOL(wp) + n, (int)W_WINCOL(wp) + nn, + wp->w_wincol + n, (int)wp->w_wincol + nn, ' ', ' ', HL_ATTR(HLF_SC)); n = nn; } #endif screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, - W_WINCOL(wp) + FDC_OFF, (int)W_ENDCOL(wp), + wp->w_wincol + FDC_OFF, (int)W_ENDCOL(wp), c1, c2, HL_ATTR(hl)); } set_empty_rows(wp, row); @@ -2894,7 +2894,7 @@ fold_line( } #endif - screen_line(row + W_WINROW(wp), W_WINCOL(wp), (int)W_WIDTH(wp), + screen_line(row + W_WINROW(wp), wp->w_wincol, (int)W_WIDTH(wp), (int)W_WIDTH(wp), FALSE); /* @@ -4016,7 +4016,7 @@ win_line( #endif ) { - screen_line(screen_row, W_WINCOL(wp), col, -(int)W_WIDTH(wp), + screen_line(screen_row, wp->w_wincol, col, -(int)W_WIDTH(wp), HAS_RIGHTLEFT(wp->w_p_rl)); /* Pretend we have finished updating the window. Except when * 'cursorcolumn' is set. */ @@ -5488,7 +5488,7 @@ win_line( } #endif - screen_line(screen_row, W_WINCOL(wp), col, + screen_line(screen_row, wp->w_wincol, col, (int)W_WIDTH(wp), HAS_RIGHTLEFT(wp->w_p_rl)); row++; @@ -5794,11 +5794,11 @@ win_line( ) { #ifdef FEAT_CONCEAL - screen_line(screen_row, W_WINCOL(wp), col - boguscols, + screen_line(screen_row, wp->w_wincol, col - boguscols, (int)W_WIDTH(wp), HAS_RIGHTLEFT(wp->w_p_rl)); boguscols = 0; #else - screen_line(screen_row, W_WINCOL(wp), col, + screen_line(screen_row, wp->w_wincol, col, (int)W_WIDTH(wp), HAS_RIGHTLEFT(wp->w_p_rl)); #endif ++row; @@ -6931,14 +6931,14 @@ win_redr_status(win_T *wp) } row = W_WINROW(wp) + wp->w_height; - screen_puts(p, row, W_WINCOL(wp), attr); - screen_fill(row, row + 1, len + W_WINCOL(wp), - this_ru_col + W_WINCOL(wp), fillchar, fillchar, attr); + screen_puts(p, row, wp->w_wincol, attr); + screen_fill(row, row + 1, len + wp->w_wincol, + this_ru_col + wp->w_wincol, fillchar, fillchar, attr); if (get_keymap_str(wp, (char_u *)"<%s>", NameBuff, MAXPATHL) && (int)(this_ru_col - len) > (int)(STRLEN(NameBuff) + 1)) screen_puts(NameBuff, row, (int)(this_ru_col - STRLEN(NameBuff) - - 1 + W_WINCOL(wp)), attr); + - 1 + wp->w_wincol), attr); #ifdef FEAT_CMDL_INFO win_redr_ruler(wp, TRUE); @@ -7167,7 +7167,7 @@ win_redr_custom( # endif } - col += W_WINCOL(wp); + col += wp->w_wincol; } if (maxwidth <= 0) @@ -9418,7 +9418,7 @@ setcursor(void) { validate_cursor(); windgoto(W_WINROW(curwin) + curwin->w_wrow, - W_WINCOL(curwin) + ( + curwin->w_wincol + ( #ifdef FEAT_RIGHTLEFT /* With 'rightleft' set and the cursor on a double-wide * character, position it on the leftmost column. */ @@ -9495,7 +9495,7 @@ win_ins_lines( if (lastrow > Rows) lastrow = Rows; screen_fill(nextrow - line_count, lastrow - line_count, - W_WINCOL(wp), (int)W_ENDCOL(wp), + wp->w_wincol, (int)W_ENDCOL(wp), ' ', ' ', 0); } @@ -9606,7 +9606,7 @@ win_do_lines( if (row + line_count >= wp->w_height) { screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + wp->w_height, - W_WINCOL(wp), (int)W_ENDCOL(wp), + wp->w_wincol, (int)W_ENDCOL(wp), ' ', ' ', 0); return OK; } @@ -10768,7 +10768,7 @@ redraw_win_toolbar(win_T *wp) } wp->w_winbar_items[item_idx].wb_menu = NULL; /* end marker */ - screen_line(wp->w_winrow, W_WINCOL(wp), (int)W_WIDTH(wp), + screen_line(wp->w_winrow, wp->w_wincol, (int)W_WIDTH(wp), (int)W_WIDTH(wp), FALSE); } #endif @@ -10900,7 +10900,7 @@ win_redr_ruler(win_T *wp, int always) { row = W_WINROW(wp) + wp->w_height; fillchar = fillchar_status(&attr, wp); - off = W_WINCOL(wp); + off = wp->w_wincol; width = W_WIDTH(wp); } else diff --git a/src/structs.h b/src/structs.h index 94d7391919..768ff586bd 100644 --- a/src/structs.h +++ b/src/structs.h @@ -2700,8 +2700,7 @@ struct window_S int w_height; /* number of rows in window, excluding status/command/winbar line(s) */ int w_status_height; /* number of status lines (0 or 1) */ - int w_wincol; /* Leftmost column of window in screen. - use W_WINCOL() */ + int w_wincol; /* Leftmost column of window in screen. */ int w_width; /* Width of window, excluding separation. use W_WIDTH() */ int w_vsep_width; /* Number of separator columns (0 or 1). diff --git a/src/term.c b/src/term.c index 25aaa91ddc..5714c89291 100644 --- a/src/term.c +++ b/src/term.c @@ -3816,8 +3816,8 @@ scroll_region_set(win_T *wp, int off) OUT_STR(tgoto((char *)T_CS, W_WINROW(wp) + wp->w_height - 1, W_WINROW(wp) + off)); if (*T_CSV != NUL && wp->w_width != Columns) - OUT_STR(tgoto((char *)T_CSV, W_WINCOL(wp) + wp->w_width - 1, - W_WINCOL(wp))); + OUT_STR(tgoto((char *)T_CSV, wp->w_wincol + wp->w_width - 1, + wp->w_wincol)); screen_start(); /* don't know where cursor is now */ } diff --git a/src/terminal.c b/src/terminal.c index 9b5e4ce363..18a0e619b1 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -730,7 +730,7 @@ term_send_mouse(VTerm *vterm, int button, int pressed) VTermModifier mod = VTERM_MOD_NONE; vterm_mouse_move(vterm, mouse_row - W_WINROW(curwin), - mouse_col - W_WINCOL(curwin), mod); + mouse_col - curwin->w_wincol, mod); vterm_mouse_button(vterm, button, pressed, mod); return TRUE; } @@ -1308,7 +1308,7 @@ send_keys_to_term(term_T *term, int c, int typed) case K_MOUSERIGHT: if (mouse_row < W_WINROW(curwin) || mouse_row >= (W_WINROW(curwin) + curwin->w_height) - || mouse_col < W_WINCOL(curwin) + || mouse_col < curwin->w_wincol || mouse_col >= W_ENDCOL(curwin) || dragging_outside) { diff --git a/src/ui.c b/src/ui.c index c26cb378ff..64553b1fed 100644 --- a/src/ui.c +++ b/src/ui.c @@ -2845,7 +2845,7 @@ retnomove: #endif row -= W_WINROW(curwin); - col -= W_WINCOL(curwin); + col -= curwin->w_wincol; /* * When clicking beyond the end of the window, scroll the screen. diff --git a/src/version.c b/src/version.c index 044b98c9cb..6facb341dc 100644 --- a/src/version.c +++ b/src/version.c @@ -761,6 +761,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1135, /**/ 1134, /**/ diff --git a/src/vim.h b/src/vim.h index cb771ffc1b..8153ef834e 100644 --- a/src/vim.h +++ b/src/vim.h @@ -859,7 +859,6 @@ extern int (*dyn_libintl_putenv)(const char *envstring); #define FINDFILE_DIR 1 /* only directories */ #define FINDFILE_BOTH 2 /* files and directories */ -#define W_WINCOL(wp) (wp->w_wincol) #define W_WIDTH(wp) (wp->w_width) #define W_ENDCOL(wp) (wp->w_wincol + wp->w_width) #define W_VSEP_WIDTH(wp) (wp->w_vsep_width) diff --git a/src/window.c b/src/window.c index 370f749a8c..ca56d9cc7d 100644 --- a/src/window.c +++ b/src/window.c @@ -2724,7 +2724,7 @@ winframe_remove( if (frp2 == frp_close->fr_next) { int row = win->w_winrow; - int col = W_WINCOL(win); + int col = win->w_wincol; frame_comp_pos(frp2, &row, &col); } From 0263146b5dbbb6c120ce2e7720256503b864425d Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 22 Sep 2017 15:20:32 +0200 Subject: [PATCH 05/12] patch 8.0.1136: W_WIDTH() is always the same Problem: W_WIDTH() is always the same. Solution: Expand the macro. --- src/charset.c | 20 +++---- src/edit.c | 12 ++--- src/evalfunc.c | 2 +- src/ex_cmds.c | 2 +- src/ex_docmd.c | 2 +- src/getchar.c | 6 +-- src/gui.c | 6 +-- src/gui_beval.c | 2 +- src/gui_mac.c | 2 +- src/if_lua.c | 2 +- src/if_mzsch.c | 2 +- src/if_py_both.h | 2 +- src/if_ruby.c | 2 +- src/misc1.c | 6 +-- src/misc2.c | 6 +-- src/move.c | 22 ++++---- src/normal.c | 22 ++++---- src/popupmnu.c | 4 +- src/quickfix.c | 2 +- src/screen.c | 138 +++++++++++++++++++++++------------------------ src/search.c | 2 +- src/structs.h | 3 +- src/ui.c | 8 +-- src/version.c | 2 + src/vim.h | 1 - src/window.c | 6 +-- 26 files changed, 142 insertions(+), 142 deletions(-) diff --git a/src/charset.c b/src/charset.c index 4f79c90aac..4516816fe4 100644 --- a/src/charset.c +++ b/src/charset.c @@ -1100,7 +1100,7 @@ win_lbr_chartabsize( */ numberextra = win_col_off(wp); col2 = col; - colmax = (colnr_T)(W_WIDTH(wp) - numberextra - col_adj); + colmax = (colnr_T)(wp->w_width - numberextra - col_adj); if (col >= colmax) { colmax += col_adj; @@ -1151,10 +1151,10 @@ win_lbr_chartabsize( numberextra = numberwidth; col += numberextra + mb_added; - if (col >= (colnr_T)W_WIDTH(wp)) + if (col >= (colnr_T)wp->w_width) { - col -= W_WIDTH(wp); - numberextra = W_WIDTH(wp) - (numberextra - win_col_off2(wp)); + col -= wp->w_width; + numberextra = wp->w_width - (numberextra - win_col_off2(wp)); if (col >= numberextra && numberextra > 0) col %= numberextra; if (*p_sbr != NUL) @@ -1170,18 +1170,18 @@ win_lbr_chartabsize( numberwidth -= win_col_off2(wp); } - if (col == 0 || col + size + sbrlen > (colnr_T)W_WIDTH(wp)) + if (col == 0 || col + size + sbrlen > (colnr_T)wp->w_width) { added = 0; if (*p_sbr != NUL) { - if (size + sbrlen + numberwidth > (colnr_T)W_WIDTH(wp)) + if (size + sbrlen + numberwidth > (colnr_T)wp->w_width) { /* calculate effective window width */ - int width = (colnr_T)W_WIDTH(wp) - sbrlen - numberwidth; - int prev_width = col ? ((colnr_T)W_WIDTH(wp) - (sbrlen + col)) : 0; + int width = (colnr_T)wp->w_width - sbrlen - numberwidth; + int prev_width = col ? ((colnr_T)wp->w_width - (sbrlen + col)) : 0; if (width == 0) - width = (colnr_T)W_WIDTH(wp); + width = (colnr_T)wp->w_width; added += ((size - prev_width) / width) * vim_strsize(p_sbr); if ((size - prev_width) % width) /* wrapped, add another length of 'sbr' */ @@ -1248,7 +1248,7 @@ in_win_border(win_T *wp, colnr_T vcol) if (wp->w_width == 0) /* there is no border */ return FALSE; - width1 = W_WIDTH(wp) - win_col_off(wp); + width1 = wp->w_width - win_col_off(wp); if ((int)vcol < width1 - 1) return FALSE; if ((int)vcol == width1 - 1) diff --git a/src/edit.c b/src/edit.c index 8486e34aaf..14201a2ec3 100644 --- a/src/edit.c +++ b/src/edit.c @@ -1783,7 +1783,7 @@ edit_putchar(int c, int highlight) #ifdef FEAT_RIGHTLEFT if (curwin->w_p_rl) { - pc_col += W_WIDTH(curwin) - 1 - curwin->w_wcol; + pc_col += curwin->w_width - 1 - curwin->w_wcol; # ifdef FEAT_MBYTE if (has_mbyte) { @@ -1865,7 +1865,7 @@ display_dollar(colnr_T col) } #endif curs_columns(FALSE); /* recompute w_wrow and w_wcol */ - if (curwin->w_wcol < W_WIDTH(curwin)) + if (curwin->w_wcol < curwin->w_width) { edit_putchar('$', FALSE); dollar_vcol = curwin->w_virtcol; @@ -6820,7 +6820,7 @@ check_auto_format( /* * Find out textwidth to be used for formatting: * if 'textwidth' option is set, use it - * else if 'wrapmargin' option is set, use W_WIDTH(curwin) - 'wrapmargin' + * else if 'wrapmargin' option is set, use curwin->w_width - 'wrapmargin' * if invalid value, use 0. * Set default to window width (maximum 79) for "gq" operator. */ @@ -6835,7 +6835,7 @@ comp_textwidth( { /* The width is the window width minus 'wrapmargin' minus all the * things that add to the margin. */ - textwidth = W_WIDTH(curwin) - curbuf->b_p_wm; + textwidth = curwin->w_width - curbuf->b_p_wm; #ifdef FEAT_CMDWIN if (cmdwin_type != 0) textwidth -= 1; @@ -6854,7 +6854,7 @@ comp_textwidth( textwidth = 0; if (ff && textwidth == 0) { - textwidth = W_WIDTH(curwin) - 1; + textwidth = curwin->w_width - 1; if (textwidth > 79) textwidth = 79; } @@ -9447,7 +9447,7 @@ ins_mousescroll(int dir) int val, step = 6; if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)) - step = W_WIDTH(curwin); + step = curwin->w_width; val = curwin->w_leftcol + (dir == MSCR_RIGHT ? -step : step); if (val < 0) val = 0; diff --git a/src/evalfunc.c b/src/evalfunc.c index 6c2a73e800..7b019a53d7 100644 --- a/src/evalfunc.c +++ b/src/evalfunc.c @@ -13239,7 +13239,7 @@ f_winrestview(typval_T *argvars, typval_T *rettv UNUSED) check_cursor(); win_new_height(curwin, curwin->w_height); - win_new_width(curwin, W_WIDTH(curwin)); + win_new_width(curwin, curwin->w_width); changed_window_setting(); if (curwin->w_topline <= 0) diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 143ea55e42..b4351b23dc 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -177,7 +177,7 @@ ex_align(exarg_T *eap) if (width <= 0) width = curbuf->b_p_tw; if (width == 0 && curbuf->b_p_wm > 0) - width = W_WIDTH(curwin) - curbuf->b_p_wm; + width = curwin->w_width - curbuf->b_p_wm; if (width <= 0) width = 80; } diff --git a/src/ex_docmd.c b/src/ex_docmd.c index adf42799e4..29435c2ea8 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -8486,7 +8486,7 @@ ex_resize(exarg_T *eap) if (cmdmod.split & WSP_VERT) { if (*eap->arg == '-' || *eap->arg == '+') - n += W_WIDTH(curwin); + n += curwin->w_width; else if (n == 0 && eap->arg[0] == NUL) /* default is very wide */ n = 9999; win_setwidth_win((int)n, wp); diff --git a/src/getchar.c b/src/getchar.c index 179b2f3e0e..ef42d9c8cc 100644 --- a/src/getchar.c +++ b/src/getchar.c @@ -2666,8 +2666,8 @@ vgetorpeek(int advance) ++col; } curwin->w_wrow = curwin->w_cline_row - + curwin->w_wcol / W_WIDTH(curwin); - curwin->w_wcol %= W_WIDTH(curwin); + + curwin->w_wcol / curwin->w_width; + curwin->w_wcol %= curwin->w_width; curwin->w_wcol += curwin_col_off(); #ifdef FEAT_MBYTE col = 0; /* no correction needed */ @@ -2684,7 +2684,7 @@ vgetorpeek(int advance) else if (curwin->w_p_wrap && curwin->w_wrow) { --curwin->w_wrow; - curwin->w_wcol = W_WIDTH(curwin) - 1; + curwin->w_wcol = curwin->w_width - 1; #ifdef FEAT_MBYTE col = curwin->w_cursor.col - 1; #endif diff --git a/src/gui.c b/src/gui.c index 4f9c63f669..a17c57112d 100644 --- a/src/gui.c +++ b/src/gui.c @@ -4564,14 +4564,14 @@ gui_update_horiz_scrollbar(int force) return; } - size = W_WIDTH(curwin); + size = curwin->w_width; if (curwin->w_p_wrap) { value = 0; #ifdef SCROLL_PAST_END max = 0; #else - max = W_WIDTH(curwin) - 1; + max = curwin->w_width - 1; #endif } else @@ -4591,7 +4591,7 @@ gui_update_horiz_scrollbar(int force) #endif #ifndef SCROLL_PAST_END - max += W_WIDTH(curwin) - 1; + max += curwin->w_width - 1; #endif /* The line number isn't scrolled, thus there is less space when * 'number' or 'relativenumber' is set (also for 'foldcolumn'). */ diff --git a/src/gui_beval.c b/src/gui_beval.c index 2dbce7e595..1c01ecc84a 100644 --- a/src/gui_beval.c +++ b/src/gui_beval.c @@ -338,7 +338,7 @@ get_beval_info( row = Y_2_ROW(beval->y); col = X_2_COL(beval->x); wp = mouse_find_win(&row, &col); - if (wp != NULL && row < wp->w_height && col < W_WIDTH(wp)) + if (wp != NULL && row < wp->w_height && col < wp->w_width) { /* Found a window and the cursor is in the text. Now find the line * number. */ diff --git a/src/gui_mac.c b/src/gui_mac.c index 8803487dea..bbb0857a0c 100644 --- a/src/gui_mac.c +++ b/src/gui_mac.c @@ -1612,7 +1612,7 @@ gui_mac_scroll_action(ControlHandle theControl, short partCode) else /* Bottom scrollbar */ { sb_info = sb; - page = W_WIDTH(curwin) - 5; + page = curwin->w_width - 5; } switch (partCode) diff --git a/src/if_lua.c b/src/if_lua.c index ef827ca589..bc7029389e 100644 --- a/src/if_lua.c +++ b/src/if_lua.c @@ -1179,7 +1179,7 @@ luaV_window_index(lua_State *L) else if (strncmp(s, "col", 3) == 0) lua_pushinteger(L, w->w_cursor.col + 1); else if (strncmp(s, "width", 5) == 0) - lua_pushinteger(L, W_WIDTH(w)); + lua_pushinteger(L, w->w_width); else if (strncmp(s, "height", 6) == 0) lua_pushinteger(L, w->w_height); /* methods */ diff --git a/src/if_mzsch.c b/src/if_mzsch.c index 6577822731..c9c5969483 100644 --- a/src/if_mzsch.c +++ b/src/if_mzsch.c @@ -2063,7 +2063,7 @@ get_window_width(void *data, int argc, Scheme_Object **argv) Vim_Prim *prim = (Vim_Prim *)data; vim_mz_window *win = get_window_arg(prim->name, 0, argc, argv); - return scheme_make_integer(W_WIDTH(win->win)); + return scheme_make_integer(win->win->w_width); } /* (set-win-width {width} [window]) */ diff --git a/src/if_py_both.h b/src/if_py_both.h index ea8752d98a..e717646d05 100644 --- a/src/if_py_both.h +++ b/src/if_py_both.h @@ -3875,7 +3875,7 @@ WindowAttr(WindowObject *self, char *name) else if (strcmp(name, "row") == 0) return PyLong_FromLong((long)(self->win->w_winrow)); else if (strcmp(name, "width") == 0) - return PyLong_FromLong((long)(W_WIDTH(self->win))); + return PyLong_FromLong((long)(self->win->w_width)); else if (strcmp(name, "col") == 0) return PyLong_FromLong((long)(self->win->w_wincol)); else if (strcmp(name, "vars") == 0) diff --git a/src/if_ruby.c b/src/if_ruby.c index c1a6840f4d..9474e7c8a6 100644 --- a/src/if_ruby.c +++ b/src/if_ruby.c @@ -1470,7 +1470,7 @@ static VALUE window_set_height(VALUE self, VALUE height) static VALUE window_width(VALUE self UNUSED) { - return INT2NUM(W_WIDTH(get_win(self))); + return INT2NUM(get_win(self->w_width)); } static VALUE window_set_width(VALUE self UNUSED, VALUE width) diff --git a/src/misc1.c b/src/misc1.c index 369b716ad5..f7789ff794 100644 --- a/src/misc1.c +++ b/src/misc1.c @@ -495,7 +495,7 @@ get_breakindent_win( static varnumber_T prev_tick = 0; /* changedtick of cached value */ int bri = 0; /* window width minus window margin space, i.e. what rests for text */ - const int eff_wwidth = W_WIDTH(wp) + const int eff_wwidth = wp->w_width - ((wp->w_p_nu || wp->w_p_rnu) && (vim_strchr(p_cpo, CPO_NUMCOL) == NULL) ? number_width(wp) + 1 : 0); @@ -2026,7 +2026,7 @@ plines_win_nofold(win_T *wp, linenr_T lnum) /* * Add column offset for 'number', 'relativenumber' and 'foldcolumn'. */ - width = W_WIDTH(wp) - win_col_off(wp); + width = wp->w_width - win_col_off(wp); if (width <= 0) return 32000; if (col <= width) @@ -2083,7 +2083,7 @@ plines_win_col(win_T *wp, linenr_T lnum, long column) /* * Add column offset for 'number', 'relativenumber', 'foldcolumn', etc. */ - width = W_WIDTH(wp) - win_col_off(wp); + width = wp->w_width - win_col_off(wp); if (width <= 0) return 9999; diff --git a/src/misc2.c b/src/misc2.c index d956e3a6b8..fac44c737a 100644 --- a/src/misc2.c +++ b/src/misc2.c @@ -165,7 +165,7 @@ coladvance2( else { #ifdef FEAT_VIRTUALEDIT - int width = W_WIDTH(curwin) - win_col_off(curwin); + int width = curwin->w_width - win_col_off(curwin); if (finetune && curwin->w_p_wrap @@ -310,7 +310,7 @@ coladvance2( int b = (int)wcol - (int)col; /* The difference between wcol and col is used to set coladd. */ - if (b > 0 && b < (MAXCOL - 2 * W_WIDTH(curwin))) + if (b > 0 && b < (MAXCOL - 2 * curwin->w_width)) pos->coladd = b; col += b; @@ -662,7 +662,7 @@ leftcol_changed(void) int retval = FALSE; changed_cline_bef_curs(); - lastcol = curwin->w_leftcol + W_WIDTH(curwin) - curwin_col_off() - 1; + lastcol = curwin->w_leftcol + curwin->w_width - curwin_col_off() - 1; validate_virtcol(); /* diff --git a/src/move.c b/src/move.c index c520f5fd51..4e5618d7b7 100644 --- a/src/move.c +++ b/src/move.c @@ -855,14 +855,14 @@ validate_cursor_col(void) col = curwin->w_virtcol; off = curwin_col_off(); col += off; - width = W_WIDTH(curwin) - off + curwin_col_off2(); + width = curwin->w_width - off + curwin_col_off2(); /* long line wrapping, adjust curwin->w_wrow */ if (curwin->w_p_wrap - && col >= (colnr_T)W_WIDTH(curwin) + && col >= (colnr_T)curwin->w_width && width > 0) /* use same formula as what is used in curs_columns() */ - col -= ((col - W_WIDTH(curwin)) / width + 1) * width; + col -= ((col - curwin->w_width) / width + 1) * width; if (col > (int)curwin->w_leftcol) col -= curwin->w_leftcol; else @@ -975,11 +975,11 @@ curs_columns( */ curwin->w_wrow = curwin->w_cline_row; - textwidth = W_WIDTH(curwin) - extra; + textwidth = curwin->w_width - extra; if (textwidth <= 0) { /* No room for text, put cursor in last char of window. */ - curwin->w_wcol = W_WIDTH(curwin) - 1; + curwin->w_wcol = curwin->w_width - 1; curwin->w_wrow = curwin->w_height - 1; } else if (curwin->w_p_wrap && curwin->w_width != 0) @@ -987,10 +987,10 @@ curs_columns( width = textwidth + curwin_col_off2(); /* long line wrapping, adjust curwin->w_wrow */ - if (curwin->w_wcol >= W_WIDTH(curwin)) + if (curwin->w_wcol >= curwin->w_width) { /* this same formula is used in validate_cursor_col() */ - n = (curwin->w_wcol - W_WIDTH(curwin)) / width + 1; + n = (curwin->w_wcol - curwin->w_width) / width + 1; curwin->w_wcol -= n * width; curwin->w_wrow += n; @@ -1021,7 +1021,7 @@ curs_columns( * extra */ off_left = (int)startcol - (int)curwin->w_leftcol - p_siso; - off_right = (int)endcol - (int)(curwin->w_leftcol + W_WIDTH(curwin) + off_right = (int)endcol - (int)(curwin->w_leftcol + curwin->w_width - p_siso) + 1; if (off_left < 0 || off_right > 0) { @@ -1249,7 +1249,7 @@ scrolldown( validate_virtcol(); validate_cheight(); wrow += curwin->w_cline_height - 1 - - curwin->w_virtcol / W_WIDTH(curwin); + curwin->w_virtcol / curwin->w_width; } while (wrow >= curwin->w_height && curwin->w_cursor.lnum > 1) { @@ -1454,7 +1454,7 @@ scrolldown_clamp(void) validate_cheight(); validate_virtcol(); end_row += curwin->w_cline_height - 1 - - curwin->w_virtcol / W_WIDTH(curwin); + curwin->w_virtcol / curwin->w_width; } if (end_row < curwin->w_height - p_so) { @@ -1512,7 +1512,7 @@ scrollup_clamp(void) if (curwin->w_p_wrap && curwin->w_width != 0) { validate_virtcol(); - start_row -= curwin->w_virtcol / W_WIDTH(curwin); + start_row -= curwin->w_virtcol / curwin->w_width; } if (start_row >= p_so) { diff --git a/src/normal.c b/src/normal.c index 6fffbcbc17..d2d1a29215 100644 --- a/src/normal.c +++ b/src/normal.c @@ -4448,8 +4448,8 @@ nv_screengo(oparg_T *oap, int dir, long dist) col_off1 = curwin_col_off(); col_off2 = col_off1 - curwin_col_off2(); - width1 = W_WIDTH(curwin) - col_off1; - width2 = W_WIDTH(curwin) - col_off2; + width1 = curwin->w_width - col_off1; + width2 = curwin->w_width - col_off2; if (width2 == 0) width2 = 1; /* avoid divide by zero */ @@ -4634,7 +4634,7 @@ nv_mousescroll(cmdarg_T *cap) int val, step = 6; if (mod_mask & (MOD_MASK_SHIFT | MOD_MASK_CTRL)) - step = W_WIDTH(curwin); + step = curwin->w_width; val = curwin->w_leftcol + (cap->arg == MSCR_RIGHT ? -step : +step); if (val < 0) val = 0; @@ -4886,7 +4886,7 @@ dozet: /* "zH" - scroll screen right half-page */ case 'H': - cap->count1 *= W_WIDTH(curwin) / 2; + cap->count1 *= curwin->w_width / 2; /* FALLTHROUGH */ /* "zh" - scroll screen to the right */ @@ -4903,7 +4903,7 @@ dozet: break; /* "zL" - scroll screen left half-page */ - case 'L': cap->count1 *= W_WIDTH(curwin) / 2; + case 'L': cap->count1 *= curwin->w_width / 2; /* FALLTHROUGH */ /* "zl" - scroll screen to the left */ @@ -4947,7 +4947,7 @@ dozet: else #endif getvcol(curwin, &curwin->w_cursor, NULL, NULL, &col); - n = W_WIDTH(curwin) - curwin_col_off(); + n = curwin->w_width - curwin_col_off(); if ((long)col + p_siso < n) col = 0; else @@ -8073,7 +8073,7 @@ nv_g_cmd(cmdarg_T *cap) oap->inclusive = FALSE; if (curwin->w_p_wrap && curwin->w_width != 0) { - int width1 = W_WIDTH(curwin) - curwin_col_off(); + int width1 = curwin->w_width - curwin_col_off(); int width2 = width1 + curwin_col_off2(); validate_virtcol(); @@ -8087,7 +8087,7 @@ nv_g_cmd(cmdarg_T *cap) * 'relativenumber' is on and lines are wrapping the middle can be more * to the left. */ if (cap->nchar == 'm') - i += (W_WIDTH(curwin) - curwin_col_off() + i += (curwin->w_width - curwin_col_off() + ((curwin->w_p_wrap && i > 0) ? curwin_col_off2() : 0)) / 2; coladvance((colnr_T)i); @@ -8139,7 +8139,7 @@ nv_g_cmd(cmdarg_T *cap) curwin->w_curswant = MAXCOL; /* so we stay at the end */ if (cap->count1 == 1) { - int width1 = W_WIDTH(curwin) - col_off; + int width1 = curwin->w_width - col_off; int width2 = width1 + curwin_col_off2(); validate_virtcol(); @@ -8171,7 +8171,7 @@ nv_g_cmd(cmdarg_T *cap) } else { - i = curwin->w_leftcol + W_WIDTH(curwin) - col_off - 1; + i = curwin->w_leftcol + curwin->w_width - col_off - 1; coladvance((colnr_T)i); /* Make sure we stick in this column. */ @@ -9565,7 +9565,7 @@ get_op_vcol( colnr_T start, end; if (VIsual_mode != Ctrl_V - || (!initial && oap->end.col < W_WIDTH(curwin))) + || (!initial && oap->end.col < curwin->w_width)) return; oap->block_mode = TRUE; diff --git a/src/popupmnu.c b/src/popupmnu.c index 0467c39845..c2b3e73619 100644 --- a/src/popupmnu.c +++ b/src/popupmnu.c @@ -190,7 +190,7 @@ redo: /* Calculate column */ #ifdef FEAT_RIGHTLEFT if (curwin->w_p_rl) - col = curwin->w_wincol + W_WIDTH(curwin) - curwin->w_wcol - 1; + col = curwin->w_wincol + curwin->w_width - curwin->w_wcol - 1; else #endif col = curwin->w_wincol + curwin->w_wcol; @@ -312,7 +312,7 @@ pum_redraw(void) #ifdef FEAT_RIGHTLEFT if (curwin->w_p_rl) { - if (pum_col < curwin->w_wincol + W_WIDTH(curwin) - 1) + if (pum_col < curwin->w_wincol + curwin->w_width - 1) screen_putchar(' ', row, pum_col + 1, attr); } else diff --git a/src/quickfix.c b/src/quickfix.c index 4625db9844..850fa7b6c8 100644 --- a/src/quickfix.c +++ b/src/quickfix.c @@ -3148,7 +3148,7 @@ ex_copen(exarg_T *eap) { if (cmdmod.split & WSP_VERT) { - if (height != W_WIDTH(win)) + if (height != win->w_width) win_setwidth(height); } else if (height != win->w_height) diff --git a/src/screen.c b/src/screen.c index 260471acef..13b6a06323 100644 --- a/src/screen.c +++ b/src/screen.c @@ -2353,8 +2353,8 @@ win_draw_end( if (n > 0) { /* draw the fold column at the right */ - if (n > W_WIDTH(wp)) - n = W_WIDTH(wp); + if (n > wp->w_width) + n = wp->w_width; screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, W_ENDCOL(wp) - n, (int)W_ENDCOL(wp), ' ', ' ', HL_ATTR(HLF_FC)); @@ -2366,8 +2366,8 @@ win_draw_end( int nn = n + 2; /* draw the sign column left of the fold column */ - if (nn > W_WIDTH(wp)) - nn = W_WIDTH(wp); + if (nn > wp->w_width) + nn = wp->w_width; screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, W_ENDCOL(wp) - nn, (int)W_ENDCOL(wp) - n, ' ', ' ', HL_ATTR(HLF_SC)); @@ -2402,8 +2402,8 @@ win_draw_end( int nn = n + fdc; /* draw the fold column at the left */ - if (nn > W_WIDTH(wp)) - nn = W_WIDTH(wp); + if (nn > wp->w_width) + nn = wp->w_width; screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, wp->w_wincol + n, (int)wp->w_wincol + nn, ' ', ' ', HL_ATTR(HLF_FC)); @@ -2416,8 +2416,8 @@ win_draw_end( int nn = n + 2; /* draw the sign column after the fold column */ - if (nn > W_WIDTH(wp)) - nn = W_WIDTH(wp); + if (nn > wp->w_width) + nn = wp->w_width; screen_fill(W_WINROW(wp) + row, W_WINROW(wp) + endrow, wp->w_wincol + n, (int)wp->w_wincol + nn, ' ', ' ', HL_ATTR(HLF_SC)); @@ -2482,7 +2482,7 @@ text_to_screenline(win_T *wp, char_u *text, int col) { cells = (*mb_ptr2cells)(p); c_len = (*mb_ptr2len)(p); - if (col + cells > W_WIDTH(wp) + if (col + cells > wp->w_width # ifdef FEAT_RIGHTLEFT - (wp->w_p_rl ? col : 0) # endif @@ -2566,8 +2566,8 @@ text_to_screenline(win_T *wp, char_u *text, int col) { int len = (int)STRLEN(text); - if (len > W_WIDTH(wp) - col) - len = W_WIDTH(wp) - col; + if (len > wp->w_width - col) + len = wp->w_width - col; if (len > 0) { #ifdef FEAT_RIGHTLEFT @@ -2593,7 +2593,7 @@ compute_foldcolumn(win_T *wp, int col) { int fdc = wp->w_p_fdc; int wmw = wp == curwin && p_wmw == 0 ? 1 : p_wmw; - int wwidth = W_WIDTH(wp); + int wwidth = wp->w_width; if (fdc > wwidth - (col + wmw)) fdc = wwidth - (col + wmw); @@ -2662,11 +2662,11 @@ fold_line( { int i; - copy_text_attr(off + W_WIDTH(wp) - fdc - col, buf, fdc, + copy_text_attr(off + wp->w_width - fdc - col, buf, fdc, HL_ATTR(HLF_FC)); /* reverse the fold column */ for (i = 0; i < fdc; ++i) - ScreenLines[off + W_WIDTH(wp) - i - 1 - col] = buf[i]; + ScreenLines[off + wp->w_width - i - 1 - col] = buf[i]; } else #endif @@ -2677,7 +2677,7 @@ fold_line( #ifdef FEAT_RIGHTLEFT # define RL_MEMSET(p, v, l) if (wp->w_p_rl) \ for (ri = 0; ri < l; ++ri) \ - ScreenAttrs[off + (W_WIDTH(wp) - (p) - (l)) + ri] = v; \ + ScreenAttrs[off + (wp->w_width - (p) - (l)) + ri] = v; \ else \ for (ri = 0; ri < l; ++ri) \ ScreenAttrs[off + (p) + ri] = v @@ -2688,13 +2688,13 @@ fold_line( /* Set all attributes of the 'number' or 'relativenumber' column and the * text */ - RL_MEMSET(col, HL_ATTR(HLF_FL), W_WIDTH(wp) - col); + RL_MEMSET(col, HL_ATTR(HLF_FL), wp->w_width - col); #ifdef FEAT_SIGNS /* If signs are being displayed, add two spaces. */ if (signcolumn_on(wp)) { - len = W_WIDTH(wp) - col; + len = wp->w_width - col; if (len > 0) { if (len > 2) @@ -2702,7 +2702,7 @@ fold_line( # ifdef FEAT_RIGHTLEFT if (wp->w_p_rl) /* the line number isn't reversed */ - copy_text_attr(off + W_WIDTH(wp) - len - col, + copy_text_attr(off + wp->w_width - len - col, (char_u *)" ", len, HL_ATTR(HLF_FL)); else # endif @@ -2717,7 +2717,7 @@ fold_line( */ if (wp->w_p_nu || wp->w_p_rnu) { - len = W_WIDTH(wp) - col; + len = wp->w_width - col; if (len > 0) { int w = number_width(wp); @@ -2747,7 +2747,7 @@ fold_line( #ifdef FEAT_RIGHTLEFT if (wp->w_p_rl) /* the line number isn't reversed */ - copy_text_attr(off + W_WIDTH(wp) - len - col, buf, len, + copy_text_attr(off + wp->w_width - len - col, buf, len, HL_ATTR(HLF_FL)); else #endif @@ -2775,7 +2775,7 @@ fold_line( if (wp->w_p_rl) col -= txtcol; #endif - while (col < W_WIDTH(wp) + while (col < wp->w_width #ifdef FEAT_RIGHTLEFT - (wp->w_p_rl ? txtcol : 0) #endif @@ -2837,14 +2837,14 @@ fold_line( if (VIsual_mode == Ctrl_V) { /* Visual block mode: highlight the chars part of the block */ - if (wp->w_old_cursor_fcol + txtcol < (colnr_T)W_WIDTH(wp)) + if (wp->w_old_cursor_fcol + txtcol < (colnr_T)wp->w_width) { if (wp->w_old_cursor_lcol != MAXCOL && wp->w_old_cursor_lcol + txtcol - < (colnr_T)W_WIDTH(wp)) + < (colnr_T)wp->w_width) len = wp->w_old_cursor_lcol; else - len = W_WIDTH(wp) - txtcol; + len = wp->w_width - txtcol; RL_MEMSET(wp->w_old_cursor_fcol + txtcol, HL_ATTR(HLF_V), len - (int)wp->w_old_cursor_fcol); } @@ -2852,7 +2852,7 @@ fold_line( else { /* Set all attributes of the text */ - RL_MEMSET(txtcol, HL_ATTR(HLF_V), W_WIDTH(wp) - txtcol); + RL_MEMSET(txtcol, HL_ATTR(HLF_V), wp->w_width - txtcol); } } } @@ -2872,7 +2872,7 @@ fold_line( txtcol -= wp->w_skipcol; else txtcol -= wp->w_leftcol; - if (txtcol >= 0 && txtcol < W_WIDTH(wp)) + if (txtcol >= 0 && txtcol < wp->w_width) ScreenAttrs[off + txtcol] = hl_combine_attr( ScreenAttrs[off + txtcol], HL_ATTR(HLF_MC)); txtcol = old_txtcol; @@ -2888,14 +2888,14 @@ fold_line( txtcol -= wp->w_skipcol; else txtcol -= wp->w_leftcol; - if (txtcol >= 0 && txtcol < W_WIDTH(wp)) + if (txtcol >= 0 && txtcol < wp->w_width) ScreenAttrs[off + txtcol] = hl_combine_attr( ScreenAttrs[off + txtcol], HL_ATTR(HLF_CUC)); } #endif - screen_line(row + W_WINROW(wp), wp->w_wincol, (int)W_WIDTH(wp), - (int)W_WIDTH(wp), FALSE); + screen_line(row + W_WINROW(wp), wp->w_wincol, (int)wp->w_width, + (int)wp->w_width, FALSE); /* * Update w_cline_height and w_cline_folded if the cursor line was @@ -3724,7 +3724,7 @@ win_line( /* Rightleft window: process the text in the normal direction, but put * it in current_ScreenLine[] from right to left. Start at the * rightmost column of the window. */ - col = W_WIDTH(wp) - 1; + col = wp->w_width - 1; off += col; } #endif @@ -3963,7 +3963,7 @@ win_line( n_extra = col + 1; else # endif - n_extra = W_WIDTH(wp) - col; + n_extra = wp->w_width - col; char_attr = HL_ATTR(HLF_DED); } # endif @@ -4016,7 +4016,7 @@ win_line( #endif ) { - screen_line(screen_row, wp->w_wincol, col, -(int)W_WIDTH(wp), + screen_line(screen_row, wp->w_wincol, col, -(int)wp->w_width, HAS_RIGHTLEFT(wp->w_p_rl)); /* Pretend we have finished updating the window. Except when * 'cursorcolumn' is set. */ @@ -4285,7 +4285,7 @@ win_line( # ifdef FEAT_RIGHTLEFT wp->w_p_rl ? (col <= 0) : # endif - (col >= W_WIDTH(wp) - 1)) + (col >= wp->w_width - 1)) && (*mb_char2cells)(mb_c) == 2) { c = '>'; @@ -4486,7 +4486,7 @@ win_line( # ifdef FEAT_RIGHTLEFT wp->w_p_rl ? (col <= 0) : # endif - (col >= W_WIDTH(wp) - 1)) + (col >= wp->w_width - 1)) && (*mb_char2cells)(mb_c) == 2) { c = '>'; @@ -4703,7 +4703,7 @@ win_line( /* TODO: is passing p for start of the line OK? */ n_extra = win_lbr_chartabsize(wp, line, p, (colnr_T)vcol, NULL) - 1; - if (c == TAB && n_extra + col > W_WIDTH(wp)) + if (c == TAB && n_extra + col > wp->w_width) n_extra = (int)wp->w_buffer->b_p_ts - vcol % (int)wp->w_buffer->b_p_ts - 1; @@ -4920,7 +4920,7 @@ win_line( # ifdef FEAT_RIGHTLEFT wp->w_p_rl ? (col >= 0) : # endif - (col < W_WIDTH(wp))) + (col < wp->w_width)) && !(noinvcur && lnum == wp->w_cursor.lnum && (colnr_T)vcol == wp->w_virtcol))) @@ -5031,7 +5031,7 @@ win_line( # ifdef FEAT_RIGHTLEFT wp->w_p_rl ? (col >= 0) : # endif - (col < W_WIDTH(wp)))) + (col < wp->w_width))) { c = ' '; --ptr; /* put it back at the NUL */ @@ -5054,7 +5054,7 @@ win_line( # ifdef FEAT_CONCEAL - boguscols # endif - < W_WIDTH(wp)))) + < wp->w_width))) { /* Highlight until the right side of the window */ c = ' '; @@ -5175,7 +5175,7 @@ win_line( { # ifdef FEAT_RIGHTLEFT if (wp->w_p_rl) - wp->w_wcol = W_WIDTH(wp) - col + boguscols - 1; + wp->w_wcol = wp->w_width - col + boguscols - 1; else # endif wp->w_wcol = col - boguscols; @@ -5338,7 +5338,7 @@ win_line( else #endif { - if (col >= W_WIDTH(wp)) + if (col >= wp->w_width) n = -1; } if (n != 0) @@ -5442,7 +5442,7 @@ win_line( if (((wp->w_p_cuc && (int)wp->w_virtcol >= VCOL_HLC - eol_hl_off && (int)wp->w_virtcol < - W_WIDTH(wp) * (row - startrow + 1) + v + wp->w_width * (row - startrow + 1) + v && lnum != wp->w_cursor.lnum) || draw_color_col) # ifdef FEAT_RIGHTLEFT @@ -5461,7 +5461,7 @@ win_line( if (rightmost_vcol < color_cols[i]) rightmost_vcol = color_cols[i]; - while (col < W_WIDTH(wp)) + while (col < wp->w_width) { ScreenLines[off] = ' '; #ifdef FEAT_MBYTE @@ -5489,7 +5489,7 @@ win_line( #endif screen_line(screen_row, wp->w_wincol, col, - (int)W_WIDTH(wp), HAS_RIGHTLEFT(wp->w_p_rl)); + (int)wp->w_width, HAS_RIGHTLEFT(wp->w_p_rl)); row++; /* @@ -5519,7 +5519,7 @@ win_line( #ifdef FEAT_RIGHTLEFT wp->w_p_rl ? col == 0 : #endif - col == W_WIDTH(wp) - 1) + col == wp->w_width - 1) && (*ptr != NUL || (wp->w_p_list && lcs_eol_one > 0) || (n_extra && (c_extra != NUL || *p_extra != NUL)))) @@ -5784,7 +5784,7 @@ win_line( #ifdef FEAT_RIGHTLEFT wp->w_p_rl ? (col < 0) : #endif - (col >= W_WIDTH(wp))) + (col >= wp->w_width)) && (*ptr != NUL #ifdef FEAT_DIFF || filler_todo > 0 @@ -5795,11 +5795,11 @@ win_line( { #ifdef FEAT_CONCEAL screen_line(screen_row, wp->w_wincol, col - boguscols, - (int)W_WIDTH(wp), HAS_RIGHTLEFT(wp->w_p_rl)); + (int)wp->w_width, HAS_RIGHTLEFT(wp->w_p_rl)); boguscols = 0; #else screen_line(screen_row, wp->w_wincol, col, - (int)W_WIDTH(wp), HAS_RIGHTLEFT(wp->w_p_rl)); + (int)wp->w_width, HAS_RIGHTLEFT(wp->w_p_rl)); #endif ++row; ++screen_row; @@ -5836,7 +5836,7 @@ win_line( #ifdef FEAT_DIFF && filler_todo <= 0 #endif - && W_WIDTH(wp) == Columns) + && wp->w_width == Columns) { /* Remember that the line wraps, used for modeless copy. */ LineWraps[screen_row - 1] = TRUE; @@ -5873,7 +5873,7 @@ win_line( * then output the same character again to let the * terminal know about the wrap. If the terminal doesn't * auto-wrap, we overwrite the character. */ - if (screen_cur_col != W_WIDTH(wp)) + if (screen_cur_col != wp->w_width) screen_char(LineOffset[screen_row - 1] + (unsigned)Columns - 1, screen_row - 1, (int)(Columns - 1)); @@ -5899,7 +5899,7 @@ win_line( #ifdef FEAT_RIGHTLEFT if (wp->w_p_rl) { - col = W_WIDTH(wp) - 1; /* col is not used if breaking! */ + col = wp->w_width - 1; /* col is not used if breaking! */ off += col; } #endif @@ -6890,9 +6890,9 @@ win_redr_status(win_T *wp) len += (int)STRLEN(p + len); } - this_ru_col = ru_col - (Columns - W_WIDTH(wp)); - if (this_ru_col < (W_WIDTH(wp) + 1) / 2) - this_ru_col = (W_WIDTH(wp) + 1) / 2; + this_ru_col = ru_col - (Columns - wp->w_width); + if (this_ru_col < (wp->w_width + 1) / 2) + this_ru_col = (wp->w_width + 1) / 2; if (this_ru_col <= 1) { p = (char_u *)"<"; /* No room for file name! */ @@ -7123,7 +7123,7 @@ win_redr_custom( { row = W_WINROW(wp) + wp->w_height; fillchar = fillchar_status(&attr, wp); - maxwidth = W_WIDTH(wp); + maxwidth = wp->w_width; if (draw_ruler) { @@ -7139,10 +7139,10 @@ win_redr_custom( if (*stl++ != '(') stl = p_ruf; } - col = ru_col - (Columns - W_WIDTH(wp)); - if (col < (W_WIDTH(wp) + 1) / 2) - col = (W_WIDTH(wp) + 1) / 2; - maxwidth = W_WIDTH(wp) - col; + col = ru_col - (Columns - wp->w_width); + if (col < (wp->w_width + 1) / 2) + col = (wp->w_width + 1) / 2; + maxwidth = wp->w_width - col; if (!wp->w_status_height) { row = Rows - 1; @@ -9422,7 +9422,7 @@ setcursor(void) #ifdef FEAT_RIGHTLEFT /* With 'rightleft' set and the cursor on a double-wide * character, position it on the leftmost column. */ - curwin->w_p_rl ? ((int)W_WIDTH(curwin) - curwin->w_wcol - ( + curwin->w_p_rl ? ((int)curwin->w_width - curwin->w_wcol - ( # ifdef FEAT_MBYTE (has_mbyte && (*mb_ptr2cells)(ml_get_cursor()) == 2 @@ -9628,7 +9628,7 @@ win_do_lines( * a character in the lower right corner of the scroll region may cause a * scroll-up . */ - if (scroll_region || W_WIDTH(wp) != Columns) + if (scroll_region || wp->w_width != Columns) { if (scroll_region && (wp->w_width == Columns || *T_CSV != NUL)) scroll_region_set(wp, row); @@ -10729,21 +10729,21 @@ redraw_win_toolbar(win_T *wp) /* TODO: use fewer spaces if there is not enough room */ for (menu = wp->w_winbar->children; - menu != NULL && col < W_WIDTH(wp); menu = menu->next) + menu != NULL && col < wp->w_width; menu = menu->next) { space_to_screenline(off + col, fill_attr); - if (++col >= W_WIDTH(wp)) + if (++col >= wp->w_width) break; if (col > 1) { space_to_screenline(off + col, fill_attr); - if (++col >= W_WIDTH(wp)) + if (++col >= wp->w_width) break; } wp->w_winbar_items[item_idx].wb_startcol = col; space_to_screenline(off + col, button_attr); - if (++col >= W_WIDTH(wp)) + if (++col >= wp->w_width) break; next_col = text_to_screenline(wp, menu->name, col); @@ -10756,20 +10756,20 @@ redraw_win_toolbar(win_T *wp) wp->w_winbar_items[item_idx].wb_menu = menu; ++item_idx; - if (col >= W_WIDTH(wp)) + if (col >= wp->w_width) break; space_to_screenline(off + col, button_attr); ++col; } - while (col < W_WIDTH(wp)) + while (col < wp->w_width) { space_to_screenline(off + col, fill_attr); ++col; } wp->w_winbar_items[item_idx].wb_menu = NULL; /* end marker */ - screen_line(wp->w_winrow, wp->w_wincol, (int)W_WIDTH(wp), - (int)W_WIDTH(wp), FALSE); + screen_line(wp->w_winrow, wp->w_wincol, (int)wp->w_width, + (int)wp->w_width, FALSE); } #endif /* @@ -10901,7 +10901,7 @@ win_redr_ruler(win_T *wp, int always) row = W_WINROW(wp) + wp->w_height; fillchar = fillchar_status(&attr, wp); off = wp->w_wincol; - width = W_WIDTH(wp); + width = wp->w_width; } else { diff --git a/src/search.c b/src/search.c index 39e353c376..15d9b81f77 100644 --- a/src/search.c +++ b/src/search.c @@ -2608,7 +2608,7 @@ showmatch( if (!curwin->w_p_wrap) getvcol(curwin, lpos, NULL, &vcol, NULL); if (curwin->w_p_wrap || (vcol >= curwin->w_leftcol - && vcol < curwin->w_leftcol + W_WIDTH(curwin))) + && vcol < curwin->w_leftcol + curwin->w_width)) { mpos = *lpos; /* save the pos, update_screen() may change it */ save_cursor = curwin->w_cursor; diff --git a/src/structs.h b/src/structs.h index 768ff586bd..4582dca95b 100644 --- a/src/structs.h +++ b/src/structs.h @@ -2701,8 +2701,7 @@ struct window_S status/command/winbar line(s) */ int w_status_height; /* number of status lines (0 or 1) */ int w_wincol; /* Leftmost column of window in screen. */ - int w_width; /* Width of window, excluding separation. - use W_WIDTH() */ + int w_width; /* Width of window, excluding separation. */ int w_vsep_width; /* Number of separator columns (0 or 1). use W_VSEP_WIDTH() */ /* diff --git a/src/ui.c b/src/ui.c index 64553b1fed..867b8a5017 100644 --- a/src/ui.c +++ b/src/ui.c @@ -2739,7 +2739,7 @@ retnomove: #ifdef FEAT_FOLDING && ( # ifdef FEAT_RIGHTLEFT - wp->w_p_rl ? col < W_WIDTH(wp) - wp->w_p_fdc : + wp->w_p_rl ? col < wp->w_width - wp->w_p_fdc : # endif col >= wp->w_p_fdc # ifdef FEAT_CMDWIN @@ -2945,7 +2945,7 @@ retnomove: /* Check for position outside of the fold column. */ if ( # ifdef FEAT_RIGHTLEFT - curwin->w_p_rl ? col < W_WIDTH(curwin) - curwin->w_p_fdc : + curwin->w_p_rl ? col < curwin->w_width - curwin->w_p_fdc : # endif col >= curwin->w_p_fdc # ifdef FEAT_CMDWIN @@ -3020,7 +3020,7 @@ mouse_comp_pos( #ifdef FEAT_RIGHTLEFT if (win->w_p_rl) - col = W_WIDTH(win) - 1 - col; + col = win->w_width - 1 - col; #endif lnum = win->w_topline; @@ -3064,7 +3064,7 @@ mouse_comp_pos( off = win_col_off(win) - win_col_off2(win); if (col < off) col = off; - col += row * (W_WIDTH(win) - off); + col += row * (win->w_width - off); /* add skip column (for long wrapping line) */ col += win->w_skipcol; } diff --git a/src/version.c b/src/version.c index 6facb341dc..5d57a353cd 100644 --- a/src/version.c +++ b/src/version.c @@ -761,6 +761,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1136, /**/ 1135, /**/ diff --git a/src/vim.h b/src/vim.h index 8153ef834e..1c91b7dd66 100644 --- a/src/vim.h +++ b/src/vim.h @@ -859,7 +859,6 @@ extern int (*dyn_libintl_putenv)(const char *envstring); #define FINDFILE_DIR 1 /* only directories */ #define FINDFILE_BOTH 2 /* files and directories */ -#define W_WIDTH(wp) (wp->w_width) #define W_ENDCOL(wp) (wp->w_wincol + wp->w_width) #define W_VSEP_WIDTH(wp) (wp->w_vsep_width) #define W_STATUS_HEIGHT(wp) (wp->w_status_height) diff --git a/src/window.c b/src/window.c index ca56d9cc7d..a290807a0c 100644 --- a/src/window.c +++ b/src/window.c @@ -5777,13 +5777,13 @@ scroll_to_fraction(win_T *wp, int prev_height) */ wp->w_wrow = line_size; if (wp->w_wrow >= wp->w_height - && (W_WIDTH(wp) - win_col_off(wp)) > 0) + && (wp->w_width - win_col_off(wp)) > 0) { - wp->w_skipcol += W_WIDTH(wp) - win_col_off(wp); + wp->w_skipcol += wp->w_width - win_col_off(wp); --wp->w_wrow; while (wp->w_wrow >= wp->w_height) { - wp->w_skipcol += W_WIDTH(wp) - win_col_off(wp) + wp->w_skipcol += wp->w_width - win_col_off(wp) + win_col_off2(wp); --wp->w_wrow; } From e745d75c3e0d976e73bd17c395e9cce98f671692 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Fri, 22 Sep 2017 16:56:22 +0200 Subject: [PATCH 06/12] patch 8.0.1137: cannot build with Ruby Problem: Cannot build with Ruby. Solution: Fix misplaced brace. --- src/if_ruby.c | 2 +- src/version.c | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/if_ruby.c b/src/if_ruby.c index 9474e7c8a6..c1b42e6755 100644 --- a/src/if_ruby.c +++ b/src/if_ruby.c @@ -1470,7 +1470,7 @@ static VALUE window_set_height(VALUE self, VALUE height) static VALUE window_width(VALUE self UNUSED) { - return INT2NUM(get_win(self->w_width)); + return INT2NUM(get_win(self)->w_width); } static VALUE window_set_width(VALUE self UNUSED, VALUE width) diff --git a/src/version.c b/src/version.c index 5d57a353cd..abb9300d78 100644 --- a/src/version.c +++ b/src/version.c @@ -761,6 +761,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1137, /**/ 1136, /**/ From eb163d73b11c10b461a2839530173a33d7915a33 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 23 Sep 2017 15:08:17 +0200 Subject: [PATCH 07/12] patch 8.0.1138: click in window toolbar starts Visual mode Problem: Click in window toolbar starts Visual mode. Solution: Add the MOUSE_WINBAR flag. --- src/normal.c | 6 ++++++ src/ui.c | 14 +++++++++++++- src/version.c | 2 ++ src/vim.h | 1 + 4 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/normal.c b/src/normal.c index d2d1a29215..d78a53bae2 100644 --- a/src/normal.c +++ b/src/normal.c @@ -2794,6 +2794,12 @@ do_mouse( */ jump_flags = jump_to_mouse(jump_flags, oap == NULL ? NULL : &(oap->inclusive), which_button); + +#ifdef FEAT_MENU + /* A click in the window toolbar has no side effects. */ + if (jump_flags & MOUSE_WINBAR) + return FALSE; +#endif moved = (jump_flags & CURSOR_MOVED); in_status_line = (jump_flags & IN_STATUS_LINE); in_sep_line = (jump_flags & IN_SEP_LINE); diff --git a/src/ui.c b/src/ui.c index 867b8a5017..f175e1abff 100644 --- a/src/ui.c +++ b/src/ui.c @@ -2611,6 +2611,9 @@ jump_to_mouse( { static int on_status_line = 0; /* #lines below bottom of window */ static int on_sep_line = 0; /* on separator right of window */ +#ifdef FEAT_MENU + static int in_winbar = FALSE; +#endif static int prev_row = -1; static int prev_col = -1; static win_T *dragwin = NULL; /* window being dragged */ @@ -2699,8 +2702,10 @@ retnomove: /* A click in the window toolbar does not enter another window or * change Visual highlighting. */ winbar_click(wp, col); - return IN_OTHER_WIN; + in_winbar = TRUE; + return IN_OTHER_WIN | MOUSE_WINBAR; } + in_winbar = FALSE; #endif /* @@ -2829,6 +2834,13 @@ retnomove: } return IN_SEP_LINE; /* Cursor didn't move */ } +#ifdef FEAT_MENU + else if (in_winbar) + { + /* After a click on the window toolbar don't start Visual mode. */ + return IN_OTHER_WIN | MOUSE_WINBAR; + } +#endif else /* keep_window_focus must be TRUE */ { /* before moving the cursor for a left click, stop Visual mode */ diff --git a/src/version.c b/src/version.c index abb9300d78..a2f71a3d9b 100644 --- a/src/version.c +++ b/src/version.c @@ -761,6 +761,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1138, /**/ 1137, /**/ diff --git a/src/vim.h b/src/vim.h index 1c91b7dd66..43dbd8c4ab 100644 --- a/src/vim.h +++ b/src/vim.h @@ -1898,6 +1898,7 @@ typedef int sock_T; # define CURSOR_MOVED 0x100 # define MOUSE_FOLD_CLOSE 0x200 /* clicked on '-' in fold column */ # define MOUSE_FOLD_OPEN 0x400 /* clicked on '+' in fold column */ +# define MOUSE_WINBAR 0x800 /* in window toolbar */ /* flags for jump_to_mouse() */ # define MOUSE_FOCUS 0x01 /* need to stay in this window */ From a21a6a9ade7bec3a07992d4d900d4ce82eeb8a29 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 23 Sep 2017 16:33:50 +0200 Subject: [PATCH 08/12] patch 8.0.1139: using window toolbar changes state Problem: Using window toolbar changes state. Solution: Always execute window toolbar actions in Normal mode. --- src/ex_docmd.c | 86 ++++++++++++++++++++++++++---------------- src/menu.c | 29 ++++++++++++-- src/proto/ex_docmd.pro | 2 + src/structs.h | 13 +++++++ src/version.c | 2 + 5 files changed, 95 insertions(+), 37 deletions(-) diff --git a/src/ex_docmd.c b/src/ex_docmd.c index 29435c2ea8..c740d037f5 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -10106,20 +10106,62 @@ update_topline_cursor(void) update_curswant(); } +/* + * Save the current State and go to Normal mode. + * Return TRUE if the typeahead could be saved. + */ + int +save_current_state(save_state_T *sst) +{ + sst->save_msg_scroll = msg_scroll; + sst->save_restart_edit = restart_edit; + sst->save_msg_didout = msg_didout; + sst->save_State = State; + sst->save_insertmode = p_im; + sst->save_finish_op = finish_op; + sst->save_opcount = opcount; + + msg_scroll = FALSE; /* no msg scrolling in Normal mode */ + restart_edit = 0; /* don't go to Insert mode */ + p_im = FALSE; /* don't use 'insertmode' */ + + /* + * Save the current typeahead. This is required to allow using ":normal" + * from an event handler and makes sure we don't hang when the argument + * ends with half a command. + */ + save_typeahead(&sst->tabuf); + return sst->tabuf.typebuf_valid; +} + + void +restore_current_state(save_state_T *sst) +{ + /* Restore the previous typeahead. */ + restore_typeahead(&sst->tabuf); + + msg_scroll = sst->save_msg_scroll; + restart_edit = sst->save_restart_edit; + p_im = sst->save_insertmode; + finish_op = sst->save_finish_op; + opcount = sst->save_opcount; + msg_didout |= sst->save_msg_didout; /* don't reset msg_didout now */ + + /* Restore the state (needed when called from a function executed for + * 'indentexpr'). Update the mouse and cursor, they may have changed. */ + State = sst->save_State; +#ifdef CURSOR_SHAPE + ui_cursor_shape(); /* may show different cursor shape */ +#endif +} + /* * ":normal[!] {commands}": Execute normal mode commands. */ void ex_normal(exarg_T *eap) { - int save_msg_scroll = msg_scroll; - int save_restart_edit = restart_edit; - int save_msg_didout = msg_didout; - int save_State = State; - tasave_T tabuf; - int save_insertmode = p_im; - int save_finish_op = finish_op; - int save_opcount = opcount; + save_state_T save_state; #ifdef FEAT_MBYTE char_u *arg = NULL; int l; @@ -10136,11 +10178,6 @@ ex_normal(exarg_T *eap) EMSG(_("E192: Recursive use of :normal too deep")); return; } - ++ex_normal_busy; - - msg_scroll = FALSE; /* no msg scrolling in Normal mode */ - restart_edit = 0; /* don't go to Insert mode */ - p_im = FALSE; /* don't use 'insertmode' */ #ifdef FEAT_MBYTE /* @@ -10206,13 +10243,8 @@ ex_normal(exarg_T *eap) } #endif - /* - * Save the current typeahead. This is required to allow using ":normal" - * from an event handler and makes sure we don't hang when the argument - * ends with half a command. - */ - save_typeahead(&tabuf); - if (tabuf.typebuf_valid) + ++ex_normal_busy; + if (save_current_state(&save_state)) { /* * Repeat the :normal command for each line in the range. When no @@ -10240,20 +10272,8 @@ ex_normal(exarg_T *eap) /* Might not return to the main loop when in an event handler. */ update_topline_cursor(); - /* Restore the previous typeahead. */ - restore_typeahead(&tabuf); - + restore_current_state(&save_state); --ex_normal_busy; - msg_scroll = save_msg_scroll; - restart_edit = save_restart_edit; - p_im = save_insertmode; - finish_op = save_finish_op; - opcount = save_opcount; - msg_didout |= save_msg_didout; /* don't reset msg_didout now */ - - /* Restore the state (needed when called from a function executed for - * 'indentexpr'). Update the mouse and cursor, they may have changed. */ - State = save_State; #ifdef FEAT_MOUSE setmouse(); #endif diff --git a/src/menu.c b/src/menu.c index 1ad8a5cb90..f07be97e74 100644 --- a/src/menu.c +++ b/src/menu.c @@ -2242,7 +2242,7 @@ gui_destroy_tearoffs_recurse(vimmenu_T *menu) execute_menu(exarg_T *eap, vimmenu_T *menu) { char_u *mode; - int idx; + int idx = -1; /* Use the Insert mode entry when returning to Insert mode. */ if (restart_edit @@ -2306,7 +2306,9 @@ execute_menu(exarg_T *eap, vimmenu_T *menu) if (*p_sel == 'e' && gchar_cursor() != NUL) ++curwin->w_cursor.col; } - else + + /* For the WinBar menu always use the Normal mode menu. */ + if (idx == -1 || eap == NULL) { mode = (char_u *)"Normal"; idx = MENU_INDEX_NORMAL; @@ -2322,8 +2324,16 @@ execute_menu(exarg_T *eap, vimmenu_T *menu) || current_SID != 0 #endif ) - exec_normal_cmd(menu->strings[idx], menu->noremap[idx], + { + save_state_T save_state; + + ++ex_normal_busy; + if (save_current_state(&save_state)) + exec_normal_cmd(menu->strings[idx], menu->noremap[idx], menu->silent[idx]); + restore_current_state(&save_state); + --ex_normal_busy; + } else ins_typebuf(menu->strings[idx], menu->noremap[idx], 0, TRUE, menu->silent[idx]); @@ -2406,12 +2416,18 @@ winbar_click(win_T *wp, int col) if (col >= item->wb_startcol && col <= item->wb_endcol) { win_T *save_curwin = NULL; + pos_T save_visual = VIsual; + int save_visual_active = VIsual_active; + int save_visual_select = VIsual_select; + int save_visual_reselect = VIsual_reselect; + int save_visual_mode = VIsual_mode; if (wp != curwin) { /* Clicking in the window toolbar of a not-current window. - * Make that window the current one and go to Normal mode. */ + * Make that window the current one and save Visual mode. */ save_curwin = curwin; + VIsual_active = FALSE; curwin = wp; curbuf = curwin->w_buffer; check_cursor(); @@ -2423,6 +2439,11 @@ winbar_click(win_T *wp, int col) { curwin = save_curwin; curbuf = curwin->w_buffer; + VIsual = save_visual; + VIsual_active = save_visual_active; + VIsual_select = save_visual_select; + VIsual_reselect = save_visual_reselect; + VIsual_mode = save_visual_mode; } } } diff --git a/src/proto/ex_docmd.pro b/src/proto/ex_docmd.pro index 116ff4e729..3819531929 100644 --- a/src/proto/ex_docmd.pro +++ b/src/proto/ex_docmd.pro @@ -51,6 +51,8 @@ void ex_redraw(exarg_T *eap); int vim_mkdir_emsg(char_u *name, int prot); FILE *open_exfile(char_u *fname, int forceit, char *mode); void update_topline_cursor(void); +int save_current_state(save_state_T *sst); +void restore_current_state(save_state_T *sst); void ex_normal(exarg_T *eap); void exec_normal_cmd(char_u *cmd, int remap, int silent); void exec_normal(int was_typed); diff --git a/src/structs.h b/src/structs.h index 4582dca95b..946857be5e 100644 --- a/src/structs.h +++ b/src/structs.h @@ -3405,3 +3405,16 @@ typedef struct lval_S dictitem_T *ll_di; /* The dictitem or NULL */ char_u *ll_newkey; /* New key for Dict in alloc. mem or NULL. */ } lval_T; + +/* Structure used to save the current state. Used when executing Normal mode + * commands while in any other mode. */ +typedef struct { + int save_msg_scroll; + int save_restart_edit; + int save_msg_didout; + int save_State; + int save_insertmode; + int save_finish_op; + int save_opcount; + tasave_T tabuf; +} save_state_T; diff --git a/src/version.c b/src/version.c index a2f71a3d9b..3d5716e4c6 100644 --- a/src/version.c +++ b/src/version.c @@ -761,6 +761,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1139, /**/ 1138, /**/ From bb3e6416f157f68799ccb6070fa2f91df6780e79 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 23 Sep 2017 19:24:46 +0200 Subject: [PATCH 09/12] patch 8.0.1140: still old style tests Problem: Still old style tests. Solution: Convert two tests to new style. (Yegappan Lakshmanan) --- src/Makefile | 2 +- src/testdir/Make_all.mak | 2 - src/testdir/Make_vms.mms | 2 +- src/testdir/test56.in | 21 - src/testdir/test56.ok | 2 - src/testdir/test57.in | 545 --------------- src/testdir/test57.ok | 501 -------------- src/testdir/test_sort.vim | 1138 ++++++++++++++++++++++++++++++++ src/testdir/test_vimscript.vim | 20 + src/version.c | 2 + 10 files changed, 1162 insertions(+), 1073 deletions(-) delete mode 100644 src/testdir/test56.in delete mode 100644 src/testdir/test56.ok delete mode 100644 src/testdir/test57.in delete mode 100644 src/testdir/test57.ok diff --git a/src/Makefile b/src/Makefile index ad96784a6d..cecef8d442 100644 --- a/src/Makefile +++ b/src/Makefile @@ -2105,7 +2105,7 @@ test1 \ test20 test25 test28 test29 \ test30 test31 test32 test33 test34 test36 test37 test38 test39 \ test40 test41 test42 test43 test44 test45 test48 test49 \ - test50 test52 test53 test54 test55 test56 test57 test59 \ + test50 test52 test53 test54 test55 test59 \ test60 test64 test66 test68 test69 \ test70 test72 test73 test77 test78 test79 \ test83 test85 test86 test87 test88 \ diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak index 169d84fd5d..fe6aa5235e 100644 --- a/src/testdir/Make_all.mak +++ b/src/testdir/Make_all.mak @@ -40,8 +40,6 @@ SCRIPTS_ALL = \ test48.out \ test53.out \ test55.out \ - test56.out \ - test57.out \ test60.out \ test64.out \ test66.out \ diff --git a/src/testdir/Make_vms.mms b/src/testdir/Make_vms.mms index e48789b6f2..e4373965ef 100644 --- a/src/testdir/Make_vms.mms +++ b/src/testdir/Make_vms.mms @@ -82,7 +82,7 @@ SCRIPT = test1.out test3.out test4.out test5.out \ test38.out test39.out test40.out test41.out test42.out \ test43.out test44.out test45.out \ test48.out test49.out test53.out test54.out \ - test55.out test56.out test57.out test60.out \ + test55.out test60.out \ test64.out \ test66.out test68.out test69.out \ test72.out \ diff --git a/src/testdir/test56.in b/src/testdir/test56.in deleted file mode 100644 index 311a6004ca..0000000000 --- a/src/testdir/test56.in +++ /dev/null @@ -1,21 +0,0 @@ -Test for script-local function. vim: set ft=vim : - -STARTTEST -:so small.vim -:" -:set nocp viminfo+=nviminfo -:/^start:/+1,/^end:/-1w! Xtest.vim -:source Xtest.vim -_x -:$-1,$wq! test.out -ENDTEST - -start: -fun DoLast() - call append(line('$'), "last line") -endfun -fun s:DoNothing() - call append(line('$'), "nothing line") -endfun -nnoremap _x :call DoNothing()call DoLast()delfunc DoNothingdelfunc DoLast -end: diff --git a/src/testdir/test56.ok b/src/testdir/test56.ok deleted file mode 100644 index f2b0d33c8b..0000000000 --- a/src/testdir/test56.ok +++ /dev/null @@ -1,2 +0,0 @@ -nothing line -last line diff --git a/src/testdir/test57.in b/src/testdir/test57.in deleted file mode 100644 index 5f235358b8..0000000000 --- a/src/testdir/test57.in +++ /dev/null @@ -1,545 +0,0 @@ -Tests for :sort command. vim: set ft=vim : - -STARTTEST -:so small.vim -:" -:/^t01:/+1,/^t02/-1sort -:/^t02:/+1,/^t03/-1sort n -:/^t03:/+1,/^t04/-1sort x -:/^t04:/+1,/^t05/-1sort u -:/^t05:/+1,/^t06/-1sort! -:/^t06:/+1,/^t07/-1sort! n -:/^t07:/+1,/^t08/-1sort! u -:/^t08:/+1,/^t09/-1sort o -:/^t09:/+1,/^t10/-1sort! x -:/^t10:/+1,/^t11/-1sort/./ -:/^t11:/+1,/^t12/-1sort/../ -:/^t12:/+1,/^t13/-1sort/../u -:/^t13:/+1,/^t14/-1sort/./n -:/^t14:/+1,/^t15/-1sort/./r -:/^t15:/+1,/^t16/-1sort/../r -:/^t16:/+1,/^t17/-1sort/./rn -:/^t17:/+1,/^t18/-1sort/\d/ -:/^t18:/+1,/^t19/-1sort/\d/r -:/^t19:/+1,/^t20/-1sort/\d/n -:/^t20:/+1,/^t21/-1sort/\d/rn -:/^t21:/+1,/^t22/-1sort/\d\d/ -:/^t22:/+1,/^t23/-1sort/\d\d/n -:/^t23:/+1,/^t24/-1sort/\d\d/x -:/^t24:/+1,/^t25/-1sort/\d\d/r -:/^t25:/+1,/^t26/-1sort/\d\d/rn -:/^t26:/+1,/^t27/-1sort/\d\d/rx -:/^t27:/+1,/^t28/-1sort no -:/^t28:/+1,/^t29/-1sort b -:/^t29:/+1,/^t30/-1sort b -:/^t30:/+1,/^t31/-1sort f -:/^t01:/,$wq! test.out -ENDTEST - -t01: alphebetical -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t02: numeric -abc -ab -a321 -a123 -a122 -a -x-22 -b321 -b123 - -c123d --24 - 123b -c321d -0 -b322b -b321 -b321b - - -t03: hexadecimal -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t04: alpha, unique -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t05: alpha, reverse -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t06: numeric, reverse -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t07: unique, reverse -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t08: octal -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t09: reverse, hexadecimal -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t10: alpha, skip first character -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t11: alpha, skip first 2 characters -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t12: alpha, unique, skip first 2 characters -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t13: numeric, skip first character -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t14: alpha, sort on first character -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t15: alpha, sort on first 2 characters -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t16: numeric, sort on first character -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t17: alpha, skip past first digit -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t18: alpha, sort on first digit -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t19: numeric, skip past first digit -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t20: numeric, sort on first digit -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t21: alpha, skip past first 2 digits -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t22: numeric, skip past first 2 digits -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t23: hexadecimal, skip past first 2 digits -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t24: alpha, sort on first 2 digits -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t25: numeric, sort on first 2 digits -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t26: hexadecimal, sort on first 2 digits -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t27: wrong arguments -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t28: binary -0b111000 -0b101100 -0b101001 -0b101001 -0b101000 -0b000000 -0b001000 -0b010000 -0b101000 -0b100000 -0b101010 -0b100010 -0b100100 -0b100010 - - -t29: binary with leading characters -0b100010 -0b010000 - 0b101001 -b0b101100 -0b100010 - 0b100100 -a0b001000 -0b101000 -0b101000 -a0b101001 -ab0b100000 -0b101010 -0b000000 -b0b111000 - - -t30: float -1.234 -0.88 -123.456 -1.15e-6 --1.1e3 --1.01e3 - - -t31: done diff --git a/src/testdir/test57.ok b/src/testdir/test57.ok deleted file mode 100644 index 452acf1fc4..0000000000 --- a/src/testdir/test57.ok +++ /dev/null @@ -1,501 +0,0 @@ -t01: alphebetical - - - 123b -a -a122 -a123 -a321 -ab -abc -b123 -b321 -b321 -b321b -b322b -c123d -c321d -t02: numeric -abc -ab -a - - - --24 -x-22 -0 -a122 -a123 -b123 -c123d - 123b -a321 -b321 -c321d -b321 -b321b -b322b -t03: hexadecimal - - -a -ab -abc - 123b -a122 -a123 -a321 -b123 -b321 -b321 -b321b -b322b -c123d -c321d -t04: alpha, unique - - 123b -a -a122 -a123 -a321 -ab -abc -b123 -b321 -b321b -b322b -c123d -c321d -t05: alpha, reverse -c321d -c123d -b322b -b321b -b321 -b321 -b123 -abc -ab -a321 -a123 -a122 -a - 123b - - -t06: numeric, reverse -b322b -b321b -b321 -c321d -b321 -a321 - 123b -c123d -b123 -a123 -a122 - - -a -ab -abc -t07: unique, reverse -c321d -c123d -b322b -b321b -b321 -b123 -abc -ab -a321 -a123 -a122 -a - 123b - -t08: octal -abc -ab -a - - -a122 -a123 -b123 -c123d - 123b -a321 -b321 -c321d -b321 -b321b -b322b -t09: reverse, hexadecimal -c321d -c123d -b322b -b321b -b321 -b321 -b123 -a321 -a123 -a122 - 123b -abc -ab -a - - -t10: alpha, skip first character -a - - -a122 -a123 -b123 - 123b -c123d -a321 -b321 -b321 -b321b -c321d -b322b -ab -abc -t11: alpha, skip first 2 characters -ab -a - - -a321 -b321 -b321 -b321b -c321d -a122 -b322b -a123 -b123 - 123b -c123d -abc -t12: alpha, unique, skip first 2 characters -ab -a - -a321 -b321 -b321b -c321d -a122 -b322b -a123 -b123 - 123b -c123d -abc -t13: numeric, skip first character -abc -ab -a - - -a122 -a123 -b123 -c123d - 123b -a321 -b321 -c321d -b321 -b321b -b322b -t14: alpha, sort on first character - - - 123b -abc -ab -a -a321 -a123 -a122 -b321 -b123 -b322b -b321 -b321b -c123d -c321d -t15: alpha, sort on first 2 characters -a - - - 123b -a123 -a122 -a321 -abc -ab -b123 -b321 -b322b -b321 -b321b -c123d -c321d -t16: numeric, sort on first character -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t17: alpha, skip past first digit -abc -ab -a - - -a321 -b321 -b321 -b321b -c321d -a122 -b322b -a123 -b123 - 123b -c123d -t18: alpha, sort on first digit -abc -ab -a - - -a123 -a122 -b123 -c123d - 123b -a321 -b321 -c321d -b322b -b321 -b321b -t19: numeric, skip past first digit -abc -ab -a - - -a321 -b321 -c321d -b321 -b321b -a122 -b322b -a123 -b123 -c123d - 123b -t20: numeric, sort on first digit -abc -ab -a - - -a123 -a122 -b123 -c123d - 123b -a321 -b321 -c321d -b322b -b321 -b321b -t21: alpha, skip past first 2 digits -abc -ab -a - - -a321 -b321 -b321 -b321b -c321d -a122 -b322b -a123 -b123 - 123b -c123d -t22: numeric, skip past first 2 digits -abc -ab -a - - -a321 -b321 -c321d -b321 -b321b -a122 -b322b -a123 -b123 -c123d - 123b -t23: hexadecimal, skip past first 2 digits -abc -ab -a - - -a321 -b321 -b321 -a122 -a123 -b123 -b321b -c321d -b322b - 123b -c123d -t24: alpha, sort on first 2 digits -abc -ab -a - - -a123 -a122 -b123 -c123d - 123b -a321 -b321 -c321d -b322b -b321 -b321b -t25: numeric, sort on first 2 digits -abc -ab -a - - -a123 -a122 -b123 -c123d - 123b -a321 -b321 -c321d -b322b -b321 -b321b -t26: hexadecimal, sort on first 2 digits -abc -ab -a - - -a123 -a122 -b123 -c123d - 123b -a321 -b321 -c321d -b322b -b321 -b321b -t27: wrong arguments -abc -ab -a -a321 -a123 -a122 -b321 -b123 -c123d - 123b -c321d -b322b -b321 -b321b - - -t28: binary - - -0b000000 -0b001000 -0b010000 -0b100000 -0b100010 -0b100010 -0b100100 -0b101000 -0b101000 -0b101001 -0b101001 -0b101010 -0b101100 -0b111000 -t29: binary with leading characters - - -0b000000 -a0b001000 -0b010000 -ab0b100000 -0b100010 -0b100010 - 0b100100 -0b101000 -0b101000 - 0b101001 -a0b101001 -0b101010 -b0b101100 -b0b111000 -t30: float - - --1.1e3 --1.01e3 -1.15e-6 -0.88 -1.234 -123.456 -t31: done diff --git a/src/testdir/test_sort.vim b/src/testdir/test_sort.vim index 25a6cea1bd..4fddb47b58 100644 --- a/src/testdir/test_sort.vim +++ b/src/testdir/test_sort.vim @@ -44,3 +44,1141 @@ func Test_sort_default() call assert_equal(['2', 'A', 'a', 'AA', 1, 3.3], sort([3.3, 1, "2", "A", "a", "AA"], 1)) call assert_fails('call sort([3.3, 1, "2"], 3)', "E474") endfunc + +" Tests for the :sort command +func Test_sort_cmd() + let tests = [ + \ { + \ 'name' : 'Alphabetical sort', + \ 'cmd' : '%sort', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b' + \ ], + \ 'expected' : [ + \ ' 123b', + \ 'a', + \ 'a122', + \ 'a123', + \ 'a321', + \ 'ab', + \ 'abc', + \ 'b123', + \ 'b321', + \ 'b321', + \ 'b321b', + \ 'b322b', + \ 'c123d', + \ 'c321d' + \ ] + \ }, + \ { + \ 'name' : 'Numeric sort', + \ 'cmd' : '%sort n', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'a', + \ 'x-22', + \ 'b321', + \ 'b123', + \ '', + \ 'c123d', + \ '-24', + \ ' 123b', + \ 'c321d', + \ '0', + \ 'b322b', + \ 'b321', + \ 'b321b' + \ ], + \ 'expected' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ '', + \ '-24', + \ 'x-22', + \ '0', + \ 'a122', + \ 'a123', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'a321', + \ 'b321', + \ 'c321d', + \ 'b321', + \ 'b321b', + \ 'b322b' + \ ] + \ }, + \ { + \ 'name' : 'Hexadecimal sort', + \ 'cmd' : '%sort x', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b' + \ ], + \ 'expected' : [ + \ 'a', + \ 'ab', + \ 'abc', + \ ' 123b', + \ 'a122', + \ 'a123', + \ 'a321', + \ 'b123', + \ 'b321', + \ 'b321', + \ 'b321b', + \ 'b322b', + \ 'c123d', + \ 'c321d' + \ ] + \ }, + \ { + \ 'name' : 'Alphabetical unique sort', + \ 'cmd' : '%sort u', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b' + \ ], + \ 'expected' : [ + \ ' 123b', + \ 'a', + \ 'a122', + \ 'a123', + \ 'a321', + \ 'ab', + \ 'abc', + \ 'b123', + \ 'b321', + \ 'b321b', + \ 'b322b', + \ 'c123d', + \ 'c321d' + \ ] + \ }, + \ { + \ 'name' : 'Alphabetical reverse sort', + \ 'cmd' : '%sort!', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b' + \ ], + \ 'expected' : [ + \ 'c321d', + \ 'c123d', + \ 'b322b', + \ 'b321b', + \ 'b321', + \ 'b321', + \ 'b123', + \ 'abc', + \ 'ab', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'a', + \ ' 123b', + \ ] + \ }, + \ { + \ 'name' : 'Numeric reverse sort', + \ 'cmd' : '%sort! n', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b' + \ ], + \ 'expected' : [ + \ 'b322b', + \ 'b321b', + \ 'b321', + \ 'c321d', + \ 'b321', + \ 'a321', + \ ' 123b', + \ 'c123d', + \ 'b123', + \ 'a123', + \ 'a122', + \ 'a', + \ 'ab', + \ 'abc' + \ ] + \ }, + \ { + \ 'name' : 'Unique reverse sort', + \ 'cmd' : 'sort! u', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b' + \ ], + \ 'expected' : [ + \ 'c321d', + \ 'c123d', + \ 'b322b', + \ 'b321b', + \ 'b321', + \ 'b123', + \ 'abc', + \ 'ab', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'a', + \ ' 123b', + \ ] + \ }, + \ { + \ 'name' : 'Octal sort', + \ 'cmd' : 'sort o', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ '', + \ '', + \ 'a122', + \ 'a123', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'a321', + \ 'b321', + \ 'c321d', + \ 'b321', + \ 'b321b', + \ 'b322b' + \ ] + \ }, + \ { + \ 'name' : 'Reverse hexadecimal sort', + \ 'cmd' : 'sort! x', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'c321d', + \ 'c123d', + \ 'b322b', + \ 'b321b', + \ 'b321', + \ 'b321', + \ 'b123', + \ 'a321', + \ 'a123', + \ 'a122', + \ ' 123b', + \ 'abc', + \ 'ab', + \ 'a', + \ '', + \ '' + \ ] + \ }, + \ { + \ 'name' : 'Alpha (skip first character) sort', + \ 'cmd' : 'sort/./', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'a', + \ '', + \ '', + \ 'a122', + \ 'a123', + \ 'b123', + \ ' 123b', + \ 'c123d', + \ 'a321', + \ 'b321', + \ 'b321', + \ 'b321b', + \ 'c321d', + \ 'b322b', + \ 'ab', + \ 'abc' + \ ] + \ }, + \ { + \ 'name' : 'Alpha (skip first 2 characters) sort', + \ 'cmd' : 'sort/../', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'ab', + \ 'a', + \ '', + \ '', + \ 'a321', + \ 'b321', + \ 'b321', + \ 'b321b', + \ 'c321d', + \ 'a122', + \ 'b322b', + \ 'a123', + \ 'b123', + \ ' 123b', + \ 'c123d', + \ 'abc' + \ ] + \ }, + \ { + \ 'name' : 'alpha, unique, skip first 2 characters', + \ 'cmd' : 'sort/../u', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'ab', + \ 'a', + \ '', + \ 'a321', + \ 'b321', + \ 'b321b', + \ 'c321d', + \ 'a122', + \ 'b322b', + \ 'a123', + \ 'b123', + \ ' 123b', + \ 'c123d', + \ 'abc' + \ ] + \ }, + \ { + \ 'name' : 'numeric, skip first character', + \ 'cmd' : 'sort/./n', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ '', + \ '', + \ 'a122', + \ 'a123', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'a321', + \ 'b321', + \ 'c321d', + \ 'b321', + \ 'b321b', + \ 'b322b' + \ ] + \ }, + \ { + \ 'name' : 'alpha, sort on first character', + \ 'cmd' : 'sort/./r', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ '', + \ '', + \ ' 123b', + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ 'c123d', + \ 'c321d' + \ ] + \ }, + \ { + \ 'name' : 'alpha, sort on first 2 characters', + \ 'cmd' : 'sort/../r', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'a', + \ '', + \ '', + \ ' 123b', + \ 'a123', + \ 'a122', + \ 'a321', + \ 'abc', + \ 'ab', + \ 'b123', + \ 'b321', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ 'c123d', + \ 'c321d' + \ ] + \ }, + \ { + \ 'name' : 'numeric, sort on first character', + \ 'cmd' : 'sort/./rn', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ] + \ }, + \ { + \ 'name' : 'alpha, skip past first digit', + \ 'cmd' : 'sort/\d/', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ '', + \ '', + \ 'a321', + \ 'b321', + \ 'b321', + \ 'b321b', + \ 'c321d', + \ 'a122', + \ 'b322b', + \ 'a123', + \ 'b123', + \ ' 123b', + \ 'c123d' + \ ] + \ }, + \ { + \ 'name' : 'alpha, sort on first digit', + \ 'cmd' : 'sort/\d/r', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ '', + \ '', + \ 'a123', + \ 'a122', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'a321', + \ 'b321', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b' + \ ] + \ }, + \ { + \ 'name' : 'numeric, skip past first digit', + \ 'cmd' : 'sort/\d/n', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ '', + \ '', + \ 'a321', + \ 'b321', + \ 'c321d', + \ 'b321', + \ 'b321b', + \ 'a122', + \ 'b322b', + \ 'a123', + \ 'b123', + \ 'c123d', + \ ' 123b' + \ ] + \ }, + \ { + \ 'name' : 'numeric, sort on first digit', + \ 'cmd' : 'sort/\d/rn', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ '', + \ '', + \ 'a123', + \ 'a122', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'a321', + \ 'b321', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b' + \ ] + \ }, + \ { + \ 'name' : 'alpha, skip past first 2 digits', + \ 'cmd' : 'sort/\d\d/', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ '', + \ '', + \ 'a321', + \ 'b321', + \ 'b321', + \ 'b321b', + \ 'c321d', + \ 'a122', + \ 'b322b', + \ 'a123', + \ 'b123', + \ ' 123b', + \ 'c123d' + \ ] + \ }, + \ { + \ 'name' : 'numeric, skip past first 2 digits', + \ 'cmd' : 'sort/\d\d/n', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ '', + \ '', + \ 'a321', + \ 'b321', + \ 'c321d', + \ 'b321', + \ 'b321b', + \ 'a122', + \ 'b322b', + \ 'a123', + \ 'b123', + \ 'c123d', + \ ' 123b' + \ ] + \ }, + \ { + \ 'name' : 'hexadecimal, skip past first 2 digits', + \ 'cmd' : 'sort/\d\d/x', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ '', + \ '', + \ 'a321', + \ 'b321', + \ 'b321', + \ 'a122', + \ 'a123', + \ 'b123', + \ 'b321b', + \ 'c321d', + \ 'b322b', + \ ' 123b', + \ 'c123d' + \ ] + \ }, + \ { + \ 'name' : 'alpha, sort on first 2 digits', + \ 'cmd' : 'sort/\d\d/r', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ '', + \ '', + \ 'a123', + \ 'a122', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'a321', + \ 'b321', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b' + \ ] + \ }, + \ { + \ 'name' : 'numeric, sort on first 2 digits', + \ 'cmd' : 'sort/\d\d/rn', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ '', + \ '', + \ 'a123', + \ 'a122', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'a321', + \ 'b321', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b' + \ ] + \ }, + \ { + \ 'name' : 'hexadecimal, sort on first 2 digits', + \ 'cmd' : 'sort/\d\d/rx', + \ 'input' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ 'a321', + \ 'a123', + \ 'a122', + \ 'b321', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ 'abc', + \ 'ab', + \ 'a', + \ '', + \ '', + \ 'a123', + \ 'a122', + \ 'b123', + \ 'c123d', + \ ' 123b', + \ 'a321', + \ 'b321', + \ 'c321d', + \ 'b322b', + \ 'b321', + \ 'b321b' + \ ] + \ }, + \ { + \ 'name' : 'binary', + \ 'cmd' : 'sort b', + \ 'input' : [ + \ '0b111000', + \ '0b101100', + \ '0b101001', + \ '0b101001', + \ '0b101000', + \ '0b000000', + \ '0b001000', + \ '0b010000', + \ '0b101000', + \ '0b100000', + \ '0b101010', + \ '0b100010', + \ '0b100100', + \ '0b100010', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ '', + \ '', + \ '0b000000', + \ '0b001000', + \ '0b010000', + \ '0b100000', + \ '0b100010', + \ '0b100010', + \ '0b100100', + \ '0b101000', + \ '0b101000', + \ '0b101001', + \ '0b101001', + \ '0b101010', + \ '0b101100', + \ '0b111000' + \ ] + \ }, + \ { + \ 'name' : 'binary with leading characters', + \ 'cmd' : 'sort b', + \ 'input' : [ + \ '0b100010', + \ '0b010000', + \ ' 0b101001', + \ 'b0b101100', + \ '0b100010', + \ ' 0b100100', + \ 'a0b001000', + \ '0b101000', + \ '0b101000', + \ 'a0b101001', + \ 'ab0b100000', + \ '0b101010', + \ '0b000000', + \ 'b0b111000', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ '', + \ '', + \ '0b000000', + \ 'a0b001000', + \ '0b010000', + \ 'ab0b100000', + \ '0b100010', + \ '0b100010', + \ ' 0b100100', + \ '0b101000', + \ '0b101000', + \ ' 0b101001', + \ 'a0b101001', + \ '0b101010', + \ 'b0b101100', + \ 'b0b111000' + \ ] + \ }, + \ { + \ 'name' : 'float', + \ 'cmd' : 'sort f', + \ 'input' : [ + \ '1.234', + \ '0.88', + \ '123.456', + \ '1.15e-6', + \ '-1.1e3', + \ '-1.01e3', + \ '', + \ '' + \ ], + \ 'expected' : [ + \ '', + \ '', + \ '-1.1e3', + \ '-1.01e3', + \ '1.15e-6', + \ '0.88', + \ '1.234', + \ '123.456' + \ ] + \ } + \ ] + + for t in tests + enew! + call append(0, t.input) + $delete _ + exe t.cmd + call assert_equal(t.expected, getline(1, '$'), t.name) + endfor + + call assert_fails('sort no', 'E474') + + enew! +endfunc diff --git a/src/testdir/test_vimscript.vim b/src/testdir/test_vimscript.vim index 29394c990b..d653fa594f 100644 --- a/src/testdir/test_vimscript.vim +++ b/src/testdir/test_vimscript.vim @@ -1421,6 +1421,26 @@ func Test_user_command_with_bang() delcommand Nieuw endfunc +" Test for script-local function +func DoLast() + call append(line('$'), "last line") +endfunc + +func s:DoNothing() + call append(line('$'), "nothing line") +endfunc + +func Test_script_local_func() + set nocp viminfo+=nviminfo + new + nnoremap _x :call DoNothing()call DoLast()delfunc DoNothingdelfunc DoLast + + normal _x + call assert_equal('nothing line', getline(2)) + call assert_equal('last line', getline(3)) + enew! | close +endfunc + "------------------------------------------------------------------------------- " Modelines {{{1 " vim: ts=8 sw=4 tw=80 fdm=marker diff --git a/src/version.c b/src/version.c index 3d5716e4c6..cd09bc24b6 100644 --- a/src/version.c +++ b/src/version.c @@ -761,6 +761,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1140, /**/ 1139, /**/ From 96e7a6ee4569526c71b1e89f641526775831ac63 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 23 Sep 2017 19:48:29 +0200 Subject: [PATCH 10/12] patch 8.0.1141: MS-Windows build dependencies are incomplete Problem: MS-Windows build dependencies are incomplete. Solution: Fix the dependencies. (Ken Takata) --- src/Make_cyg.mak | 2 ++ src/Make_cyg_ming.mak | 47 +++++++++++++++++++++++-------------------- src/Make_ming.mak | 2 ++ src/Make_mvc.mak | 30 +++++++++------------------ src/version.c | 2 ++ 5 files changed, 41 insertions(+), 42 deletions(-) diff --git a/src/Make_cyg.mak b/src/Make_cyg.mak index 828666ce0a..8c1b60e278 100644 --- a/src/Make_cyg.mak +++ b/src/Make_cyg.mak @@ -50,3 +50,5 @@ CROSS_COMPILE = i686-pc-mingw32- # Do not change this. UNDER_CYGWIN = yes include Make_cyg_ming.mak + +# vim: set noet sw=8 ts=8 sts=0 wm=0 tw=0: diff --git a/src/Make_cyg_ming.mak b/src/Make_cyg_ming.mak index 23c0318a62..a855f066e5 100644 --- a/src/Make_cyg_ming.mak +++ b/src/Make_cyg_ming.mak @@ -913,60 +913,58 @@ endif $(MAKE) -C xxd -f Make_ming.mak clean ########################################################################### -INCL = vim.h feature.h os_win32.h os_dos.h ascii.h keymap.h term.h macros.h \ - structs.h regexp.h option.h ex_cmds.h proto.h globals.h farsi.h \ - gui.h +INCL = vim.h alloc.h arabic.h ascii.h ex_cmds.h farsi.h feature.h globals.h \ + keymap.h macros.h option.h os_dos.h os_win32.h proto.h regexp.h \ + spell.h structs.h term.h $(NBDEBUG_INCL) +GUI_INCL = gui.h gui_beval.h CUI_INCL = iscygpty.h -$(OUTDIR)/if_python.o : if_python.c if_py_both.h $(INCL) +$(OUTDIR)/if_python.o: if_python.c if_py_both.h $(INCL) $(CC) -c $(CFLAGS) $(PYTHONINC) $(PYTHON_HOME_DEF) $< -o $@ -$(OUTDIR)/if_python3.o : if_python3.c if_py_both.h $(INCL) +$(OUTDIR)/if_python3.o: if_python3.c if_py_both.h $(INCL) $(CC) -c $(CFLAGS) $(PYTHON3INC) $(PYTHON3_HOME_DEF) $< -o $@ $(OUTDIR)/%.o : %.c $(INCL) $(CC) -c $(CFLAGS) $< -o $@ -$(OUTDIR)/vimrc.o: vim.rc version.h gui_w32_rc.h +$(OUTDIR)/vimrc.o: vim.rc version.h gui_w32_rc.h $(WINDRES) $(WINDRES_FLAGS) $(DEFINES) \ --input-format=rc --output-format=coff -i vim.rc -o $@ $(OUTDIR): $(MKDIR) $(OUTDIR) -$(OUTDIR)/channel.o: channel.c $(INCL) - $(CC) -c $(CFLAGS) channel.c -o $(OUTDIR)/channel.o - -$(OUTDIR)/ex_docmd.o: ex_docmd.c $(INCL) ex_cmds.h - $(CC) -c $(CFLAGS) ex_docmd.c -o $(OUTDIR)/ex_docmd.o - -$(OUTDIR)/ex_eval.o: ex_eval.c $(INCL) ex_cmds.h - $(CC) -c $(CFLAGS) ex_eval.c -o $(OUTDIR)/ex_eval.o - $(OUTDIR)/gui_dwrite.o: gui_dwrite.cpp $(INCL) gui_dwrite.h $(CC) -c $(CFLAGS) $(CXXFLAGS) gui_dwrite.cpp -o $(OUTDIR)/gui_dwrite.o -$(OUTDIR)/gui_w32.o: gui_w32.c $(INCL) +$(OUTDIR)/gui.o: gui.c $(INCL) $(GUI_INCL) + $(CC) -c $(CFLAGS) gui.c -o $(OUTDIR)/gui.o + +$(OUTDIR)/gui_beval.o: gui_beval.c $(INCL) $(GUI_INCL) + $(CC) -c $(CFLAGS) gui_beval.c -o $(OUTDIR)/gui_beval.o + +$(OUTDIR)/gui_w32.o: gui_w32.c $(INCL) $(GUI_INCL) $(CC) -c $(CFLAGS) gui_w32.c -o $(OUTDIR)/gui_w32.o $(OUTDIR)/if_cscope.o: if_cscope.c $(INCL) if_cscope.h $(CC) -c $(CFLAGS) if_cscope.c -o $(OUTDIR)/if_cscope.o -$(OUTDIR)/if_mzsch.o: if_mzsch.c $(INCL) if_mzsch.h $(MZ_EXTRA_DEP) +$(OUTDIR)/if_mzsch.o: if_mzsch.c $(INCL) $(MZSCHEME_INCL) $(MZ_EXTRA_DEP) $(CC) -c $(CFLAGS) if_mzsch.c -o $(OUTDIR)/if_mzsch.o mzscheme_base.c: $(MZSCHEME)/mzc --c-mods mzscheme_base.c ++lib scheme/base # Remove -D__IID_DEFINED__ for newer versions of the w32api -$(OUTDIR)/if_ole.o: if_ole.cpp $(INCL) +$(OUTDIR)/if_ole.o: if_ole.cpp $(INCL) if_ole.h $(CC) $(CFLAGS) $(CXXFLAGS) -c -o $(OUTDIR)/if_ole.o if_ole.cpp -if_perl.c: if_perl.xs typemap +if_perl.c: if_perl.xs typemap $(XSUBPP) -prototypes -typemap \ $(PERLTYPEMAP) if_perl.xs -output $@ -$(OUTDIR)/if_ruby.o: if_ruby.c $(INCL) +$(OUTDIR)/if_ruby.o: if_ruby.c $(INCL) ifeq (16, $(RUBY)) $(CC) $(CFLAGS) -U_WIN32 -c -o $(OUTDIR)/if_ruby.o if_ruby.c endif @@ -974,13 +972,16 @@ endif $(OUTDIR)/iscygpty.o: iscygpty.c $(CUI_INCL) $(CC) -c $(CFLAGS) iscygpty.c -o $(OUTDIR)/iscygpty.o -U_WIN32_WINNT -D_WIN32_WINNT=0x0600 -DUSE_DYNFILEID -DENABLE_STUB_IMPL -$(OUTDIR)/main.o: main.c $(INCL) $(CUI_INCL) +$(OUTDIR)/main.o: main.c $(INCL) $(CUI_INCL) $(CC) -c $(CFLAGS) main.c -o $(OUTDIR)/main.o $(OUTDIR)/netbeans.o: netbeans.c $(INCL) $(NBDEBUG_INCL) $(NBDEBUG_SRC) $(CC) -c $(CFLAGS) netbeans.c -o $(OUTDIR)/netbeans.o -$(OUTDIR)/regexp.o: regexp.c regexp_nfa.c $(INCL) +$(OUTDIR)/os_win32.o: os_win32.c $(INCL) $(MZSCHEME_INCL) + $(CC) -c $(CFLAGS) os_win32.c -o $(OUTDIR)/os_win32.o + +$(OUTDIR)/regexp.o: regexp.c regexp_nfa.c $(INCL) $(CC) -c $(CFLAGS) regexp.c -o $(OUTDIR)/regexp.o $(OUTDIR)/terminal.o: terminal.c $(INCL) $(TERM_DEPS) @@ -1042,3 +1043,5 @@ else @echo char_u *compiled_user = (char_u *)"$(USERNAME)"; >> pathdef.c @echo char_u *compiled_sys = (char_u *)"$(USERDOMAIN)"; >> pathdef.c endif + +# vim: set noet sw=8 ts=8 sts=0 wm=0 tw=0: diff --git a/src/Make_ming.mak b/src/Make_ming.mak index 9ed1a7000a..e9e20f6782 100644 --- a/src/Make_ming.mak +++ b/src/Make_ming.mak @@ -47,3 +47,5 @@ # Do not change this. UNDER_CYGWIN = no include Make_cyg_ming.mak + +# vim: set noet sw=8 ts=8 sts=0 wm=0 tw=0: diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak index 586d36b015..e9ba1c5c07 100644 --- a/src/Make_mvc.mak +++ b/src/Make_mvc.mak @@ -673,9 +673,9 @@ CFLAGS = $(CFLAGS) /Zl /MTd ! endif !endif # DEBUG -INCL = vim.h os_win32.h ascii.h feature.h globals.h keymap.h macros.h \ - proto.h option.h structs.h term.h $(CSCOPE_INCL) \ - $(NBDEBUG_INCL) +INCL = vim.h alloc.h arabic.h ascii.h ex_cmds.h farsi.h feature.h globals.h \ + keymap.h macros.h option.h os_dos.h os_win32.h proto.h regexp.h \ + spell.h structs.h term.h $(NBDEBUG_INCL) OBJ = \ $(OUTDIR)\arabic.obj \ @@ -774,18 +774,7 @@ RCFLAGS = $(RCFLAGS) -DFEAT_GUI_W32 VIM = g$(VIM) GUI_INCL = \ gui.h \ - regexp.h \ - ascii.h \ - ex_cmds.h \ - farsi.h \ - feature.h \ - globals.h \ - gui_beval.h \ - keymap.h \ - macros.h \ - option.h \ - os_dos.h \ - os_win32.h + gui_beval.h GUI_OBJ = \ $(OUTDIR)\gui.obj \ $(OUTDIR)\gui_beval.obj \ @@ -979,6 +968,7 @@ MZSCHEME_LIB = "$(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib" \ MZSCHEME_OBJ = $(OUTDIR)\if_mzsch.obj # increase stack size MZSCHEME_LIB = $(MZSCHEME_LIB) /STACK:8388608 +MZSCHEME_INCL = if_mzsch.h !endif # Perl interface @@ -1318,9 +1308,9 @@ $(OUTDIR)/ex_cmds.obj: $(OUTDIR) ex_cmds.c $(INCL) $(OUTDIR)/ex_cmds2.obj: $(OUTDIR) ex_cmds2.c $(INCL) -$(OUTDIR)/ex_docmd.obj: $(OUTDIR) ex_docmd.c $(INCL) ex_cmds.h +$(OUTDIR)/ex_docmd.obj: $(OUTDIR) ex_docmd.c $(INCL) -$(OUTDIR)/ex_eval.obj: $(OUTDIR) ex_eval.c $(INCL) ex_cmds.h +$(OUTDIR)/ex_eval.obj: $(OUTDIR) ex_eval.c $(INCL) $(OUTDIR)/ex_getln.obj: $(OUTDIR) ex_getln.c $(INCL) @@ -1344,7 +1334,7 @@ $(OUTDIR)/gui_w32.obj: $(OUTDIR) gui_w32.c $(INCL) $(GUI_INCL) $(OUTDIR)/gui_dwrite.obj: $(OUTDIR) gui_dwrite.cpp $(INCL) $(GUI_INCL) -$(OUTDIR)/if_cscope.obj: $(OUTDIR) if_cscope.c $(INCL) +$(OUTDIR)/if_cscope.obj: $(OUTDIR) if_cscope.c $(INCL) if_cscope.h $(OUTDIR)/if_lua.obj: $(OUTDIR) if_lua.c $(INCL) $(CC) $(CFLAGS_OUTDIR) $(LUA_INC) if_lua.c @@ -1359,7 +1349,7 @@ $(OUTDIR)/if_perl.obj: $(OUTDIR) if_perl.c $(INCL) $(OUTDIR)/if_perlsfio.obj: $(OUTDIR) if_perlsfio.c $(INCL) $(CC) $(CFLAGS_OUTDIR) $(PERL_INC) if_perlsfio.c -$(OUTDIR)/if_mzsch.obj: $(OUTDIR) if_mzsch.c if_mzsch.h $(INCL) $(MZSCHEME_EXTRA_DEP) +$(OUTDIR)/if_mzsch.obj: $(OUTDIR) if_mzsch.c $(MZSCHEME_INCL) $(INCL) $(MZSCHEME_EXTRA_DEP) $(CC) $(CFLAGS_OUTDIR) if_mzsch.c \ -DMZSCHEME_COLLECTS="\"$(MZSCHEME_COLLECTS:\=\\)\"" @@ -1423,7 +1413,7 @@ $(OUTDIR)/terminal.obj: $(OUTDIR) terminal.c $(INCL) $(TERM_DEPS) $(OUTDIR)/winclip.obj: $(OUTDIR) winclip.c $(INCL) -$(OUTDIR)/os_win32.obj: $(OUTDIR) os_win32.c $(INCL) os_win32.h +$(OUTDIR)/os_win32.obj: $(OUTDIR) os_win32.c $(INCL) $(MZSCHEME_INCL) $(OUTDIR)/os_w32exe.obj: $(OUTDIR) os_w32exe.c $(INCL) diff --git a/src/version.c b/src/version.c index cd09bc24b6..6416490fbd 100644 --- a/src/version.c +++ b/src/version.c @@ -761,6 +761,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1141, /**/ 1140, /**/ From 378daf87d380b9f3c4f822786dfbfdcad9ca2db9 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sat, 23 Sep 2017 23:58:28 +0200 Subject: [PATCH 11/12] patch 8.0.1142: window toolbar menu gets a tear-off item Problem: Window toolbar menu gets a tear-off item. Solution: Recognize the window toolbar. --- src/menu.c | 3 ++- src/version.c | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/menu.c b/src/menu.c index f07be97e74..9ed7c270ad 100644 --- a/src/menu.c +++ b/src/menu.c @@ -88,7 +88,7 @@ static const char *toolbar_names[] = static int menu_is_winbar(char_u *name) { - return (STRNCMP(name, "WinBar", 5) == 0); + return (STRNCMP(name, "WinBar", 6) == 0); } int @@ -1802,6 +1802,7 @@ menu_is_menubar(char_u *name) { return (!menu_is_popup(name) && !menu_is_toolbar(name) + && !menu_is_winbar(name) && *name != MNU_HIDDEN_CHAR); } diff --git a/src/version.c b/src/version.c index 6416490fbd..14edfe4ce3 100644 --- a/src/version.c +++ b/src/version.c @@ -761,6 +761,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1142, /**/ 1141, /**/ From e0de17d84e1612dbc9362989194de5674f221de5 Mon Sep 17 00:00:00 2001 From: Bram Moolenaar Date: Sun, 24 Sep 2017 16:24:34 +0200 Subject: [PATCH 12/12] patch 8.0.1143: macros always expand to the same thing Problem: Macros always expand to the same thing. Solution: Remove W_VSEP_WIDTH() and W_STATUS_HEIGHT(). --- src/ex_getln.c | 2 +- src/gui.c | 4 ++-- src/screen.c | 6 +++--- src/structs.h | 4 ++-- src/version.c | 2 ++ src/vim.h | 2 -- 6 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/ex_getln.c b/src/ex_getln.c index becfa00727..9f7dad99aa 100644 --- a/src/ex_getln.c +++ b/src/ex_getln.c @@ -3438,7 +3438,7 @@ compute_cmdrow(void) cmdline_row = Rows - 1; else cmdline_row = W_WINROW(lastwin) + lastwin->w_height - + W_STATUS_HEIGHT(lastwin); + + lastwin->w_status_height; } static void diff --git a/src/gui.c b/src/gui.c index a17c57112d..fe91062e0a 100644 --- a/src/gui.c +++ b/src/gui.c @@ -4910,10 +4910,10 @@ xy2win(int x UNUSED, int y UNUSED) } else if (row > wp->w_height) /* below status line */ update_mouseshape(SHAPE_IDX_CLINE); - else if (!(State & CMDLINE) && W_VSEP_WIDTH(wp) > 0 && col == wp->w_width + else if (!(State & CMDLINE) && wp->w_vsep_width > 0 && col == wp->w_width && (row != wp->w_height || !stl_connected(wp)) && msg_scrolled == 0) update_mouseshape(SHAPE_IDX_VSEP); - else if (!(State & CMDLINE) && W_STATUS_HEIGHT(wp) > 0 + else if (!(State & CMDLINE) && wp->w_status_height > 0 && row == wp->w_height && msg_scrolled == 0) update_mouseshape(SHAPE_IDX_STATUS); else diff --git a/src/screen.c b/src/screen.c index 13b6a06323..e505d941fc 100644 --- a/src/screen.c +++ b/src/screen.c @@ -622,8 +622,8 @@ update_screen(int type_arg) else { wp->w_redr_type = NOT_VALID; - if (W_WINROW(wp) + wp->w_height + W_STATUS_HEIGHT(wp) - <= msg_scrolled) + if (W_WINROW(wp) + wp->w_height + wp->w_status_height + <= msg_scrolled) wp->w_redr_status = TRUE; } } @@ -9490,7 +9490,7 @@ win_ins_lines( { wp->w_redr_status = TRUE; redraw_cmdline = TRUE; - nextrow = W_WINROW(wp) + wp->w_height + W_STATUS_HEIGHT(wp); + nextrow = W_WINROW(wp) + wp->w_height + wp->w_status_height; lastrow = nextrow + line_count; if (lastrow > Rows) lastrow = Rows; diff --git a/src/structs.h b/src/structs.h index 946857be5e..7b0f70cd3c 100644 --- a/src/structs.h +++ b/src/structs.h @@ -2702,8 +2702,8 @@ struct window_S int w_status_height; /* number of status lines (0 or 1) */ int w_wincol; /* Leftmost column of window in screen. */ int w_width; /* Width of window, excluding separation. */ - int w_vsep_width; /* Number of separator columns (0 or 1). - use W_VSEP_WIDTH() */ + int w_vsep_width; /* Number of separator columns (0 or 1). */ + /* * === start of cached values ==== */ diff --git a/src/version.c b/src/version.c index 14edfe4ce3..1eb93ef28f 100644 --- a/src/version.c +++ b/src/version.c @@ -761,6 +761,8 @@ static char *(features[]) = static int included_patches[] = { /* Add new patch number below this line */ +/**/ + 1143, /**/ 1142, /**/ diff --git a/src/vim.h b/src/vim.h index 43dbd8c4ab..4567c36637 100644 --- a/src/vim.h +++ b/src/vim.h @@ -860,8 +860,6 @@ extern int (*dyn_libintl_putenv)(const char *envstring); #define FINDFILE_BOTH 2 /* files and directories */ #define W_ENDCOL(wp) (wp->w_wincol + wp->w_width) -#define W_VSEP_WIDTH(wp) (wp->w_vsep_width) -#define W_STATUS_HEIGHT(wp) (wp->w_status_height) #ifdef FEAT_MENU # define W_WINROW(wp) (wp->w_winrow + wp->w_winbar_height) #else