Merge remote-tracking branch 'vim/master'

This commit is contained in:
Kazuki Sakamoto
2017-09-24 09:51:34 -07:00
49 changed files with 1560 additions and 1371 deletions
+2
View File
@@ -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:
+25 -22
View File
@@ -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:
+2
View File
@@ -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:
+10 -20
View File
@@ -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)
+1 -1
View File
@@ -2122,7 +2122,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 \
+10 -10
View File
@@ -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)
+7 -7
View File
@@ -1785,14 +1785,14 @@ 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
#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)
{
@@ -1874,7 +1874,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;
@@ -6834,7 +6834,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.
*/
@@ -6849,7 +6849,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;
@@ -6868,7 +6868,7 @@ comp_textwidth(
textwidth = 0;
if (ff && textwidth == 0)
{
textwidth = W_WIDTH(curwin) - 1;
textwidth = curwin->w_width - 1;
if (textwidth > 79)
textwidth = 79;
}
@@ -9480,7 +9480,7 @@ ins_mousescroll(int dir)
step = scroll_wheel_force;
# endif
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;
+1 -1
View File
@@ -13266,7 +13266,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)
+1 -1
View File
@@ -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;
}
+55 -35
View File
@@ -8504,7 +8504,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);
@@ -9130,7 +9130,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;
@@ -10133,20 +10133,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;
@@ -10163,11 +10205,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
/*
@@ -10233,13 +10270,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
@@ -10267,20 +10299,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
+1 -1
View File
@@ -3449,7 +3449,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
+3 -3
View File
@@ -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
+5 -5
View File
@@ -4613,14 +4613,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
@@ -4640,7 +4640,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'). */
@@ -4968,10 +4968,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
+1 -1
View File
@@ -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. */
+1 -1
View File
@@ -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;
}
}
+1 -1
View File
@@ -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)
+1 -1
View File
@@ -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;
+1 -1
View File
@@ -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 */
+1 -1
View File
@@ -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]) */
+2 -2
View File
@@ -3875,9 +3875,9 @@ 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)(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)
+1 -1
View File
@@ -1479,7 +1479,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)
+27 -5
View File
@@ -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
@@ -1808,6 +1808,7 @@ menu_is_menubar(char_u *name)
{
return (!menu_is_popup(name)
&& !menu_is_toolbar(name)
&& !menu_is_winbar(name)
&& *name != MNU_HIDDEN_CHAR);
}
@@ -2248,7 +2249,7 @@ gui_destroy_tearoffs_recurse(vimmenu_T *menu)
execute_menu(exarg_T *eap, vimmenu_T *menu)
{
char_u *mode;
int idx;
int idx = -1;
#ifdef FEAT_GUI_MACVIM
char_u *old_arg;
#endif
@@ -2315,7 +2316,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;
@@ -2333,8 +2336,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]);
@@ -2433,12 +2444,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();
@@ -2450,6 +2467,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;
}
}
}
+3 -3
View File
@@ -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;
+3 -3
View File
@@ -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();
/*
+11 -11
View File
@@ -884,14 +884,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
@@ -1004,11 +1004,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)
@@ -1016,10 +1016,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;
@@ -1050,7 +1050,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)
{
@@ -1278,7 +1278,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)
{
@@ -1483,7 +1483,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)
{
@@ -1541,7 +1541,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)
{
+1 -1
View File
@@ -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);
+17 -11
View File
@@ -2796,6 +2796,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);
@@ -4453,8 +4459,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 */
@@ -4659,7 +4665,7 @@ nv_mousescroll(cmdarg_T *cap)
step = scroll_wheel_force;
# endif
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;
@@ -4911,7 +4917,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 */
@@ -4928,7 +4934,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 */
@@ -4972,7 +4978,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
@@ -8107,7 +8113,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();
@@ -8121,7 +8127,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);
@@ -8173,7 +8179,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();
@@ -8205,7 +8211,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. */
@@ -9599,7 +9605,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;
+3 -3
View File
@@ -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 + curwin->w_width - 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 + curwin->w_width - 1)
screen_putchar(' ', row, pum_col + 1, attr);
}
else
+2
View File
@@ -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);
+2 -1
View File
@@ -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);
+1 -1
View File
@@ -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)
+107 -110
View File
@@ -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
@@ -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;
}
}
@@ -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;
@@ -2217,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;
@@ -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
@@ -2355,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));
@@ -2368,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));
@@ -2377,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,
@@ -2394,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
@@ -2404,10 +2402,10 @@ 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,
W_WINCOL(wp) + n, (int)W_WINCOL(wp) + nn,
wp->w_wincol + n, (int)wp->w_wincol + nn,
' ', ' ', HL_ATTR(HLF_FC));
n = nn;
}
@@ -2418,16 +2416,16 @@ 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,
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);
@@ -2484,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
@@ -2568,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
@@ -2595,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);
@@ -2664,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
@@ -2679,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
@@ -2690,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)
@@ -2704,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
@@ -2719,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);
@@ -2749,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
@@ -2777,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
@@ -2839,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);
}
@@ -2854,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);
}
}
}
@@ -2874,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;
@@ -2890,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), W_WINCOL(wp), (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
@@ -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
@@ -3727,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
@@ -3966,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
@@ -4019,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)wp->w_width,
HAS_RIGHTLEFT(wp->w_p_rl));
/* Pretend we have finished updating the window. Except when
* 'cursorcolumn' is set. */
@@ -4288,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 = '>';
@@ -4489,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 = '>';
@@ -4706,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;
@@ -4923,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)))
@@ -5034,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 */
@@ -5057,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 = ' ';
@@ -5178,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;
@@ -5345,7 +5342,7 @@ win_line(
else
#endif
{
if (col >= W_WIDTH(wp))
if (col >= wp->w_width)
n = -1;
}
if (n != 0)
@@ -5449,7 +5446,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
@@ -5468,7 +5465,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
@@ -5495,8 +5492,8 @@ win_line(
}
#endif
screen_line(screen_row, W_WINCOL(wp), col,
(int)W_WIDTH(wp), HAS_RIGHTLEFT(wp->w_p_rl));
screen_line(screen_row, wp->w_wincol, col,
(int)wp->w_width, HAS_RIGHTLEFT(wp->w_p_rl));
row++;
/*
@@ -5526,7 +5523,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))))
@@ -5791,7 +5788,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
@@ -5801,12 +5798,12 @@ win_line(
)
{
#ifdef FEAT_CONCEAL
screen_line(screen_row, W_WINCOL(wp), col - boguscols,
(int)W_WIDTH(wp), HAS_RIGHTLEFT(wp->w_p_rl));
screen_line(screen_row, wp->w_wincol, col - boguscols,
(int)wp->w_width, HAS_RIGHTLEFT(wp->w_p_rl));
boguscols = 0;
#else
screen_line(screen_row, W_WINCOL(wp), col,
(int)W_WIDTH(wp), HAS_RIGHTLEFT(wp->w_p_rl));
screen_line(screen_row, wp->w_wincol, col,
(int)wp->w_width, HAS_RIGHTLEFT(wp->w_p_rl));
#endif
++row;
++screen_row;
@@ -5843,7 +5840,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;
@@ -5880,7 +5877,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));
@@ -5906,7 +5903,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
@@ -6903,9 +6900,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! */
@@ -6944,14 +6941,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);
@@ -7136,7 +7133,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)
{
@@ -7152,10 +7149,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;
@@ -7180,7 +7177,7 @@ win_redr_custom(
# endif
}
col += W_WINCOL(wp);
col += wp->w_wincol;
}
if (maxwidth <= 0)
@@ -9448,11 +9445,11 @@ 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. */
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
@@ -9520,12 +9517,12 @@ 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;
screen_fill(nextrow - line_count, lastrow - line_count,
W_WINCOL(wp), (int)W_ENDCOL(wp),
wp->w_wincol, (int)W_ENDCOL(wp),
' ', ' ', 0);
}
@@ -9636,7 +9633,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;
}
@@ -9658,7 +9655,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);
@@ -10760,21 +10757,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);
@@ -10787,20 +10784,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, W_WINCOL(wp), (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
/*
@@ -10931,8 +10928,8 @@ win_redr_ruler(win_T *wp, int always)
{
row = W_WINROW(wp) + wp->w_height;
fillchar = fillchar_status(&attr, wp);
off = W_WINCOL(wp);
width = W_WIDTH(wp);
off = wp->w_wincol;
width = wp->w_width;
}
else
{
+1 -1
View File
@@ -2617,7 +2617,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;
+17 -6
View File
@@ -2712,12 +2712,10 @@ 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_width; /* Width of window, excluding separation.
use W_WIDTH() */
int w_vsep_width; /* Number of separator columns (0 or 1).
use W_VSEP_WIDTH() */
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). */
/*
* === start of cached values ====
*/
@@ -3426,3 +3424,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;
+19 -10
View File
@@ -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
@@ -9548,7 +9557,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;
}
+2 -2
View File
@@ -3822,8 +3822,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 */
}
+8 -2
View File
@@ -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;
@@ -729,7 +735,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;
}
@@ -1307,7 +1313,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)
{
-2
View File
@@ -40,8 +40,6 @@ SCRIPTS_ALL = \
test48.out \
test53.out \
test55.out \
test56.out \
test57.out \
test60.out \
test64.out \
test66.out \
+1 -1
View File
@@ -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 \
-21
View File
@@ -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 <SID>DoLast()
call append(line('$'), "last line")
endfun
fun s:DoNothing()
call append(line('$'), "nothing line")
endfun
nnoremap <buffer> _x :call <SID>DoNothing()<bar>call <SID>DoLast()<bar>delfunc <SID>DoNothing<bar>delfunc <SID>DoLast<cr>
end:
-2
View File
@@ -1,2 +0,0 @@
nothing line
last line
-545
View File
@@ -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
-501
View File
@@ -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
File diff suppressed because it is too large Load Diff
+20
View File
@@ -1421,6 +1421,26 @@ func Test_user_command_with_bang()
delcommand Nieuw
endfunc
" Test for script-local function
func <SID>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 <buffer> _x :call <SID>DoNothing()<bar>call <SID>DoLast()<bar>delfunc <SID>DoNothing<bar>delfunc <SID>DoLast<cr>
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
+18 -6
View File
@@ -2631,6 +2631,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 */
@@ -2719,8 +2722,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
/*
@@ -2759,7 +2764,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
@@ -2849,6 +2854,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 */
@@ -2865,7 +2877,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.
@@ -2965,7 +2977,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
@@ -3040,7 +3052,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;
@@ -3084,7 +3096,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;
}
+22
View File
@@ -776,6 +776,28 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
1143,
/**/
1142,
/**/
1141,
/**/
1140,
/**/
1139,
/**/
1138,
/**/
1137,
/**/
1136,
/**/
1135,
/**/
1134,
/**/
1133,
/**/
1132,
/**/
+1 -4
View File
@@ -862,11 +862,7 @@ 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)
#define W_STATUS_HEIGHT(wp) (wp->w_status_height)
#ifdef FEAT_MENU
# define W_WINROW(wp) (wp->w_winrow + wp->w_winbar_height)
#else
@@ -1903,6 +1899,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 */
+4 -4
View File
@@ -2729,7 +2729,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);
}
@@ -5782,13 +5782,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;
}