Compare commits

...

20 Commits

Author SHA1 Message Date
Bram Moolenaar
e90858d022 patch 8.0.0283: mode() does not indicate Insert mode completion
Problem:    The return value of mode() does not indicate that completion is
            active in Replace and Insert mode. (Zhen-Huan (Kenny) Hu)
Solution:   Add "c" or "x" for two kinds of completion. (Yegappan Lakshmanan,
            closes #1397)  Test some more modes.
2017-02-01 17:24:34 +01:00
Bram Moolenaar
0b5c93a7f2 patch 8.0.0282: need to use CTRL-O twice when in Visual-Insert mode
Problem:    When doing a Visual selection and using "I" to go to insert mode,
            CTRL-O needs to be used twice to go to Normal mode. (Coacher)
Solution:   Check for the return value of edit(). (Christian Brabandt,
            closes #1290)
2017-02-01 15:03:30 +01:00
Bram Moolenaar
1266d678bf patch 8.0.0281: some files are still using ARGSUSED instead of UNUSED
Problem:    MS-Windows files are still using ARGSUSED while most other files
            have UNUSED.
Solution:   Change ARGSUSED to UNUSED or delete it.
2017-02-01 13:43:36 +01:00
Bram Moolenaar
7c23d1d9d9 patch 8.0.0280: problem setting multi-byte environment var on MS-Windows
Problem:    On MS-Windows setting an environment variable with multi-byte
            strings does not work well.
Solution:   Use wputenv when possible. (Taro Muraoka, Ken Takata)
2017-02-01 13:14:16 +01:00
Bram Moolenaar
168dd00f72 patch 8.0.0279: MSVC 2015 uses a different dll name
Problem:    With MSVC 2015 the dll name is vcruntime140.dll.
Solution:   Check the MSVC version and use the right dll name. (Ken Takata)
2017-02-01 13:02:47 +01:00
Bram Moolenaar
f1ab9c1370 patch 8.0.0278: GUI test fails on MS-Windows
Problem:    GUI test fails on MS-Windows.
Solution:   Check that tester_HOME exists.
2017-02-01 12:32:58 +01:00
Bram Moolenaar
56e6bd7ba2 patch 8.0.0277: the GUI test may trigger fontconfig and take a long time
Problem:    The GUI test may trigger fontconfig and take a long time.
Solution:   Set $XDG_CACHE_HOME. (Kazunobu Kuriyama)
2017-02-01 12:08:47 +01:00
Bram Moolenaar
3954e3c4b5 patch 8.0.0276: unnecessary #ifdefs
Problem:    Checking for FEAT_GUI_GNOME inside GTK 3 code is unnecessary.
Solution:   Remove the #ifdef. (Kazunobu Kuriyama)
2017-02-01 11:50:09 +01:00
Bram Moolenaar
e3caa11090 patch 8.0.0275: the screen may be updated at the wrong time
Problem:    When checking for CTRL-C typed the GUI may detect a screen resize
            and redraw the screen, causing trouble.
Solution:   Set updating_screen in ui_breakcheck().
2017-01-31 22:07:42 +01:00
Bram Moolenaar
070b33da93 patch 8.0.0274: possible recursive screen updating causes trouble
Problem:    When update_single_line() is called recursively, or another screen
            update happens while it is busy, errors may occur.
Solution:   Check and update updating_screen. (Christian Brabandt)
2017-01-31 21:53:39 +01:00
Bram Moolenaar
c4a249a736 patch 8.0.0273: dead code detected by Coverity
Problem:    Dead code detected by Coverity when not using gnome.
Solution:   Rearrange the #ifdefs to avoid dead code.
2017-01-30 22:56:48 +01:00
Bram Moolenaar
432c839ebd patch 8.0.0272: crash on exit is not detected when running tests
Problem:    Crash on exit is not detected when running tests.
Solution:   Remove the dash before the command. (Dominique Pelle, closes
            #1425)
2017-01-30 22:01:01 +01:00
Bram Moolenaar
a4c906a4a1 patch 8.0.0271: may get ml_get error when :tcldo deletes lines
Problem:    May get ml_get error when :tcldo deletes lines or switches to
            another buffer. (Nikolai Pavlov, closes #1421)
Solution:   Check the buffer and line every time.
2017-01-29 23:26:37 +01:00
Bram Moolenaar
c593fee0e5 patch 8.0.0270: may get ml_get error when :rubydo deletes lines
Problem:    May get ml_get error when :rubydo deletes lines or switches to
            another buffer. (Nikolai Pavlov, issue #1421)
Solution:   Check the buffer and line every time.
2017-01-29 23:11:25 +01:00
Bram Moolenaar
85b5743d3e patch 8.0.0269: may get ml_get error when :perldo deletes lines
Problem:    May get ml_get error when :perldo deletes lines or switches to
            another buffer. (Nikolai Pavlov, issue #1421)
Solution:   Check the buffer and line every time.
2017-01-29 22:59:12 +01:00
Bram Moolenaar
d58f03b1c2 patch 8.0.0268: may get ml_get error when :luado deletes lines
Problem:    May get ml_get error when :luado deletes lines or switches to
            another buffer. (Nikolai Pavlov, issue #1421)
Solution:   Check the buffer and line every time.
2017-01-29 22:48:45 +01:00
Bram Moolenaar
6fe2eb43d2 patch 8.0.0267: channel test sometimes fails on Mac
Problem:    A channel test sometimes fails on Mac.
Solution:   Add the test to the list of flaky tests.
2017-01-29 21:49:51 +01:00
Bram Moolenaar
c625155ea4 patch 8.0.0266: compiler warning for using uninitialized variable
Problem:    Compiler warning for using uninitialized variable.
Solution:   Set tab_number also when there is an error.
2017-01-29 21:42:20 +01:00
Bram Moolenaar
a58883b4ea patch 8.0.0265: may get ml_get error when :pydo deletes lines
Problem:    May get ml_get error when :pydo deletes lines or switches to
            another buffer. (Nikolai Pavlov, issue #1421)
Solution:   Check the buffer and line every time.
2017-01-29 21:31:09 +01:00
Bram Moolenaar
d297f35eb0 patch 8.0.0264: memory error reported by ubsan
Problem:    Memory error reported by ubsan, probably for using the string
            returned by execute().
Solution:   NUL terminate the result of execute().
2017-01-29 20:31:21 +01:00
38 changed files with 520 additions and 168 deletions

View File

@@ -5848,9 +5848,13 @@ mode([expr]) Return a string that indicates the current mode.
S Select by line S Select by line
CTRL-S Select blockwise CTRL-S Select blockwise
i Insert i Insert
ic Insert mode completion |compl-generic|
ix Insert mode |i_CTRL-X| completion
R Replace |R| R Replace |R|
Rc Replace mode completion |compl-generic|
Rv Virtual Replace |gR| Rv Virtual Replace |gR|
c Command-line Rx Replace mode |i_CTRL-X| completion
c Command-line editing
cv Vim Ex mode |gQ| cv Vim Ex mode |gQ|
ce Normal Ex mode |Q| ce Normal Ex mode |Q|
r Hit-enter prompt r Hit-enter prompt

View File

@@ -285,8 +285,10 @@ MSVCRT_VER = ($(MSVCVER) / 10 - 50)
# Base name of the msvcrXX.dll # Base name of the msvcrXX.dll
!if $(MSVCRT_VER) <= 60 !if $(MSVCRT_VER) <= 60
MSVCRT_NAME = msvcrt MSVCRT_NAME = msvcrt
!else !elseif $(MSVCRT_VER) <= 130
MSVCRT_NAME = msvcr$(MSVCRT_VER) MSVCRT_NAME = msvcr$(MSVCRT_VER)
!else
MSVCRT_NAME = vcruntime$(MSVCRT_VER)
!endif !endif
!if $(MSVC_MAJOR) == 6 !if $(MSVC_MAJOR) == 6

View File

@@ -2147,6 +2147,7 @@ test_arglist \
test_langmap \ test_langmap \
test_largefile \ test_largefile \
test_lispwords \ test_lispwords \
test_lua \
test_man \ test_man \
test_mapping \ test_mapping \
test_marks \ test_marks \
@@ -2168,6 +2169,8 @@ test_arglist \
test_popup \ test_popup \
test_profile \ test_profile \
test_put \ test_put \
test_python2 \
test_python3 \
test_pyx2 \ test_pyx2 \
test_pyx3 \ test_pyx3 \
test_quickfix \ test_quickfix \
@@ -2195,6 +2198,7 @@ test_arglist \
test_tabpage \ test_tabpage \
test_tagcase \ test_tagcase \
test_tagjump \ test_tagjump \
test_tcl \
test_textobjects \ test_textobjects \
test_timers \ test_timers \
test_true_false \ test_true_false \

View File

@@ -2819,7 +2819,17 @@ f_execute(typval_T *argvars, typval_T *rettv)
--list->lv_refcount; --list->lv_refcount;
} }
/* Need to append a NUL to the result. */
if (ga_grow(&redir_execute_ga, 1) == OK)
{
((char *)redir_execute_ga.ga_data)[redir_execute_ga.ga_len] = NUL;
rettv->vval.v_string = redir_execute_ga.ga_data; rettv->vval.v_string = redir_execute_ga.ga_data;
}
else
{
ga_clear(&redir_execute_ga);
rettv->vval.v_string = NULL;
}
msg_silent = save_msg_silent; msg_silent = save_msg_silent;
emsg_silent = save_emsg_silent; emsg_silent = save_emsg_silent;
emsg_noredir = save_emsg_noredir; emsg_noredir = save_emsg_noredir;
@@ -7773,20 +7783,25 @@ f_mode(typval_T *argvars, typval_T *rettv)
} }
else else
#endif #endif
{
if (State & REPLACE_FLAG) if (State & REPLACE_FLAG)
buf[0] = 'R'; buf[0] = 'R';
else else
buf[0] = 'i'; buf[0] = 'i';
#ifdef FEAT_INS_EXPAND
if (ins_compl_active())
buf[1] = 'c';
else if (ctrl_x_mode == 1)
buf[1] = 'x';
#endif
} }
else if (State & CMDLINE) }
else if ((State & CMDLINE) || exmode_active)
{ {
buf[0] = 'c'; buf[0] = 'c';
if (exmode_active) if (exmode_active == EXMODE_VIM)
buf[1] = 'v'; buf[1] = 'v';
} else if (exmode_active == EXMODE_NORMAL)
else if (exmode_active)
{
buf[0] = 'c';
buf[1] = 'e'; buf[1] = 'e';
} }
else else

View File

@@ -7533,7 +7533,10 @@ get_tabpage_arg(exarg_T *eap)
else if (eap->addr_count > 0) else if (eap->addr_count > 0)
{ {
if (unaccept_arg0 && eap->line2 == 0) if (unaccept_arg0 && eap->line2 == 0)
{
eap->errmsg = e_invrange; eap->errmsg = e_invrange;
tab_number = 0;
}
else else
{ {
tab_number = eap->line2; tab_number = eap->line2;

View File

@@ -3171,9 +3171,9 @@ delete_event_cb(GtkWidget *widget UNUSED,
static int static int
get_item_dimensions(GtkWidget *widget, GtkOrientation orientation) get_item_dimensions(GtkWidget *widget, GtkOrientation orientation)
{ {
# ifdef FEAT_GUI_GNOME
GtkOrientation item_orientation = GTK_ORIENTATION_HORIZONTAL; GtkOrientation item_orientation = GTK_ORIENTATION_HORIZONTAL;
# ifdef FEAT_GUI_GNOME
if (using_gnome && widget != NULL) if (using_gnome && widget != NULL)
{ {
GtkWidget *parent; GtkWidget *parent;
@@ -3192,7 +3192,10 @@ get_item_dimensions(GtkWidget *widget, GtkOrientation orientation)
item_orientation = bonobo_dock_item_get_orientation(dockitem); item_orientation = bonobo_dock_item_get_orientation(dockitem);
} }
} }
# else
# define item_orientation GTK_ORIENTATION_HORIZONTAL
# endif # endif
# if GTK_CHECK_VERSION(3,0,0) # if GTK_CHECK_VERSION(3,0,0)
if (widget != NULL if (widget != NULL
&& item_orientation == orientation && item_orientation == orientation
@@ -3209,16 +3212,16 @@ get_item_dimensions(GtkWidget *widget, GtkOrientation orientation)
GtkAllocation allocation; GtkAllocation allocation;
gtk_widget_get_allocation(widget, &allocation); gtk_widget_get_allocation(widget, &allocation);
if (orientation == GTK_ORIENTATION_HORIZONTAL)
return allocation.height; return allocation.height;
else
return allocation.width;
# else # else
# ifdef FEAT_GUI_GNOME
if (orientation == GTK_ORIENTATION_HORIZONTAL) if (orientation == GTK_ORIENTATION_HORIZONTAL)
return widget->allocation.height; return widget->allocation.height;
else else
return widget->allocation.width; return widget->allocation.width;
# else
return widget->allocation.height;
# endif
# endif # endif
} }
return 0; return 0;

View File

@@ -558,13 +558,12 @@ gui_mch_set_blinking(long wait, long on, long off)
blink_offtime = off; blink_offtime = off;
} }
/* ARGSUSED */
static VOID CALLBACK static VOID CALLBACK
_OnBlinkTimer( _OnBlinkTimer(
HWND hwnd, HWND hwnd,
UINT uMsg, UINT uMsg UNUSED,
UINT idEvent, UINT idEvent,
DWORD dwTime) DWORD dwTime UNUSED)
{ {
MSG msg; MSG msg;
@@ -644,13 +643,12 @@ gui_mch_start_blink(void)
* Call-back routines. * Call-back routines.
*/ */
/*ARGSUSED*/
static VOID CALLBACK static VOID CALLBACK
_OnTimer( _OnTimer(
HWND hwnd, HWND hwnd,
UINT uMsg, UINT uMsg UNUSED,
UINT idEvent, UINT idEvent,
DWORD dwTime) DWORD dwTime UNUSED)
{ {
MSG msg; MSG msg;
@@ -667,12 +665,11 @@ _OnTimer(
s_wait_timer = 0; s_wait_timer = 0;
} }
/*ARGSUSED*/
static void static void
_OnDeadChar( _OnDeadChar(
HWND hwnd, HWND hwnd UNUSED,
UINT ch, UINT ch UNUSED,
int cRepeat) int cRepeat UNUSED)
{ {
dead_key = 1; dead_key = 1;
} }
@@ -752,12 +749,11 @@ char_to_string(int ch, char_u *string, int slen, int had_alt)
/* /*
* Key hit, add it to the input buffer. * Key hit, add it to the input buffer.
*/ */
/*ARGSUSED*/
static void static void
_OnChar( _OnChar(
HWND hwnd, HWND hwnd UNUSED,
UINT ch, UINT ch,
int cRepeat) int cRepeat UNUSED)
{ {
char_u string[40]; char_u string[40];
int len = 0; int len = 0;
@@ -777,12 +773,11 @@ _OnChar(
/* /*
* Alt-Key hit, add it to the input buffer. * Alt-Key hit, add it to the input buffer.
*/ */
/*ARGSUSED*/
static void static void
_OnSysChar( _OnSysChar(
HWND hwnd, HWND hwnd UNUSED,
UINT cch, UINT cch,
int cRepeat) int cRepeat UNUSED)
{ {
char_u string[40]; /* Enough for multibyte character */ char_u string[40]; /* Enough for multibyte character */
int len; int len;
@@ -861,11 +856,10 @@ _OnMouseEvent(
gui_send_mouse_event(button, x, y, repeated_click, vim_modifiers); gui_send_mouse_event(button, x, y, repeated_click, vim_modifiers);
} }
/*ARGSUSED*/
static void static void
_OnMouseButtonDown( _OnMouseButtonDown(
HWND hwnd, HWND hwnd UNUSED,
BOOL fDoubleClick, BOOL fDoubleClick UNUSED,
int x, int x,
int y, int y,
UINT keyFlags) UINT keyFlags)
@@ -960,10 +954,9 @@ _OnMouseButtonDown(
} }
} }
/*ARGSUSED*/
static void static void
_OnMouseMoveOrRelease( _OnMouseMoveOrRelease(
HWND hwnd, HWND hwnd UNUSED,
int x, int x,
int y, int y,
UINT keyFlags) UINT keyFlags)
@@ -1038,13 +1031,12 @@ gui_mswin_find_menu(
return pMenu; return pMenu;
} }
/*ARGSUSED*/
static void static void
_OnMenu( _OnMenu(
HWND hwnd, HWND hwnd UNUSED,
int id, int id,
HWND hwndCtl, HWND hwndCtl UNUSED,
UINT codeNotify) UINT codeNotify UNUSED)
{ {
vimmenu_T *pMenu; vimmenu_T *pMenu;
@@ -1527,9 +1519,8 @@ gui_mch_get_font(
* Return the name of font "font" in allocated memory. * Return the name of font "font" in allocated memory.
* Don't know how to get the actual name, thus use the provided name. * Don't know how to get the actual name, thus use the provided name.
*/ */
/*ARGSUSED*/
char_u * char_u *
gui_mch_get_fontname(GuiFont font, char_u *name) gui_mch_get_fontname(GuiFont font UNUSED, char_u *name)
{ {
if (name == NULL) if (name == NULL)
return NULL; return NULL;
@@ -2175,13 +2166,12 @@ gui_mch_enable_menu(int flag)
#endif #endif
} }
/*ARGSUSED*/
void void
gui_mch_set_menu_pos( gui_mch_set_menu_pos(
int x, int x UNUSED,
int y, int y UNUSED,
int w, int w UNUSED,
int h) int h UNUSED)
{ {
/* It will be in the right place anyway */ /* It will be in the right place anyway */
} }
@@ -2817,10 +2807,8 @@ _OnEndSession(void)
* Get this message when the user clicks on the cross in the top right corner * Get this message when the user clicks on the cross in the top right corner
* of a Windows95 window. * of a Windows95 window.
*/ */
/*ARGSUSED*/
static void static void
_OnClose( _OnClose(HWND hwnd UNUSED)
HWND hwnd)
{ {
gui_shell_closed(); gui_shell_closed();
} }
@@ -2829,8 +2817,7 @@ _OnClose(
* Get a message when the window is being destroyed. * Get a message when the window is being destroyed.
*/ */
static void static void
_OnDestroy( _OnDestroy(HWND hwnd)
HWND hwnd)
{ {
if (!destroying) if (!destroying)
_OnClose(hwnd); _OnClose(hwnd);
@@ -2883,11 +2870,10 @@ _OnPaint(
} }
} }
/*ARGSUSED*/
static void static void
_OnSize( _OnSize(
HWND hwnd, HWND hwnd,
UINT state, UINT state UNUSED,
int cx, int cx,
int cy) int cy)
{ {
@@ -3124,9 +3110,8 @@ gui_mch_insert_lines(
} }
/*ARGSUSED*/
void void
gui_mch_exit(int rc) gui_mch_exit(int rc UNUSED)
{ {
#if defined(FEAT_DIRECTX) #if defined(FEAT_DIRECTX)
DWriteContext_Close(s_dwc); DWriteContext_Close(s_dwc);
@@ -3285,9 +3270,8 @@ gui_mch_wide_font_changed(void)
* Initialise vim to use the font with the given name. * Initialise vim to use the font with the given name.
* Return FAIL if the font could not be loaded, OK otherwise. * Return FAIL if the font could not be loaded, OK otherwise.
*/ */
/*ARGSUSED*/
int int
gui_mch_init_font(char_u *font_name, int fontset) gui_mch_init_font(char_u *font_name, int fontset UNUSED)
{ {
LOGFONT lf; LOGFONT lf;
GuiFont font = NOFONT; GuiFont font = NOFONT;
@@ -3416,11 +3400,10 @@ gui_mch_newfont(void)
/* /*
* Set the window title * Set the window title
*/ */
/*ARGSUSED*/
void void
gui_mch_settitle( gui_mch_settitle(
char_u *title, char_u *title,
char_u *icon) char_u *icon UNUSED)
{ {
set_window_title(s_hwnd, (title == NULL ? "VIM" : (char *)title)); set_window_title(s_hwnd, (title == NULL ? "VIM" : (char *)title));
} }
@@ -3772,10 +3755,9 @@ gui_mch_browse(
} }
#endif /* FEAT_BROWSE */ #endif /* FEAT_BROWSE */
/*ARGSUSED*/
static void static void
_OnDropFiles( _OnDropFiles(
HWND hwnd, HWND hwnd UNUSED,
HDROP hDrop) HDROP hDrop)
{ {
#ifdef FEAT_WINDOWS #ifdef FEAT_WINDOWS
@@ -3833,10 +3815,9 @@ _OnDropFiles(
#endif #endif
} }
/*ARGSUSED*/
static int static int
_OnScroll( _OnScroll(
HWND hwnd, HWND hwnd UNUSED,
HWND hwndCtl, HWND hwndCtl,
UINT code, UINT code,
int pos) int pos)
@@ -3954,7 +3935,6 @@ _OnScroll(
* Return pointer to buffer in "tofree". * Return pointer to buffer in "tofree".
* Returns zero when out of memory. * Returns zero when out of memory.
*/ */
/*ARGSUSED*/
int int
get_cmd_args(char *prog, char *cmdline, char ***argvp, char **tofree) get_cmd_args(char *prog, char *cmdline, char ***argvp, char **tofree)
{ {
@@ -5588,10 +5568,14 @@ get_work_area(RECT *spi_rect)
/* /*
* Set the size of the window to the given width and height in pixels. * Set the size of the window to the given width and height in pixels.
*/ */
/*ARGSUSED*/
void void
gui_mch_set_shellsize(int width, int height, gui_mch_set_shellsize(
int min_width, int min_height, int base_width, int base_height, int width,
int height,
int min_width UNUSED,
int min_height UNUSED,
int base_width UNUSED,
int base_height UNUSED,
int direction) int direction)
{ {
RECT workarea_rect; RECT workarea_rect;
@@ -5752,9 +5736,8 @@ gui_mch_set_sp_color(guicolor_T color)
/* /*
* handle WM_IME_NOTIFY message * handle WM_IME_NOTIFY message
*/ */
/*ARGSUSED*/
static LRESULT static LRESULT
_OnImeNotify(HWND hWnd, DWORD dwCommand, DWORD dwData) _OnImeNotify(HWND hWnd, DWORD dwCommand, DWORD dwData UNUSED)
{ {
LRESULT lResult = 0; LRESULT lResult = 0;
HIMC hImc; HIMC hImc;
@@ -5802,9 +5785,8 @@ _OnImeNotify(HWND hWnd, DWORD dwCommand, DWORD dwData)
return lResult; return lResult;
} }
/*ARGSUSED*/
static LRESULT static LRESULT
_OnImeComposition(HWND hwnd, WPARAM dbcs, LPARAM param) _OnImeComposition(HWND hwnd, WPARAM dbcs UNUSED, LPARAM param)
{ {
char_u *ret; char_u *ret;
int len; int len;
@@ -6844,13 +6826,12 @@ gui_mch_menu_grey(
* pressed, return that button's ID - IDCANCEL (2), which is the button's * pressed, return that button's ID - IDCANCEL (2), which is the button's
* number. * number.
*/ */
/*ARGSUSED*/
static LRESULT CALLBACK static LRESULT CALLBACK
dialog_callback( dialog_callback(
HWND hwnd, HWND hwnd,
UINT message, UINT message,
WPARAM wParam, WPARAM wParam,
LPARAM lParam) LPARAM lParam UNUSED)
{ {
if (message == WM_INITDIALOG) if (message == WM_INITDIALOG)
{ {
@@ -8536,12 +8517,11 @@ delete_tooltip(BalloonEval *beval)
PostMessage(beval->balloon, WM_CLOSE, 0, 0); PostMessage(beval->balloon, WM_CLOSE, 0, 0);
} }
/*ARGSUSED*/
static VOID CALLBACK static VOID CALLBACK
BevalTimerProc( BevalTimerProc(
HWND hwnd, HWND hwnd UNUSED,
UINT uMsg, UINT uMsg UNUSED,
UINT_PTR idEvent, UINT_PTR idEvent UNUSED,
DWORD dwTime) DWORD dwTime)
{ {
POINT pt; POINT pt;
@@ -8578,16 +8558,14 @@ BevalTimerProc(
} }
} }
/*ARGSUSED*/
void void
gui_mch_disable_beval_area(BalloonEval *beval) gui_mch_disable_beval_area(BalloonEval *beval UNUSED)
{ {
// TRACE0("gui_mch_disable_beval_area {{{"); // TRACE0("gui_mch_disable_beval_area {{{");
KillTimer(s_textArea, BevalTimerId); KillTimer(s_textArea, BevalTimerId);
// TRACE0("gui_mch_disable_beval_area }}}"); // TRACE0("gui_mch_disable_beval_area }}}");
} }
/*ARGSUSED*/
void void
gui_mch_enable_beval_area(BalloonEval *beval) gui_mch_enable_beval_area(BalloonEval *beval)
{ {
@@ -8619,7 +8597,6 @@ gui_mch_post_balloon(BalloonEval *beval, char_u *mesg)
// TRACE0("gui_mch_post_balloon }}}"); // TRACE0("gui_mch_post_balloon }}}");
} }
/*ARGSUSED*/
BalloonEval * BalloonEval *
gui_mch_create_beval_area( gui_mch_create_beval_area(
void *target, /* ignored, always use s_textArea */ void *target, /* ignored, always use s_textArea */
@@ -8659,9 +8636,8 @@ gui_mch_create_beval_area(
return beval; return beval;
} }
/*ARGSUSED*/
static void static void
Handle_WM_Notify(HWND hwnd, LPNMHDR pnmh) Handle_WM_Notify(HWND hwnd UNUSED, LPNMHDR pnmh)
{ {
if (pnmh->idFrom != ID_BEVAL_TOOLTIP) /* it is not our tooltip */ if (pnmh->idFrom != ID_BEVAL_TOOLTIP) /* it is not our tooltip */
return; return;

View File

@@ -1716,6 +1716,8 @@ ex_luado(exarg_T *eap)
const char *s = (const char *) eap->arg; const char *s = (const char *) eap->arg;
luaL_Buffer b; luaL_Buffer b;
size_t len; size_t len;
buf_T *was_curbuf = curbuf;
if (lua_init() == FAIL) return; if (lua_init() == FAIL) return;
if (u_save(eap->line1 - 1, eap->line2 + 1) == FAIL) if (u_save(eap->line1 - 1, eap->line2 + 1) == FAIL)
{ {
@@ -1739,6 +1741,10 @@ ex_luado(exarg_T *eap)
lua_replace(L, -2); /* function -> body */ lua_replace(L, -2); /* function -> body */
for (l = eap->line1; l <= eap->line2; l++) for (l = eap->line1; l <= eap->line2; l++)
{ {
/* Check the line number, the command my have deleted lines. */
if (l > curbuf->b_ml.ml_line_count)
break;
lua_pushvalue(L, -1); /* function */ lua_pushvalue(L, -1); /* function */
luaV_pushline(L, curbuf, l); /* current line as arg */ luaV_pushline(L, curbuf, l); /* current line as arg */
lua_pushinteger(L, l); /* current line number as arg */ lua_pushinteger(L, l); /* current line number as arg */
@@ -1747,6 +1753,9 @@ ex_luado(exarg_T *eap)
luaV_emsg(L); luaV_emsg(L);
break; break;
} }
/* Catch the command switching to another buffer. */
if (curbuf != was_curbuf)
break;
if (lua_isstring(L, -1)) /* update line? */ if (lua_isstring(L, -1)) /* update line? */
{ {
#ifdef HAVE_SANDBOX #ifdef HAVE_SANDBOX

View File

@@ -1286,6 +1286,7 @@ ex_perldo(exarg_T *eap)
SV *sv; SV *sv;
char *str; char *str;
linenr_T i; linenr_T i;
buf_T *was_curbuf = curbuf;
if (bufempty()) if (bufempty())
return; return;
@@ -1321,11 +1322,14 @@ ex_perldo(exarg_T *eap)
SAVETMPS; SAVETMPS;
for (i = eap->line1; i <= eap->line2; i++) for (i = eap->line1; i <= eap->line2; i++)
{ {
/* Check the line number, the command my have deleted lines. */
if (i > curbuf->b_ml.ml_line_count)
break;
sv_setpv(GvSV(PL_defgv), (char *)ml_get(i)); sv_setpv(GvSV(PL_defgv), (char *)ml_get(i));
PUSHMARK(sp); PUSHMARK(sp);
perl_call_pv("VIM::perldo", G_SCALAR | G_EVAL); perl_call_pv("VIM::perldo", G_SCALAR | G_EVAL);
str = SvPV(GvSV(PL_errgv), length); str = SvPV(GvSV(PL_errgv), length);
if (length) if (length || curbuf != was_curbuf)
break; break;
SPAGAIN; SPAGAIN;
if (SvTRUEx(POPs)) if (SvTRUEx(POPs))

View File

@@ -5619,6 +5619,7 @@ run_do(const char *cmd, void *arg UNUSED
int status; int status;
PyObject *pyfunc, *pymain; PyObject *pyfunc, *pymain;
PyObject *run_ret; PyObject *run_ret;
buf_T *was_curbuf = curbuf;
if (u_save((linenr_T)RangeStart - 1, (linenr_T)RangeEnd + 1) != OK) if (u_save((linenr_T)RangeStart - 1, (linenr_T)RangeEnd + 1) != OK)
{ {
@@ -5671,7 +5672,9 @@ run_do(const char *cmd, void *arg UNUSED
#ifdef PY_CAN_RECURSE #ifdef PY_CAN_RECURSE
*pygilstate = PyGILState_Ensure(); *pygilstate = PyGILState_Ensure();
#endif #endif
if (!(line = GetBufferLine(curbuf, lnum))) /* Check the line number, the command my have deleted lines. */
if (lnum > curbuf->b_ml.ml_line_count
|| !(line = GetBufferLine(curbuf, lnum)))
goto err; goto err;
if (!(linenr = PyInt_FromLong((long) lnum))) if (!(linenr = PyInt_FromLong((long) lnum)))
{ {
@@ -5684,9 +5687,19 @@ run_do(const char *cmd, void *arg UNUSED
if (!ret) if (!ret)
goto err; goto err;
/* Check that the command didn't switch to another buffer. */
if (curbuf != was_curbuf)
{
Py_XDECREF(ret);
goto err;
}
if (ret != Py_None) if (ret != Py_None)
if (SetBufferLine(curbuf, lnum, ret, NULL) == FAIL) if (SetBufferLine(curbuf, lnum, ret, NULL) == FAIL)
{
Py_XDECREF(ret);
goto err; goto err;
}
Py_XDECREF(ret); Py_XDECREF(ret);
PythonIO_Flush(); PythonIO_Flush();

View File

@@ -783,6 +783,7 @@ void ex_rubydo(exarg_T *eap)
{ {
int state; int state;
linenr_T i; linenr_T i;
buf_T *was_curbuf = curbuf;
if (ensure_ruby_initialized()) if (ensure_ruby_initialized())
{ {
@@ -792,6 +793,8 @@ void ex_rubydo(exarg_T *eap)
{ {
VALUE line; VALUE line;
if (i > curbuf->b_ml.ml_line_count)
break;
line = vim_str2rb_enc_str((char *)ml_get(i)); line = vim_str2rb_enc_str((char *)ml_get(i));
rb_lastline_set(line); rb_lastline_set(line);
eval_enc_string_protect((char *) eap->arg, &state); eval_enc_string_protect((char *) eap->arg, &state);
@@ -800,6 +803,8 @@ void ex_rubydo(exarg_T *eap)
error_print(state); error_print(state);
break; break;
} }
if (was_curbuf != curbuf)
break;
line = rb_lastline_get(); line = rb_lastline_get();
if (!NIL_P(line)) if (!NIL_P(line))
{ {

View File

@@ -1958,6 +1958,7 @@ ex_tcldo(exarg_T *eap)
char var_line[VARNAME_SIZE]; char var_line[VARNAME_SIZE];
linenr_T first_line = 0; linenr_T first_line = 0;
linenr_T last_line = 0; linenr_T last_line = 0;
buf_T *was_curbuf = curbuf;
rs = eap->line1; rs = eap->line1;
re = eap->line2; re = eap->line2;
@@ -1979,6 +1980,8 @@ ex_tcldo(exarg_T *eap)
} }
while (err == TCL_OK && rs <= re) while (err == TCL_OK && rs <= re)
{ {
if ((linenr_T)rs > curbuf->b_ml.ml_line_count)
break;
line = (char *)ml_get_buf(curbuf, (linenr_T)rs, FALSE); line = (char *)ml_get_buf(curbuf, (linenr_T)rs, FALSE);
if (!line) if (!line)
{ {
@@ -1994,7 +1997,7 @@ ex_tcldo(exarg_T *eap)
#if (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION >= 5) || TCL_MAJOR_VERSION > 8 #if (TCL_MAJOR_VERSION == 8 && TCL_MINOR_VERSION >= 5) || TCL_MAJOR_VERSION > 8
|| Tcl_LimitExceeded(tclinfo.interp) || Tcl_LimitExceeded(tclinfo.interp)
#endif #endif
) || curbuf != was_curbuf)
break; break;
line = (char *)Tcl_GetVar(tclinfo.interp, var_line, 0); line = (char *)Tcl_GetVar(tclinfo.interp, var_line, 0);
if (line) if (line)

View File

@@ -4453,9 +4453,6 @@ vim_setenv(char_u *name, char_u *val)
{ {
sprintf((char *)envbuf, "%s=%s", name, val); sprintf((char *)envbuf, "%s=%s", name, val);
putenv((char *)envbuf); putenv((char *)envbuf);
# ifdef libintl_putenv
libintl_putenv((char *)envbuf);
# endif
} }
#endif #endif
#ifdef FEAT_GETTEXT #ifdef FEAT_GETTEXT

View File

@@ -2041,6 +2041,8 @@ do_pending_operator(cmdarg_T *cap, int old_col, int gui_yank)
if (restart_edit == 0) if (restart_edit == 0)
restart_edit = restart_edit_save; restart_edit = restart_edit_save;
else
cap->retval |= CA_COMMAND_BUSY;
} }
#else #else
vim_beep(BO_OPER); vim_beep(BO_OPER);

View File

@@ -2571,7 +2571,8 @@ op_insert(oparg_T *oap, long count1)
} }
t1 = oap->start; t1 = oap->start;
edit(NUL, FALSE, (linenr_T)count1); if (edit(NUL, FALSE, (linenr_T)count1))
return;
/* When a tab was inserted, and the characters in front of the tab /* When a tab was inserted, and the characters in front of the tab
* have been converted to a tab as well, the column of the cursor * have been converted to a tab as well, the column of the cursor

View File

@@ -306,10 +306,8 @@ mch_settitle(
* 2: Just restore icon (which we don't have) * 2: Just restore icon (which we don't have)
* 3: Restore title and icon (which we don't have) * 3: Restore title and icon (which we don't have)
*/ */
/*ARGSUSED*/
void void
mch_restore_title( mch_restore_title(int which UNUSED)
int which)
{ {
#ifndef FEAT_GUI_MSWIN #ifndef FEAT_GUI_MSWIN
SetConsoleTitle(g_szOrigTitle); SetConsoleTitle(g_szOrigTitle);
@@ -345,13 +343,12 @@ mch_can_restore_icon(void)
* When 'shellslash' set do it the other way around. * When 'shellslash' set do it the other way around.
* Return OK or FAIL. * Return OK or FAIL.
*/ */
/*ARGSUSED*/
int int
mch_FullName( mch_FullName(
char_u *fname, char_u *fname,
char_u *buf, char_u *buf,
int len, int len,
int force) int force UNUSED)
{ {
int nResult = FAIL; int nResult = FAIL;
@@ -636,9 +633,8 @@ vim_stat(const char *name, stat_T *stp)
} }
#if defined(FEAT_GUI_MSWIN) || defined(PROTO) #if defined(FEAT_GUI_MSWIN) || defined(PROTO)
/*ARGSUSED*/
void void
mch_settmode(int tmode) mch_settmode(int tmode UNUSED)
{ {
/* nothing to do */ /* nothing to do */
} }
@@ -817,10 +813,8 @@ mch_char_avail(void)
/* /*
* set screen mode, always fails. * set screen mode, always fails.
*/ */
/*ARGSUSED*/
int int
mch_screenmode( mch_screenmode(char_u *arg UNUSED)
char_u *arg)
{ {
EMSG(_(e_screenmode)); EMSG(_(e_screenmode));
return FAIL; return FAIL;
@@ -996,10 +990,8 @@ mch_libcall(
/* /*
* Debugging helper: expose the MCH_WRITE_DUMP stuff to other modules * Debugging helper: expose the MCH_WRITE_DUMP stuff to other modules
*/ */
/*ARGSUSED*/
void void
DumpPutS( DumpPutS(const char *psz UNUSED)
const char *psz)
{ {
# ifdef MCH_WRITE_DUMP # ifdef MCH_WRITE_DUMP
if (fdDump) if (fdDump)
@@ -1173,9 +1165,12 @@ swap_me(COLORREF colorref)
# define PDP_RETVAL INT_PTR # define PDP_RETVAL INT_PTR
#endif #endif
/*ARGSUSED*/
static PDP_RETVAL CALLBACK static PDP_RETVAL CALLBACK
PrintDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) PrintDlgProc(
HWND hDlg,
UINT message,
WPARAM wParam UNUSED,
LPARAM lParam UNUSED)
{ {
#ifdef FEAT_GETTEXT #ifdef FEAT_GETTEXT
NONCLIENTMETRICS nm; NONCLIENTMETRICS nm;
@@ -1236,9 +1231,8 @@ PrintDlgProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
return FALSE; return FALSE;
} }
/*ARGSUSED*/
static BOOL CALLBACK static BOOL CALLBACK
AbortProc(HDC hdcPrn, int iCode) AbortProc(HDC hdcPrn UNUSED, int iCode UNUSED)
{ {
MSG msg; MSG msg;
@@ -1683,9 +1677,8 @@ mch_print_begin(prt_settings_T *psettings)
return (ret > 0); return (ret > 0);
} }
/*ARGSUSED*/
void void
mch_print_end(prt_settings_T *psettings) mch_print_end(prt_settings_T *psettings UNUSED)
{ {
EndDoc(prt_dlg.hDC); EndDoc(prt_dlg.hDC);
if (!*bUserAbort) if (!*bUserAbort)
@@ -2764,12 +2757,11 @@ points_to_pixels(char_u *str, char_u **end, int vertical, long_i pprinter_dc)
return pixels; return pixels;
} }
/*ARGSUSED*/
static int CALLBACK static int CALLBACK
font_enumproc( font_enumproc(
ENUMLOGFONT *elf, ENUMLOGFONT *elf,
NEWTEXTMETRIC *ntm, NEWTEXTMETRIC *ntm UNUSED,
int type, int type UNUSED,
LPARAM lparam) LPARAM lparam)
{ {
/* Return value: /* Return value:

View File

@@ -38,13 +38,12 @@ void _cdecl SaveInst(HINSTANCE hInst);
static void (_cdecl *pSaveInst)(HINSTANCE); static void (_cdecl *pSaveInst)(HINSTANCE);
#endif #endif
/*ARGSUSED*/
int WINAPI int WINAPI
WinMain( WinMain(
HINSTANCE hInstance, HINSTANCE hInstance UNUSED,
HINSTANCE hPrevInst, HINSTANCE hPrevInst UNUSED,
LPSTR lpszCmdLine, LPSTR lpszCmdLine,
int nCmdShow) int nCmdShow UNUSED)
{ {
int argc = 0; int argc = 0;
char **argv; char **argv;

View File

@@ -515,6 +515,7 @@ static char *null_libintl_textdomain(const char *);
static char *null_libintl_bindtextdomain(const char *, const char *); static char *null_libintl_bindtextdomain(const char *, const char *);
static char *null_libintl_bind_textdomain_codeset(const char *, const char *); static char *null_libintl_bind_textdomain_codeset(const char *, const char *);
static int null_libintl_putenv(const char *); static int null_libintl_putenv(const char *);
static int null_libintl_wputenv(const wchar_t *);
static HINSTANCE hLibintlDLL = NULL; static HINSTANCE hLibintlDLL = NULL;
char *(*dyn_libintl_gettext)(const char *) = null_libintl_gettext; char *(*dyn_libintl_gettext)(const char *) = null_libintl_gettext;
@@ -526,6 +527,7 @@ char *(*dyn_libintl_bindtextdomain)(const char *, const char *)
char *(*dyn_libintl_bind_textdomain_codeset)(const char *, const char *) char *(*dyn_libintl_bind_textdomain_codeset)(const char *, const char *)
= null_libintl_bind_textdomain_codeset; = null_libintl_bind_textdomain_codeset;
int (*dyn_libintl_putenv)(const char *) = null_libintl_putenv; int (*dyn_libintl_putenv)(const char *) = null_libintl_putenv;
int (*dyn_libintl_wputenv)(const wchar_t *) = null_libintl_wputenv;
int int
dyn_libintl_init(void) dyn_libintl_init(void)
@@ -591,9 +593,14 @@ dyn_libintl_init(void)
/* _putenv() function for the libintl.dll is optional. */ /* _putenv() function for the libintl.dll is optional. */
hmsvcrt = find_imported_module_by_funcname(hLibintlDLL, "getenv"); hmsvcrt = find_imported_module_by_funcname(hLibintlDLL, "getenv");
if (hmsvcrt != NULL) if (hmsvcrt != NULL)
{
dyn_libintl_putenv = (void *)GetProcAddress(hmsvcrt, "_putenv"); dyn_libintl_putenv = (void *)GetProcAddress(hmsvcrt, "_putenv");
if (dyn_libintl_putenv == NULL || dyn_libintl_putenv == putenv) dyn_libintl_wputenv = (void *)GetProcAddress(hmsvcrt, "_wputenv");
}
if (dyn_libintl_putenv == NULL || dyn_libintl_putenv == _putenv)
dyn_libintl_putenv = null_libintl_putenv; dyn_libintl_putenv = null_libintl_putenv;
if (dyn_libintl_wputenv == NULL || dyn_libintl_wputenv == _wputenv)
dyn_libintl_wputenv = null_libintl_wputenv;
return 1; return 1;
} }
@@ -610,16 +617,15 @@ dyn_libintl_end(void)
dyn_libintl_bindtextdomain = null_libintl_bindtextdomain; dyn_libintl_bindtextdomain = null_libintl_bindtextdomain;
dyn_libintl_bind_textdomain_codeset = null_libintl_bind_textdomain_codeset; dyn_libintl_bind_textdomain_codeset = null_libintl_bind_textdomain_codeset;
dyn_libintl_putenv = null_libintl_putenv; dyn_libintl_putenv = null_libintl_putenv;
dyn_libintl_wputenv = null_libintl_wputenv;
} }
/*ARGSUSED*/
static char * static char *
null_libintl_gettext(const char *msgid) null_libintl_gettext(const char *msgid)
{ {
return (char*)msgid; return (char*)msgid;
} }
/*ARGSUSED*/
static char * static char *
null_libintl_ngettext( null_libintl_ngettext(
const char *msgid, const char *msgid,
@@ -629,31 +635,36 @@ null_libintl_ngettext(
return (char *)(n == 1 ? msgid : msgid_plural); return (char *)(n == 1 ? msgid : msgid_plural);
} }
/*ARGSUSED*/
static char * static char *
null_libintl_bindtextdomain(const char *domainname, const char *dirname) null_libintl_bindtextdomain(
const char *domainname UNUSED,
const char *dirname UNUSED)
{ {
return NULL; return NULL;
} }
/*ARGSUSED*/
static char * static char *
null_libintl_bind_textdomain_codeset(const char *domainname, null_libintl_bind_textdomain_codeset(
const char *codeset) const char *domainname UNUSED,
const char *codeset UNUSED)
{ {
return NULL; return NULL;
} }
/*ARGSUSED*/
static char * static char *
null_libintl_textdomain(const char *domainname) null_libintl_textdomain(const char *domainname UNUSED)
{ {
return NULL; return NULL;
} }
/*ARGSUSED*/
int int
null_libintl_putenv(const char *envstring) null_libintl_putenv(const char *envstring UNUSED)
{
return 0;
}
int
null_libintl_wputenv(const wchar_t *envstring UNUSED)
{ {
return 0; return 0;
} }
@@ -1045,9 +1056,8 @@ decode_key_event(
* For the GUI the mouse handling is in gui_w32.c. * For the GUI the mouse handling is in gui_w32.c.
*/ */
# ifdef FEAT_GUI_W32 # ifdef FEAT_GUI_W32
/*ARGSUSED*/
void void
mch_setmouse(int on) mch_setmouse(int on UNUSED)
{ {
} }
# else # else
@@ -1643,13 +1653,12 @@ tgetch(int *pmodifiers, WCHAR *pch2)
* If time == -1, wait forever for characters. * If time == -1, wait forever for characters.
* Returns the number of characters read into buf. * Returns the number of characters read into buf.
*/ */
/*ARGSUSED*/
int int
mch_inchar( mch_inchar(
char_u *buf, char_u *buf UNUSED,
int maxlen, int maxlen UNUSED,
long time, long time UNUSED,
int tb_change_cnt) int tb_change_cnt UNUSED)
{ {
#ifndef FEAT_GUI_W32 /* this isn't used for the GUI */ #ifndef FEAT_GUI_W32 /* this isn't used for the GUI */
@@ -2577,11 +2586,10 @@ mch_exit(int r)
/* /*
* Do we have an interactive window? * Do we have an interactive window?
*/ */
/*ARGSUSED*/
int int
mch_check_win( mch_check_win(
int argc, int argc UNUSED,
char **argv) char **argv UNUSED)
{ {
get_exe_name(); get_exe_name();
@@ -5333,11 +5341,10 @@ termcap_mode_end(void)
#ifdef FEAT_GUI_W32 #ifdef FEAT_GUI_W32
/*ARGSUSED*/
void void
mch_write( mch_write(
char_u *s, char_u *s UNUSED,
int len) int len UNUSED)
{ {
/* never used */ /* never used */
} }
@@ -6035,11 +6042,10 @@ mch_write(
/* /*
* Delay for "msec" milliseconds. * Delay for "msec" milliseconds.
*/ */
/*ARGSUSED*/
void void
mch_delay( mch_delay(
long msec, long msec,
int ignoreinput) int ignoreinput UNUSED)
{ {
#ifdef FEAT_GUI_W32 #ifdef FEAT_GUI_W32
Sleep((int)msec); /* never wait for input */ Sleep((int)msec); /* never wait for input */
@@ -6128,9 +6134,8 @@ mch_breakcheck(int force)
/* /*
* How much main memory in KiB that can be used by VIM. * How much main memory in KiB that can be used by VIM.
*/ */
/*ARGSUSED*/
long_u long_u
mch_total_mem(int special) mch_total_mem(int special UNUSED)
{ {
MEMORYSTATUSEX ms; MEMORYSTATUSEX ms;
@@ -6985,3 +6990,43 @@ fix_arg_enc(void)
set_alist_count(); set_alist_count();
} }
#endif #endif
int
mch_setenv(char *var, char *value, int x)
{
char_u *envbuf;
envbuf = alloc((unsigned)(STRLEN(var) + STRLEN(value) + 2));
if (envbuf == NULL)
return -1;
sprintf((char *)envbuf, "%s=%s", var, value);
#ifdef FEAT_MBYTE
if (enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{
WCHAR *p = enc_to_utf16(envbuf, NULL);
vim_free(envbuf);
if (p == NULL)
return -1;
_wputenv(p);
# ifdef libintl_wputenv
libintl_wputenv(p);
# endif
/* Unlike Un*x systems, we can free the string for _wputenv(). */
vim_free(p);
}
else
#endif
{
_putenv((char *)envbuf);
# ifdef libintl_putenv
libintl_putenv((char *)envbuf);
# endif
/* Unlike Un*x systems, we can free the string for _putenv(). */
vim_free(envbuf);
}
return 0;
}

View File

@@ -202,7 +202,9 @@ Trace(char *pszFormat, ...);
#define ASSERT_NULL_OR_POINTER(p, type) \ #define ASSERT_NULL_OR_POINTER(p, type) \
ASSERT(((p) == NULL) || IsValidAddress((p), sizeof(type), FALSE)) ASSERT(((p) == NULL) || IsValidAddress((p), sizeof(type), FALSE))
#define mch_setenv(name, val, x) setenv(name, val, x) #ifndef HAVE_SETENV
# define HAVE_SETENV
#endif
#define mch_getenv(x) (char_u *)getenv((char *)(x)) #define mch_getenv(x) (char_u *)getenv((char *)(x))
#ifdef __BORLANDC__ #ifdef __BORLANDC__
# define vim_mkdir(x, y) mkdir(x) # define vim_mkdir(x, y) mkdir(x)

View File

@@ -65,4 +65,5 @@ void free_cmd_argsW(void);
void used_file_arg(char *name, int literal, int full_path, int diff_mode); void used_file_arg(char *name, int literal, int full_path, int diff_mode);
void set_alist_count(void); void set_alist_count(void);
void fix_arg_enc(void); void fix_arg_enc(void);
int mch_setenv(char *var, char *value, int x);
/* vim: set ft=c : */ /* vim: set ft=c : */

View File

@@ -824,8 +824,9 @@ update_single_line(win_T *wp, linenr_T lnum)
int j; int j;
/* Don't do anything if the screen structures are (not yet) valid. */ /* Don't do anything if the screen structures are (not yet) valid. */
if (!screen_valid(TRUE)) if (!screen_valid(TRUE) || updating_screen)
return; return;
updating_screen = TRUE;
if (lnum >= wp->w_topline && lnum < wp->w_botline if (lnum >= wp->w_topline && lnum < wp->w_botline
&& foldedCount(wp, lnum, &win_foldinfo) == 0) && foldedCount(wp, lnum, &win_foldinfo) == 0)
@@ -865,13 +866,11 @@ update_single_line(win_T *wp, linenr_T lnum)
# endif # endif
} }
need_cursor_line_redraw = FALSE; need_cursor_line_redraw = FALSE;
updating_screen = FALSE;
} }
#endif #endif
#if defined(FEAT_SIGNS) || defined(FEAT_GUI) #if defined(FEAT_SIGNS) || defined(FEAT_GUI)
static void update_prepare(void);
static void update_finish(void);
/* /*
* Prepare for updating one or more windows. * Prepare for updating one or more windows.
* Caller must check for "updating_screen" already set to avoid recursiveness. * Caller must check for "updating_screen" already set to avoid recursiveness.

View File

@@ -164,6 +164,7 @@ NEW_TESTS = test_arglist.res \
test_job_fails.res \ test_job_fails.res \
test_json.res \ test_json.res \
test_langmap.res \ test_langmap.res \
test_lua.res \
test_man.res \ test_man.res \
test_marks.res \ test_marks.res \
test_matchadd_conceal.res \ test_matchadd_conceal.res \
@@ -172,10 +173,12 @@ NEW_TESTS = test_arglist.res \
test_nested_function.res \ test_nested_function.res \
test_netbeans.res \ test_netbeans.res \
test_normal.res \ test_normal.res \
test_paste.res \
test_packadd.res \ test_packadd.res \
test_paste.res \
test_perl.res \ test_perl.res \
test_profile.res \ test_profile.res \
test_python2.res \
test_python3.res \
test_pyx2.res \ test_pyx2.res \
test_pyx3.res \ test_pyx3.res \
test_quickfix.res \ test_quickfix.res \
@@ -190,6 +193,7 @@ NEW_TESTS = test_arglist.res \
test_substitute.res \ test_substitute.res \
test_syntax.res \ test_syntax.res \
test_system.res \ test_system.res \
test_tcl.res \
test_textobjects.res \ test_textobjects.res \
test_undo.res \ test_undo.res \
test_usercommands.res \ test_usercommands.res \

View File

@@ -78,7 +78,7 @@ test1.out: test1.in
# 200 msec is sufficient, but only modern sleep supports a fraction of # 200 msec is sufficient, but only modern sleep supports a fraction of
# a second, fall back to a second if it fails. # a second, fall back to a second if it fails.
@-/bin/sh -c "sleep .2 > /dev/null 2>&1 || sleep 1" @-/bin/sh -c "sleep .2 > /dev/null 2>&1 || sleep 1"
-$(RUN_VIM) $*.in $(RUN_VIM) $*.in
# For flaky tests retry one time. No tests at the moment. # For flaky tests retry one time. No tests at the moment.
#@/bin/sh -c "if test -f test.out -a $* = test61; then \ #@/bin/sh -c "if test -f test.out -a $* = test61; then \
@@ -108,7 +108,7 @@ bench_re_freeze.out: bench_re_freeze.vim
# 200 msec is sufficient, but only modern sleep supports a fraction of # 200 msec is sufficient, but only modern sleep supports a fraction of
# a second, fall back to a second if it fails. # a second, fall back to a second if it fails.
@-/bin/sh -c "sleep .2 > /dev/null 2>&1 || sleep 1" @-/bin/sh -c "sleep .2 > /dev/null 2>&1 || sleep 1"
-$(RUN_VIM) $*.in $(RUN_VIM) $*.in
@/bin/sh -c "if test -f benchmark.out; then cat benchmark.out; fi" @/bin/sh -c "if test -f benchmark.out; then cat benchmark.out; fi"
nolog: nolog:

View File

@@ -156,6 +156,7 @@ let s:flaky = [
\ 'Test_reltime()', \ 'Test_reltime()',
\ 'Test_nb_basic()', \ 'Test_nb_basic()',
\ 'Test_communicate()', \ 'Test_communicate()',
\ 'Test_close_and_exit_cb()',
\ 'Test_pipe_through_sort_all()', \ 'Test_pipe_through_sort_all()',
\ 'Test_pipe_through_sort_some()' \ 'Test_pipe_through_sort_some()'
\ ] \ ]

View File

@@ -304,4 +304,89 @@ func Test_toupper()
call assert_equal("Ⱥ Ⱦ", toupper("ⱥ ⱦ")) call assert_equal("Ⱥ Ⱦ", toupper("ⱥ ⱦ"))
endfunc endfunc
" Tests for the mode() function
let current_modes = ''
func! Save_mode()
let g:current_modes = mode(0) . '-' . mode(1)
return ''
endfunc
func! Test_mode()
new
call append(0, ["Blue Ball Black", "Brown Band Bowl", ""])
inoremap <F2> <C-R>=Save_mode()<CR>
normal! 3G
exe "normal i\<F2>\<Esc>"
call assert_equal('i-i', g:current_modes)
exe "normal i\<C-G>uBa\<C-P>\<F2>\<Esc>u"
call assert_equal('i-ic', g:current_modes)
exe "normal iBro\<C-P>\<F2>\<Esc>u"
call assert_equal('i-ic', g:current_modes)
exe "normal iBa\<C-X>\<F2>\<Esc>u"
call assert_equal('i-ix', g:current_modes)
exe "normal iBa\<C-X>\<C-P>\<F2>\<Esc>u"
call assert_equal('i-ic', g:current_modes)
exe "normal iBro\<C-X>\<C-P>\<F2>\<Esc>u"
call assert_equal('i-ic', g:current_modes)
exe "normal iBro\<C-X>\<C-P>\<C-P>\<F2>\<Esc>u"
call assert_equal('i-ic', g:current_modes)
exe "normal iCom\<C-P>\<F2>\<Esc>u"
call assert_equal('i-ic', g:current_modes)
exe "normal iCom\<C-X>\<C-P>\<F2>\<Esc>u"
call assert_equal('i-ic', g:current_modes)
exe "normal RBa\<C-P>\<F2>\<Esc>u"
call assert_equal('R-Rc', g:current_modes)
exe "normal RBro\<C-P>\<F2>\<Esc>u"
call assert_equal('R-Rc', g:current_modes)
exe "normal RBa\<C-X>\<F2>\<Esc>u"
call assert_equal('R-Rx', g:current_modes)
exe "normal RBa\<C-X>\<C-P>\<F2>\<Esc>u"
call assert_equal('R-Rc', g:current_modes)
exe "normal RBro\<C-X>\<C-P>\<F2>\<Esc>u"
call assert_equal('R-Rc', g:current_modes)
exe "normal RBro\<C-X>\<C-P>\<C-P>\<F2>\<Esc>u"
call assert_equal('R-Rc', g:current_modes)
exe "normal RCom\<C-P>\<F2>\<Esc>u"
call assert_equal('R-Rc', g:current_modes)
exe "normal RCom\<C-X>\<C-P>\<F2>\<Esc>u"
call assert_equal('R-Rc', g:current_modes)
call assert_equal('n', mode(0))
call assert_equal('n', mode(1))
" How to test operator-pending mode?
call feedkeys("v", 'xt')
call assert_equal('v', mode())
call assert_equal('v', mode(1))
call feedkeys("\<Esc>V", 'xt')
call assert_equal('V', mode())
call assert_equal('V', mode(1))
call feedkeys("\<Esc>\<C-V>", 'xt')
call assert_equal("\<C-V>", mode())
call assert_equal("\<C-V>", mode(1))
call feedkeys("\<Esc>", 'xt')
call feedkeys("gh", 'xt')
call assert_equal('s', mode())
call assert_equal('s', mode(1))
call feedkeys("\<Esc>gH", 'xt')
call assert_equal('S', mode())
call assert_equal('S', mode(1))
call feedkeys("\<Esc>g\<C-H>", 'xt')
call assert_equal("\<C-S>", mode())
call assert_equal("\<C-S>", mode(1))
call feedkeys("\<Esc>", 'xt')
call feedkeys(":echo \<C-R>=Save_mode()\<C-U>\<CR>", 'xt')
call assert_equal('c-c', g:current_modes)
call feedkeys("gQecho \<C-R>=Save_mode()\<CR>\<CR>vi\<CR>", 'xt')
call assert_equal('c-cv', g:current_modes)
" How to test Ex mode?
bwipe!
iunmap <F2>
endfunc

View File

@@ -10,7 +10,12 @@ func SetUp()
set guifont=Courier\ 10\ Pitch/8/-1/5/50/0/0/0/0/0 set guifont=Courier\ 10\ Pitch/8/-1/5/50/0/0/0/0/0
endif endif
" Gnome insists on creating $HOME/.gnome2/.. " Gnome insists on creating $HOME/.gnome2/, set $HOME to avoid changing the
" actual home directory. But avoid triggering fontconfig by setting the
" cache directory. Only needed for Unix.
if $XDG_CACHE_HOME == '' && exists('g:tester_HOME')
let $XDG_CACHE_HOME = g:tester_HOME . '/.cache'
endif
call mkdir('Xhome') call mkdir('Xhome')
let $HOME = fnamemodify('Xhome', ':p') let $HOME = fnamemodify('Xhome', ':p')
endfunc endfunc

22
src/testdir/test_lua.vim Normal file
View File

@@ -0,0 +1,22 @@
" Tests for Lua.
" TODO: move tests from test85.in here.
if !has('lua')
finish
endif
func Test_luado()
new
call setline(1, ['one', 'two', 'three'])
luado vim.command("%d_")
bwipe!
" Check switching to another buffer does not trigger ml_get error.
new
let wincount = winnr('$')
call setline(1, ['one', 'two', 'three'])
luado vim.command("new")
call assert_equal(wincount + 1, winnr('$'))
bwipe!
bwipe!
endfunc

View File

@@ -110,6 +110,8 @@ func Test_map_langmap()
call feedkeys(":call append(line('$'), '+')\<CR>", "xt") call feedkeys(":call append(line('$'), '+')\<CR>", "xt")
call assert_equal('+', getline('$')) call assert_equal('+', getline('$'))
iunmap a
iunmap c
set nomodified set nomodified
endfunc endfunc
@@ -120,7 +122,7 @@ func Test_map_feedkeys()
$-1 $-1
call feedkeys("0qqdw.ifoo\<Esc>qj0@q\<Esc>", "xt") call feedkeys("0qqdw.ifoo\<Esc>qj0@q\<Esc>", "xt")
call assert_equal(['fooc d', 'fooc d'], getline(line('$') - 1, line('$'))) call assert_equal(['fooc d', 'fooc d'], getline(line('$') - 1, line('$')))
unmap . nunmap .
set nomodified set nomodified
endfunc endfunc

View File

@@ -82,6 +82,21 @@ function Test_perldo()
1 1
call assert_false(search('\Cperl')) call assert_false(search('\Cperl'))
bw! bw!
" Check deleting lines does not trigger ml_get error.
new
call setline(1, ['one', 'two', 'three'])
perldo VIM::DoCommand("%d_")
bwipe!
" Check switching to another buffer does not trigger ml_get error.
new
let wincount = winnr('$')
call setline(1, ['one', 'two', 'three'])
perldo VIM::DoCommand("new")
call assert_equal(wincount + 1, winnr('$'))
bwipe!
bwipe!
endfunc endfunc
function Test_VIM_package() function Test_VIM_package()

View File

@@ -0,0 +1,24 @@
" Test for python 2 commands.
" TODO: move tests from test87.in here.
if !has('python')
finish
endif
func Test_pydo()
" Check deleting lines does not trigger ml_get error.
py import vim
new
call setline(1, ['one', 'two', 'three'])
pydo vim.command("%d_")
bwipe!
" Check switching to another buffer does not trigger ml_get error.
new
let wincount = winnr('$')
call setline(1, ['one', 'two', 'three'])
pydo vim.command("new")
call assert_equal(wincount + 1, winnr('$'))
bwipe!
bwipe!
endfunc

View File

@@ -0,0 +1,24 @@
" Test for python 2 commands.
" TODO: move tests from test88.in here.
if !has('python3')
finish
endif
func Test_py3do()
" Check deleting lines does not trigger an ml_get error.
py3 import vim
new
call setline(1, ['one', 'two', 'three'])
py3do vim.command("%d_")
bwipe!
" Check switching to another buffer does not trigger an ml_get error.
new
let wincount = winnr('$')
call setline(1, ['one', 'two', 'three'])
py3do vim.command("new")
call assert_equal(wincount + 1, winnr('$'))
bwipe!
bwipe!
endfunc

View File

@@ -32,3 +32,20 @@ func Test_ruby_evaluate_dict()
redir END redir END
call assert_equal(['{"a"=>"foo", "b"=>123}'], split(l:out, "\n")) call assert_equal(['{"a"=>"foo", "b"=>123}'], split(l:out, "\n"))
endfunc endfunc
func Test_rubydo()
" Check deleting lines does not trigger ml_get error.
new
call setline(1, ['one', 'two', 'three'])
rubydo Vim.command("%d_")
bwipe!
" Check switching to another buffer does not trigger ml_get error.
new
let wincount = winnr('$')
call setline(1, ['one', 'two', 'three'])
rubydo Vim.command("new")
call assert_equal(wincount + 1, winnr('$'))
bwipe!
bwipe!
endfunc

23
src/testdir/test_tcl.vim Normal file
View File

@@ -0,0 +1,23 @@
" Tests for the Tcl interface.
if !has('tcl')
finish
end
function Test_tcldo()
" Check deleting lines does not trigger ml_get error.
new
call setline(1, ['one', 'two', 'three'])
tcldo ::vim::command %d_
bwipe!
" Check switching to another buffer does not trigger ml_get error.
new
let wincount = winnr('$')
call setline(1, ['one', 'two', 'three'])
tcldo ::vim::command new
call assert_equal(wincount + 1, winnr('$'))
bwipe!
bwipe!
endfunc

View File

@@ -2,4 +2,9 @@
" Always use "sh", don't use the value of "$SHELL". " Always use "sh", don't use the value of "$SHELL".
set shell=sh set shell=sh
" While some tests overwrite $HOME to prevent them from polluting user files,
" we need to remember the original value so that we can tell external systems
" where to ask about their own user settings.
let g:tester_HOME = $HOME
source setup.vim source setup.vim

View File

@@ -363,12 +363,19 @@ ui_breakcheck(void)
void void
ui_breakcheck_force(int force) ui_breakcheck_force(int force)
{ {
int save_us = updating_screen;
/* We do not want gui_resize_shell() to redraw the screen here. */
++updating_screen;
#ifdef FEAT_GUI #ifdef FEAT_GUI
if (gui.in_use) if (gui.in_use)
gui_mch_update(); gui_mch_update();
else else
#endif #endif
mch_breakcheck(force); mch_breakcheck(force);
updating_screen = save_us;
} }
/***************************************************************************** /*****************************************************************************

View File

@@ -764,6 +764,46 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
283,
/**/
282,
/**/
281,
/**/
280,
/**/
279,
/**/
278,
/**/
277,
/**/
276,
/**/
275,
/**/
274,
/**/
273,
/**/
272,
/**/
271,
/**/
270,
/**/
269,
/**/
268,
/**/
267,
/**/
266,
/**/
265,
/**/
264,
/**/ /**/
263, 263,
/**/ /**/

View File

@@ -594,6 +594,7 @@ extern int (*dyn_libintl_putenv)(const char *envstring);
# endif # endif
# define textdomain(domain) (*dyn_libintl_textdomain)(domain) # define textdomain(domain) (*dyn_libintl_textdomain)(domain)
# define libintl_putenv(envstring) (*dyn_libintl_putenv)(envstring) # define libintl_putenv(envstring) (*dyn_libintl_putenv)(envstring)
# define libintl_wputenv(envstring) (*dyn_libintl_wputenv)(envstring)
# else # else
# include <libintl.h> # include <libintl.h>
# define _(x) gettext((char *)(x)) # define _(x) gettext((char *)(x))

View File

@@ -10,7 +10,7 @@
/* /*
* winclip.c * winclip.c
* *
* Routines common to both Win16 and Win32 for clipboard handling. * Routines for Win32 clipboard handling.
* Also used by Cygwin, using os_unix.c. * Also used by Cygwin, using os_unix.c.
*/ */
@@ -214,9 +214,8 @@ typedef struct
/* /*
* Make vim the owner of the current selection. Return OK upon success. * Make vim the owner of the current selection. Return OK upon success.
*/ */
/*ARGSUSED*/
int int
clip_mch_own_selection(VimClipboard *cbd) clip_mch_own_selection(VimClipboard *cbd UNUSED)
{ {
/* /*
* Never actually own the clipboard. If another application sets the * Never actually own the clipboard. If another application sets the
@@ -228,9 +227,8 @@ clip_mch_own_selection(VimClipboard *cbd)
/* /*
* Make vim NOT the owner of the current selection. * Make vim NOT the owner of the current selection.
*/ */
/*ARGSUSED*/
void void
clip_mch_lose_selection(VimClipboard *cbd) clip_mch_lose_selection(VimClipboard *cbd UNUSED)
{ {
/* Nothing needs to be done here */ /* Nothing needs to be done here */
} }