mirror of
https://github.com/vim/vim.git
synced 2025-07-26 11:04:33 -04:00
patch 9.0.1208: code is indented more than necessary
Problem: Code is indented more than necessary. Solution: Use an early return where it makes sense. (Yegappan Lakshmanan, closes #11819)
This commit is contained in:
parent
450c7a97d1
commit
a41e221935
@ -938,13 +938,13 @@ nb_partialremove(linenr_T lnum, colnr_T first, colnr_T last)
|
|||||||
if (lastbyte >= oldlen)
|
if (lastbyte >= oldlen)
|
||||||
lastbyte = oldlen - 1;
|
lastbyte = oldlen - 1;
|
||||||
newtext = alloc(oldlen - (int)(lastbyte - first));
|
newtext = alloc(oldlen - (int)(lastbyte - first));
|
||||||
if (newtext != NULL)
|
if (newtext == NULL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
mch_memmove(newtext, oldtext, first);
|
mch_memmove(newtext, oldtext, first);
|
||||||
STRMOVE(newtext + first, oldtext + lastbyte + 1);
|
STRMOVE(newtext + first, oldtext + lastbyte + 1);
|
||||||
nbdebug((" NEW LINE %ld: %s\n", lnum, newtext));
|
nbdebug((" NEW LINE %ld: %s\n", lnum, newtext));
|
||||||
ml_replace(lnum, newtext, FALSE);
|
ml_replace(lnum, newtext, FALSE);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -960,12 +960,12 @@ nb_joinlines(linenr_T first, linenr_T other)
|
|||||||
len_first = (int)STRLEN(ml_get(first));
|
len_first = (int)STRLEN(ml_get(first));
|
||||||
len_other = (int)STRLEN(ml_get(other));
|
len_other = (int)STRLEN(ml_get(other));
|
||||||
p = alloc(len_first + len_other + 1);
|
p = alloc(len_first + len_other + 1);
|
||||||
if (p != NULL)
|
if (p == NULL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
mch_memmove(p, ml_get(first), len_first);
|
mch_memmove(p, ml_get(first), len_first);
|
||||||
mch_memmove(p + len_first, ml_get(other), len_other + 1);
|
mch_memmove(p + len_first, ml_get(other), len_other + 1);
|
||||||
ml_replace(first, p, FALSE);
|
ml_replace(first, p, FALSE);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SKIP_STOP 2
|
#define SKIP_STOP 2
|
||||||
@ -2247,13 +2247,14 @@ nb_do_cmd(
|
|||||||
static void
|
static void
|
||||||
nb_set_curbuf(buf_T *buf)
|
nb_set_curbuf(buf_T *buf)
|
||||||
{
|
{
|
||||||
if (curbuf != buf) {
|
if (curbuf == buf)
|
||||||
|
return;
|
||||||
|
|
||||||
if (buf_jump_open_win(buf) != NULL)
|
if (buf_jump_open_win(buf) != NULL)
|
||||||
return;
|
return;
|
||||||
if ((swb_flags & SWB_USETAB) && buf_jump_open_tab(buf) != NULL)
|
if ((swb_flags & SWB_USETAB) && buf_jump_open_tab(buf) != NULL)
|
||||||
return;
|
return;
|
||||||
set_curbuf(buf, DOBUF_GOTO);
|
set_curbuf(buf, DOBUF_GOTO);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2364,14 +2365,14 @@ nb_init_graphics(void)
|
|||||||
{
|
{
|
||||||
static int did_init = FALSE;
|
static int did_init = FALSE;
|
||||||
|
|
||||||
if (!did_init)
|
if (did_init)
|
||||||
{
|
return;
|
||||||
|
|
||||||
coloncmd(":highlight NBGuarded guibg=Cyan guifg=Black"
|
coloncmd(":highlight NBGuarded guibg=Cyan guifg=Black"
|
||||||
" ctermbg=LightCyan ctermfg=Black");
|
" ctermbg=LightCyan ctermfg=Black");
|
||||||
coloncmd(":sign define %d linehl=NBGuarded", GUARDED);
|
coloncmd(":sign define %d linehl=NBGuarded", GUARDED);
|
||||||
|
|
||||||
did_init = TRUE;
|
did_init = TRUE;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2468,8 +2469,9 @@ netbeans_beval_cb(
|
|||||||
if (!can_use_beval() || !NETBEANS_OPEN)
|
if (!can_use_beval() || !NETBEANS_OPEN)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (get_beval_info(beval, TRUE, &wp, &lnum, &text, &col) == OK)
|
if (get_beval_info(beval, TRUE, &wp, &lnum, &text, &col) != OK)
|
||||||
{
|
return;
|
||||||
|
|
||||||
// Send debugger request. Only when the text is of reasonable
|
// Send debugger request. Only when the text is of reasonable
|
||||||
// length.
|
// length.
|
||||||
if (text != NULL && text[0] != NUL && STRLEN(text) < MAXPATHL)
|
if (text != NULL && text[0] != NUL && STRLEN(text) < MAXPATHL)
|
||||||
@ -2490,7 +2492,6 @@ netbeans_beval_cb(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
vim_free(text);
|
vim_free(text);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2555,12 +2556,12 @@ set_ref_in_nb_channel(int copyID)
|
|||||||
int abort = FALSE;
|
int abort = FALSE;
|
||||||
typval_T tv;
|
typval_T tv;
|
||||||
|
|
||||||
if (nb_channel != NULL)
|
if (nb_channel == NULL)
|
||||||
{
|
return FALSE;
|
||||||
|
|
||||||
tv.v_type = VAR_CHANNEL;
|
tv.v_type = VAR_CHANNEL;
|
||||||
tv.vval.v_channel = nb_channel;
|
tv.vval.v_channel = nb_channel;
|
||||||
abort = set_ref_in_item(&tv, copyID, NULL, NULL);
|
abort = set_ref_in_item(&tv, copyID, NULL, NULL);
|
||||||
}
|
|
||||||
return abort;
|
return abort;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -2827,8 +2828,9 @@ netbeans_button_release(int button)
|
|||||||
|
|
||||||
bufno = nb_getbufno(curbuf);
|
bufno = nb_getbufno(curbuf);
|
||||||
|
|
||||||
if (bufno >= 0 && curwin != NULL && curwin->w_buffer == curbuf)
|
if (bufno < 0 || curwin == NULL || curwin->w_buffer != curbuf)
|
||||||
{
|
return;
|
||||||
|
|
||||||
int col = mouse_col - curwin->w_wincol
|
int col = mouse_col - curwin->w_wincol
|
||||||
- ((curwin->w_p_nu || curwin->w_p_rnu) ? 9 : 1);
|
- ((curwin->w_p_nu || curwin->w_p_rnu) ? 9 : 1);
|
||||||
long off = pos2off(curbuf, &curwin->w_cursor);
|
long off = pos2off(curbuf, &curwin->w_cursor);
|
||||||
@ -2842,7 +2844,6 @@ netbeans_button_release(int button)
|
|||||||
button, (long)curwin->w_cursor.lnum, col);
|
button, (long)curwin->w_cursor.lnum, col);
|
||||||
nbdebug(("EVT: %s", buf));
|
nbdebug(("EVT: %s", buf));
|
||||||
nb_send(buf, "netbeans_button_release");
|
nb_send(buf, "netbeans_button_release");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3308,8 +3309,7 @@ get_buf_size(buf_T *bufp)
|
|||||||
|
|
||||||
if (bufp->b_ml.ml_flags & ML_EMPTY)
|
if (bufp->b_ml.ml_flags & ML_EMPTY)
|
||||||
return 0;
|
return 0;
|
||||||
else
|
|
||||||
{
|
|
||||||
if (get_fileformat(bufp) == EOL_DOS)
|
if (get_fileformat(bufp) == EOL_DOS)
|
||||||
eol_size = 2;
|
eol_size = 2;
|
||||||
else
|
else
|
||||||
@ -3330,7 +3330,6 @@ get_buf_size(buf_T *bufp)
|
|||||||
// Correction for when last line doesn't have an EOL.
|
// Correction for when last line doesn't have an EOL.
|
||||||
if (!bufp->b_p_eol && (bufp->b_p_bin || !bufp->b_p_fixeol))
|
if (!bufp->b_p_eol && (bufp->b_p_bin || !bufp->b_p_fixeol))
|
||||||
char_count -= eol_size;
|
char_count -= eol_size;
|
||||||
}
|
|
||||||
|
|
||||||
return char_count;
|
return char_count;
|
||||||
}
|
}
|
||||||
@ -3393,12 +3392,12 @@ pos2off(buf_T *buf, pos_T *pos)
|
|||||||
{
|
{
|
||||||
long offset = 0;
|
long offset = 0;
|
||||||
|
|
||||||
if (!(buf->b_ml.ml_flags & ML_EMPTY))
|
if (buf->b_ml.ml_flags & ML_EMPTY)
|
||||||
{
|
return 0;
|
||||||
|
|
||||||
if ((offset = ml_find_line_or_offset(buf, pos->lnum, 0)) < 0)
|
if ((offset = ml_find_line_or_offset(buf, pos->lnum, 0)) < 0)
|
||||||
return 0;
|
return 0;
|
||||||
offset += pos->col;
|
offset += pos->col;
|
||||||
}
|
|
||||||
|
|
||||||
return offset;
|
return offset;
|
||||||
}
|
}
|
||||||
|
158
src/normal.c
158
src/normal.c
@ -186,14 +186,13 @@ find_command(int cmdchar)
|
|||||||
static int
|
static int
|
||||||
check_text_locked(oparg_T *oap)
|
check_text_locked(oparg_T *oap)
|
||||||
{
|
{
|
||||||
if (text_locked())
|
if (!text_locked())
|
||||||
{
|
return FALSE;
|
||||||
|
|
||||||
if (oap != NULL)
|
if (oap != NULL)
|
||||||
clearopbeep(oap);
|
clearopbeep(oap);
|
||||||
text_locked_msg();
|
text_locked_msg();
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -206,13 +205,13 @@ check_text_or_curbuf_locked(oparg_T *oap)
|
|||||||
{
|
{
|
||||||
if (check_text_locked(oap))
|
if (check_text_locked(oap))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
if (curbuf_locked())
|
|
||||||
{
|
if (!curbuf_locked())
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
if (oap != NULL)
|
if (oap != NULL)
|
||||||
clearop(oap);
|
clearop(oap);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2030,8 +2029,9 @@ nv_addsub(cmdarg_T *cap)
|
|||||||
static void
|
static void
|
||||||
nv_page(cmdarg_T *cap)
|
nv_page(cmdarg_T *cap)
|
||||||
{
|
{
|
||||||
if (!checkclearop(cap->oap))
|
if (checkclearop(cap->oap))
|
||||||
{
|
return;
|
||||||
|
|
||||||
if (mod_mask & MOD_MASK_CTRL)
|
if (mod_mask & MOD_MASK_CTRL)
|
||||||
{
|
{
|
||||||
// <C-PageUp>: tab page back; <C-PageDown>: tab page forward
|
// <C-PageUp>: tab page back; <C-PageDown>: tab page forward
|
||||||
@ -2042,7 +2042,6 @@ nv_page(cmdarg_T *cap)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
(void)onepage(cap->arg, cap->count1);
|
(void)onepage(cap->arg, cap->count1);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2062,9 +2061,9 @@ nv_gd(
|
|||||||
== FAIL)
|
== FAIL)
|
||||||
{
|
{
|
||||||
clearopbeep(oap);
|
clearopbeep(oap);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
#ifdef FEAT_FOLDING
|
#ifdef FEAT_FOLDING
|
||||||
if ((fdo_flags & FDO_SEARCH) && KeyTyped && oap->op_type == OP_NOP)
|
if ((fdo_flags & FDO_SEARCH) && KeyTyped && oap->op_type == OP_NOP)
|
||||||
foldOpenCursor();
|
foldOpenCursor();
|
||||||
@ -2072,7 +2071,6 @@ nv_gd(
|
|||||||
// clear any search statistics
|
// clear any search statistics
|
||||||
if (messaging() && !msg_silent && !shortmess(SHM_SEARCHCOUNT))
|
if (messaging() && !msg_silent && !shortmess(SHM_SEARCHCOUNT))
|
||||||
clear_cmdline = TRUE;
|
clear_cmdline = TRUE;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -3157,9 +3155,11 @@ nv_colon(cmdarg_T *cap)
|
|||||||
int flags;
|
int flags;
|
||||||
|
|
||||||
if (VIsual_active && !is_cmdkey)
|
if (VIsual_active && !is_cmdkey)
|
||||||
nv_operator(cap);
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
nv_operator(cap);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (cap->oap->op_type != OP_NOP)
|
if (cap->oap->op_type != OP_NOP)
|
||||||
{
|
{
|
||||||
// Using ":" as a movement is characterwise exclusive.
|
// Using ":" as a movement is characterwise exclusive.
|
||||||
@ -3210,7 +3210,6 @@ nv_colon(cmdarg_T *cap)
|
|||||||
))
|
))
|
||||||
// The start of the operator has become invalid by the Ex command.
|
// The start of the operator has become invalid by the Ex command.
|
||||||
clearopbeep(cap->oap);
|
clearopbeep(cap->oap);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -3251,8 +3250,9 @@ nv_ctrlh(cmdarg_T *cap)
|
|||||||
static void
|
static void
|
||||||
nv_clear(cmdarg_T *cap)
|
nv_clear(cmdarg_T *cap)
|
||||||
{
|
{
|
||||||
if (!checkclearop(cap->oap))
|
if (checkclearop(cap->oap))
|
||||||
{
|
return;
|
||||||
|
|
||||||
#ifdef FEAT_SYN_HL
|
#ifdef FEAT_SYN_HL
|
||||||
// Clear all syntax states to force resyncing.
|
// Clear all syntax states to force resyncing.
|
||||||
syn_stack_free_all(curwin->w_s);
|
syn_stack_free_all(curwin->w_s);
|
||||||
@ -3272,7 +3272,6 @@ nv_clear(cmdarg_T *cap)
|
|||||||
# endif
|
# endif
|
||||||
resize_console_buf();
|
resize_console_buf();
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -3314,8 +3313,9 @@ nv_hat(cmdarg_T *cap)
|
|||||||
static void
|
static void
|
||||||
nv_Zet(cmdarg_T *cap)
|
nv_Zet(cmdarg_T *cap)
|
||||||
{
|
{
|
||||||
if (!checkclearopq(cap->oap))
|
if (checkclearopq(cap->oap))
|
||||||
{
|
return;
|
||||||
|
|
||||||
switch (cap->nchar)
|
switch (cap->nchar)
|
||||||
{
|
{
|
||||||
// "ZZ": equivalent to ":x".
|
// "ZZ": equivalent to ":x".
|
||||||
@ -3328,7 +3328,6 @@ nv_Zet(cmdarg_T *cap)
|
|||||||
|
|
||||||
default: clearopbeep(cap->oap);
|
default: clearopbeep(cap->oap);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -3982,15 +3981,14 @@ nv_up(cmdarg_T *cap)
|
|||||||
// <S-Up> is page up
|
// <S-Up> is page up
|
||||||
cap->arg = BACKWARD;
|
cap->arg = BACKWARD;
|
||||||
nv_page(cap);
|
nv_page(cap);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
cap->oap->motion_type = MLINE;
|
cap->oap->motion_type = MLINE;
|
||||||
if (cursor_up(cap->count1, cap->oap->op_type == OP_NOP) == FAIL)
|
if (cursor_up(cap->count1, cap->oap->op_type == OP_NOP) == FAIL)
|
||||||
clearopbeep(cap->oap);
|
clearopbeep(cap->oap);
|
||||||
else if (cap->arg)
|
else if (cap->arg)
|
||||||
beginline(BL_WHITE | BL_FIX);
|
beginline(BL_WHITE | BL_FIX);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -4249,9 +4247,11 @@ nv_csearch(cmdarg_T *cap)
|
|||||||
|
|
||||||
cap->oap->motion_type = MCHAR;
|
cap->oap->motion_type = MCHAR;
|
||||||
if (IS_SPECIAL(cap->nchar) || searchc(cap, t_cmd) == FAIL)
|
if (IS_SPECIAL(cap->nchar) || searchc(cap, t_cmd) == FAIL)
|
||||||
clearopbeep(cap->oap);
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
clearopbeep(cap->oap);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
curwin->w_set_curswant = TRUE;
|
curwin->w_set_curswant = TRUE;
|
||||||
// Include a Tab for "tx" and for "dfx".
|
// Include a Tab for "tx" and for "dfx".
|
||||||
if (gchar_cursor() == TAB && virtual_active() && cap->arg == FORWARD
|
if (gchar_cursor() == TAB && virtual_active() && cap->arg == FORWARD
|
||||||
@ -4269,7 +4269,6 @@ nv_csearch(cmdarg_T *cap)
|
|||||||
if ((fdo_flags & FDO_HOR) && KeyTyped && cap->oap->op_type == OP_NOP)
|
if ((fdo_flags & FDO_HOR) && KeyTyped && cap->oap->op_type == OP_NOP)
|
||||||
foldOpenCursor();
|
foldOpenCursor();
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -4654,9 +4653,11 @@ nv_brace(cmdarg_T *cap)
|
|||||||
curwin->w_set_curswant = TRUE;
|
curwin->w_set_curswant = TRUE;
|
||||||
|
|
||||||
if (findsent(cap->arg, cap->count1) == FAIL)
|
if (findsent(cap->arg, cap->count1) == FAIL)
|
||||||
clearopbeep(cap->oap);
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
clearopbeep(cap->oap);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Don't leave the cursor on the NUL past end of line.
|
// Don't leave the cursor on the NUL past end of line.
|
||||||
adjust_cursor(cap->oap);
|
adjust_cursor(cap->oap);
|
||||||
curwin->w_cursor.coladd = 0;
|
curwin->w_cursor.coladd = 0;
|
||||||
@ -4664,7 +4665,6 @@ nv_brace(cmdarg_T *cap)
|
|||||||
if ((fdo_flags & FDO_BLOCK) && KeyTyped && cap->oap->op_type == OP_NOP)
|
if ((fdo_flags & FDO_BLOCK) && KeyTyped && cap->oap->op_type == OP_NOP)
|
||||||
foldOpenCursor();
|
foldOpenCursor();
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -4673,11 +4673,11 @@ nv_brace(cmdarg_T *cap)
|
|||||||
static void
|
static void
|
||||||
nv_mark(cmdarg_T *cap)
|
nv_mark(cmdarg_T *cap)
|
||||||
{
|
{
|
||||||
if (!checkclearop(cap->oap))
|
if (checkclearop(cap->oap))
|
||||||
{
|
return;
|
||||||
|
|
||||||
if (setmark(cap->nchar) == FAIL)
|
if (setmark(cap->nchar) == FAIL)
|
||||||
clearopbeep(cap->oap);
|
clearopbeep(cap->oap);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -4692,15 +4692,16 @@ nv_findpar(cmdarg_T *cap)
|
|||||||
cap->oap->use_reg_one = TRUE;
|
cap->oap->use_reg_one = TRUE;
|
||||||
curwin->w_set_curswant = TRUE;
|
curwin->w_set_curswant = TRUE;
|
||||||
if (!findpar(&cap->oap->inclusive, cap->arg, cap->count1, NUL, FALSE))
|
if (!findpar(&cap->oap->inclusive, cap->arg, cap->count1, NUL, FALSE))
|
||||||
clearopbeep(cap->oap);
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
|
clearopbeep(cap->oap);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
curwin->w_cursor.coladd = 0;
|
curwin->w_cursor.coladd = 0;
|
||||||
#ifdef FEAT_FOLDING
|
#ifdef FEAT_FOLDING
|
||||||
if ((fdo_flags & FDO_BLOCK) && KeyTyped && cap->oap->op_type == OP_NOP)
|
if ((fdo_flags & FDO_BLOCK) && KeyTyped && cap->oap->op_type == OP_NOP)
|
||||||
foldOpenCursor();
|
foldOpenCursor();
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -4726,8 +4727,9 @@ nv_undo(cmdarg_T *cap)
|
|||||||
static void
|
static void
|
||||||
nv_kundo(cmdarg_T *cap)
|
nv_kundo(cmdarg_T *cap)
|
||||||
{
|
{
|
||||||
if (!checkclearopq(cap->oap))
|
if (checkclearopq(cap->oap))
|
||||||
{
|
return;
|
||||||
|
|
||||||
#ifdef FEAT_JOB_CHANNEL
|
#ifdef FEAT_JOB_CHANNEL
|
||||||
if (bt_prompt(curbuf))
|
if (bt_prompt(curbuf))
|
||||||
{
|
{
|
||||||
@ -4737,7 +4739,6 @@ nv_kundo(cmdarg_T *cap)
|
|||||||
#endif
|
#endif
|
||||||
u_undo((int)cap->count1);
|
u_undo((int)cap->count1);
|
||||||
curwin->w_set_curswant = TRUE;
|
curwin->w_set_curswant = TRUE;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -5008,9 +5009,12 @@ nv_Replace(cmdarg_T *cap)
|
|||||||
VIsual_mode_orig = VIsual_mode; // remember original area for gv
|
VIsual_mode_orig = VIsual_mode; // remember original area for gv
|
||||||
VIsual_mode = 'V';
|
VIsual_mode = 'V';
|
||||||
nv_operator(cap);
|
nv_operator(cap);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if (!checkclearopq(cap->oap))
|
|
||||||
{
|
if (checkclearopq(cap->oap))
|
||||||
|
return;
|
||||||
|
|
||||||
if (!curbuf->b_p_ma)
|
if (!curbuf->b_p_ma)
|
||||||
emsg(_(e_cannot_make_changes_modifiable_is_off));
|
emsg(_(e_cannot_make_changes_modifiable_is_off));
|
||||||
else
|
else
|
||||||
@ -5019,7 +5023,6 @@ nv_Replace(cmdarg_T *cap)
|
|||||||
coladvance(getviscol());
|
coladvance(getviscol());
|
||||||
invoke_edit(cap, FALSE, cap->arg ? 'V' : 'R', FALSE);
|
invoke_edit(cap, FALSE, cap->arg ? 'V' : 'R', FALSE);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -5033,9 +5036,12 @@ nv_vreplace(cmdarg_T *cap)
|
|||||||
cap->cmdchar = 'r';
|
cap->cmdchar = 'r';
|
||||||
cap->nchar = cap->extra_char;
|
cap->nchar = cap->extra_char;
|
||||||
nv_replace(cap); // Do same as "r" in Visual mode for now
|
nv_replace(cap); // Do same as "r" in Visual mode for now
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if (!checkclearopq(cap->oap))
|
|
||||||
{
|
if (checkclearopq(cap->oap))
|
||||||
|
return;
|
||||||
|
|
||||||
if (!curbuf->b_p_ma)
|
if (!curbuf->b_p_ma)
|
||||||
emsg(_(e_cannot_make_changes_modifiable_is_off));
|
emsg(_(e_cannot_make_changes_modifiable_is_off));
|
||||||
else
|
else
|
||||||
@ -5048,7 +5054,6 @@ nv_vreplace(cmdarg_T *cap)
|
|||||||
coladvance(getviscol());
|
coladvance(getviscol());
|
||||||
invoke_edit(cap, TRUE, 'v', FALSE);
|
invoke_edit(cap, TRUE, 'v', FALSE);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -5345,8 +5350,9 @@ nv_pcmark(cmdarg_T *cap)
|
|||||||
int old_KeyTyped = KeyTyped; // getting file may reset it
|
int old_KeyTyped = KeyTyped; // getting file may reset it
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!checkclearopq(cap->oap))
|
if (checkclearopq(cap->oap))
|
||||||
{
|
return;
|
||||||
|
|
||||||
if (cap->cmdchar == TAB && mod_mask == MOD_MASK_CTRL)
|
if (cap->cmdchar == TAB && mod_mask == MOD_MASK_CTRL)
|
||||||
{
|
{
|
||||||
if (goto_tabpage_lastused() == FAIL)
|
if (goto_tabpage_lastused() == FAIL)
|
||||||
@ -5382,7 +5388,6 @@ nv_pcmark(cmdarg_T *cap)
|
|||||||
&& old_KeyTyped)
|
&& old_KeyTyped)
|
||||||
foldOpenCursor();
|
foldOpenCursor();
|
||||||
# endif
|
# endif
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -6237,8 +6242,9 @@ n_opencmd(cmdarg_T *cap)
|
|||||||
linenr_T oldline = curwin->w_cursor.lnum;
|
linenr_T oldline = curwin->w_cursor.lnum;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!checkclearopq(cap->oap))
|
if (checkclearopq(cap->oap))
|
||||||
{
|
return;
|
||||||
|
|
||||||
#ifdef FEAT_FOLDING
|
#ifdef FEAT_FOLDING
|
||||||
if (cap->cmdchar == 'O')
|
if (cap->cmdchar == 'O')
|
||||||
// Open above the first line of a folded sequence of lines
|
// Open above the first line of a folded sequence of lines
|
||||||
@ -6272,7 +6278,6 @@ n_opencmd(cmdarg_T *cap)
|
|||||||
cap->count1 = 1;
|
cap->count1 = 1;
|
||||||
invoke_edit(cap, FALSE, cap->cmdchar, TRUE);
|
invoke_edit(cap, FALSE, cap->cmdchar, TRUE);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -6281,14 +6286,14 @@ n_opencmd(cmdarg_T *cap)
|
|||||||
static void
|
static void
|
||||||
nv_dot(cmdarg_T *cap)
|
nv_dot(cmdarg_T *cap)
|
||||||
{
|
{
|
||||||
if (!checkclearopq(cap->oap))
|
if (checkclearopq(cap->oap))
|
||||||
{
|
return;
|
||||||
|
|
||||||
// If "restart_edit" is TRUE, the last but one command is repeated
|
// If "restart_edit" is TRUE, the last but one command is repeated
|
||||||
// instead of the last command (inserting text). This is used for
|
// instead of the last command (inserting text). This is used for
|
||||||
// CTRL-O <.> in insert mode.
|
// CTRL-O <.> in insert mode.
|
||||||
if (start_redo(cap->count0, restart_edit != 0 && !arrow_used) == FAIL)
|
if (start_redo(cap->count0, restart_edit != 0 && !arrow_used) == FAIL)
|
||||||
clearopbeep(cap->oap);
|
clearopbeep(cap->oap);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -6316,11 +6321,11 @@ nv_redo_or_register(cmdarg_T *cap)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!checkclearopq(cap->oap))
|
if (checkclearopq(cap->oap))
|
||||||
{
|
return;
|
||||||
|
|
||||||
u_redo((int)cap->count1);
|
u_redo((int)cap->count1);
|
||||||
curwin->w_set_curswant = TRUE;
|
curwin->w_set_curswant = TRUE;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -6336,12 +6341,14 @@ nv_Undo(cmdarg_T *cap)
|
|||||||
cap->cmdchar = 'g';
|
cap->cmdchar = 'g';
|
||||||
cap->nchar = 'U';
|
cap->nchar = 'U';
|
||||||
nv_operator(cap);
|
nv_operator(cap);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if (!checkclearopq(cap->oap))
|
|
||||||
{
|
if (checkclearopq(cap->oap))
|
||||||
|
return;
|
||||||
|
|
||||||
u_undoline();
|
u_undoline();
|
||||||
curwin->w_set_curswant = TRUE;
|
curwin->w_set_curswant = TRUE;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -7146,9 +7153,12 @@ nv_record(cmdarg_T *cap)
|
|||||||
cap->cmdchar = 'g';
|
cap->cmdchar = 'g';
|
||||||
cap->nchar = 'q';
|
cap->nchar = 'q';
|
||||||
nv_operator(cap);
|
nv_operator(cap);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
else if (!checkclearop(cap->oap))
|
|
||||||
{
|
if (checkclearop(cap->oap))
|
||||||
|
return;
|
||||||
|
|
||||||
if (cap->nchar == ':' || cap->nchar == '/' || cap->nchar == '?')
|
if (cap->nchar == ':' || cap->nchar == '/' || cap->nchar == '?')
|
||||||
{
|
{
|
||||||
if (cmdwin_type != 0)
|
if (cmdwin_type != 0)
|
||||||
@ -7164,7 +7174,6 @@ nv_record(cmdarg_T *cap)
|
|||||||
// register
|
// register
|
||||||
if (reg_executing == 0 && do_record(cap->nchar) == FAIL)
|
if (reg_executing == 0 && do_record(cap->nchar) == FAIL)
|
||||||
clearopbeep(cap->oap);
|
clearopbeep(cap->oap);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -7214,9 +7223,14 @@ nv_halfpage(cmdarg_T *cap)
|
|||||||
nv_join(cmdarg_T *cap)
|
nv_join(cmdarg_T *cap)
|
||||||
{
|
{
|
||||||
if (VIsual_active) // join the visual lines
|
if (VIsual_active) // join the visual lines
|
||||||
nv_operator(cap);
|
|
||||||
else if (!checkclearop(cap->oap))
|
|
||||||
{
|
{
|
||||||
|
nv_operator(cap);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (checkclearop(cap->oap))
|
||||||
|
return;
|
||||||
|
|
||||||
if (cap->count0 <= 1)
|
if (cap->count0 <= 1)
|
||||||
cap->count0 = 2; // default for join is two lines!
|
cap->count0 = 2; // default for join is two lines!
|
||||||
if (curwin->w_cursor.lnum + cap->count0 - 1 >
|
if (curwin->w_cursor.lnum + cap->count0 - 1 >
|
||||||
@ -7235,7 +7249,6 @@ nv_join(cmdarg_T *cap)
|
|||||||
prep_redo(cap->oap->regname, cap->count0,
|
prep_redo(cap->oap->regname, cap->count0,
|
||||||
NUL, cap->cmdchar, NUL, NUL, cap->nchar);
|
NUL, cap->cmdchar, NUL, NUL, cap->nchar);
|
||||||
(void)do_join(cap->count0, cap->nchar == NUL, TRUE, TRUE, TRUE);
|
(void)do_join(cap->count0, cap->nchar == NUL, TRUE, TRUE, TRUE);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -7274,15 +7287,17 @@ nv_put_opt(cmdarg_T *cap, int fix_indent)
|
|||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
clearopbeep(cap->oap);
|
clearopbeep(cap->oap);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef FEAT_JOB_CHANNEL
|
#ifdef FEAT_JOB_CHANNEL
|
||||||
else if (bt_prompt(curbuf) && !prompt_curpos_editable())
|
if (bt_prompt(curbuf) && !prompt_curpos_editable())
|
||||||
{
|
{
|
||||||
clearopbeep(cap->oap);
|
clearopbeep(cap->oap);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
else
|
|
||||||
{
|
|
||||||
if (fix_indent)
|
if (fix_indent)
|
||||||
{
|
{
|
||||||
dir = (cap->cmdchar == ']' && cap->nchar == 'p')
|
dir = (cap->cmdchar == ']' && cap->nchar == 'p')
|
||||||
@ -7398,7 +7413,6 @@ nv_put_opt(cmdarg_T *cap, int fix_indent)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
auto_format(FALSE, TRUE);
|
auto_format(FALSE, TRUE);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
21
src/ops.c
21
src/ops.c
@ -989,11 +989,11 @@ mb_adjust_opend(oparg_T *oap)
|
|||||||
{
|
{
|
||||||
char_u *p;
|
char_u *p;
|
||||||
|
|
||||||
if (oap->inclusive)
|
if (!oap->inclusive)
|
||||||
{
|
return;
|
||||||
|
|
||||||
p = ml_get(oap->end.lnum);
|
p = ml_get(oap->end.lnum);
|
||||||
oap->end.col += mb_tail_off(p, p + oap->end.col);
|
oap->end.col += mb_tail_off(p, p + oap->end.col);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1869,11 +1869,13 @@ adjust_cursor_eol(void)
|
|||||||
{
|
{
|
||||||
unsigned int cur_ve_flags = get_ve_flags();
|
unsigned int cur_ve_flags = get_ve_flags();
|
||||||
|
|
||||||
if (curwin->w_cursor.col > 0
|
int adj_cursor = (curwin->w_cursor.col > 0
|
||||||
&& gchar_cursor() == NUL
|
&& gchar_cursor() == NUL
|
||||||
&& (cur_ve_flags & VE_ONEMORE) == 0
|
&& (cur_ve_flags & VE_ONEMORE) == 0
|
||||||
&& !(restart_edit || (State & MODE_INSERT)))
|
&& !(restart_edit || (State & MODE_INSERT)));
|
||||||
{
|
if (!adj_cursor)
|
||||||
|
return;
|
||||||
|
|
||||||
// Put the cursor on the last character in the line.
|
// Put the cursor on the last character in the line.
|
||||||
dec_cursor();
|
dec_cursor();
|
||||||
|
|
||||||
@ -1885,7 +1887,6 @@ adjust_cursor_eol(void)
|
|||||||
getvcol(curwin, &curwin->w_cursor, &scol, NULL, &ecol);
|
getvcol(curwin, &curwin->w_cursor, &scol, NULL, &ecol);
|
||||||
curwin->w_cursor.coladd = ecol - scol + 1;
|
curwin->w_cursor.coladd = ecol - scol + 1;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -2235,12 +2236,12 @@ reset_lbr(void)
|
|||||||
static void
|
static void
|
||||||
restore_lbr(int lbr_saved)
|
restore_lbr(int lbr_saved)
|
||||||
{
|
{
|
||||||
if (!curwin->w_p_lbr && lbr_saved)
|
if (curwin->w_p_lbr || !lbr_saved)
|
||||||
{
|
return;
|
||||||
|
|
||||||
// changing 'linebreak' may require w_virtcol to be updated
|
// changing 'linebreak' may require w_virtcol to be updated
|
||||||
curwin->w_p_lbr = TRUE;
|
curwin->w_p_lbr = TRUE;
|
||||||
curwin->w_valid &= ~(VALID_WROW|VALID_WCOL|VALID_VIRTCOL);
|
curwin->w_valid &= ~(VALID_WROW|VALID_WCOL|VALID_VIRTCOL);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
31
src/option.c
31
src/option.c
@ -672,17 +672,17 @@ set_string_default_esc(char *name, char_u *val, int escape)
|
|||||||
p = vim_strsave_escaped(val, (char_u *)" ");
|
p = vim_strsave_escaped(val, (char_u *)" ");
|
||||||
else
|
else
|
||||||
p = vim_strsave(val);
|
p = vim_strsave(val);
|
||||||
if (p != NULL) // we don't want a NULL
|
if (p == NULL) // we don't want a NULL
|
||||||
{
|
return;
|
||||||
|
|
||||||
opt_idx = findoption((char_u *)name);
|
opt_idx = findoption((char_u *)name);
|
||||||
if (opt_idx >= 0)
|
if (opt_idx < 0)
|
||||||
{
|
return;
|
||||||
|
|
||||||
if (options[opt_idx].flags & P_DEF_ALLOCED)
|
if (options[opt_idx].flags & P_DEF_ALLOCED)
|
||||||
vim_free(options[opt_idx].def_val[VI_DEFAULT]);
|
vim_free(options[opt_idx].def_val[VI_DEFAULT]);
|
||||||
options[opt_idx].def_val[VI_DEFAULT] = p;
|
options[opt_idx].def_val[VI_DEFAULT] = p;
|
||||||
options[opt_idx].flags |= P_DEF_ALLOCED;
|
options[opt_idx].flags |= P_DEF_ALLOCED;
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -1112,8 +1112,9 @@ set_helplang_default(char_u *lang)
|
|||||||
if (lang == NULL || STRLEN(lang) < 2) // safety check
|
if (lang == NULL || STRLEN(lang) < 2) // safety check
|
||||||
return;
|
return;
|
||||||
idx = findoption((char_u *)"hlg");
|
idx = findoption((char_u *)"hlg");
|
||||||
if (idx >= 0 && !(options[idx].flags & P_WAS_SET))
|
if (idx < 0 || (options[idx].flags & P_WAS_SET))
|
||||||
{
|
return;
|
||||||
|
|
||||||
if (options[idx].flags & P_ALLOCED)
|
if (options[idx].flags & P_ALLOCED)
|
||||||
free_string_option(p_hlg);
|
free_string_option(p_hlg);
|
||||||
p_hlg = vim_strsave(lang);
|
p_hlg = vim_strsave(lang);
|
||||||
@ -1136,7 +1137,6 @@ set_helplang_default(char_u *lang)
|
|||||||
p_hlg[2] = NUL;
|
p_hlg[2] = NUL;
|
||||||
}
|
}
|
||||||
options[idx].flags |= P_ALLOCED;
|
options[idx].flags |= P_ALLOCED;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1171,8 +1171,11 @@ set_title_defaults(void)
|
|||||||
p_title = val;
|
p_title = val;
|
||||||
}
|
}
|
||||||
idx1 = findoption((char_u *)"icon");
|
idx1 = findoption((char_u *)"icon");
|
||||||
if (idx1 >= 0 && !(options[idx1].flags & P_WAS_SET))
|
if (idx1 < 0 || (options[idx1].flags & P_WAS_SET))
|
||||||
{
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef FEAT_GUI
|
#ifdef FEAT_GUI
|
||||||
if (gui.starting || gui.in_use)
|
if (gui.starting || gui.in_use)
|
||||||
val = TRUE;
|
val = TRUE;
|
||||||
@ -1181,7 +1184,6 @@ set_title_defaults(void)
|
|||||||
val = mch_can_restore_icon();
|
val = mch_can_restore_icon();
|
||||||
options[idx1].def_val[VI_DEFAULT] = (char_u *)(long_i)val;
|
options[idx1].def_val[VI_DEFAULT] = (char_u *)(long_i)val;
|
||||||
p_icon = val;
|
p_icon = val;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -7084,12 +7086,11 @@ reset_option_was_set(char_u *name)
|
|||||||
{
|
{
|
||||||
int idx = findoption(name);
|
int idx = findoption(name);
|
||||||
|
|
||||||
if (idx >= 0)
|
if (idx < 0)
|
||||||
{
|
return FAIL;
|
||||||
|
|
||||||
options[idx].flags &= ~P_WAS_SET;
|
options[idx].flags &= ~P_WAS_SET;
|
||||||
return OK;
|
return OK;
|
||||||
}
|
|
||||||
return FAIL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -155,9 +155,10 @@ trigger_optionset_string(
|
|||||||
char_u *newval)
|
char_u *newval)
|
||||||
{
|
{
|
||||||
// Don't do this recursively.
|
// Don't do this recursively.
|
||||||
if (oldval != NULL && newval != NULL
|
if (oldval == NULL || newval == NULL
|
||||||
&& *get_vim_var_str(VV_OPTION_TYPE) == NUL)
|
|| *get_vim_var_str(VV_OPTION_TYPE) != NUL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
char_u buf_type[7];
|
char_u buf_type[7];
|
||||||
|
|
||||||
sprintf((char *)buf_type, "%s",
|
sprintf((char *)buf_type, "%s",
|
||||||
@ -190,7 +191,6 @@ trigger_optionset_string(
|
|||||||
get_option_fullname(opt_idx), NULL, FALSE,
|
get_option_fullname(opt_idx), NULL, FALSE,
|
||||||
NULL);
|
NULL);
|
||||||
reset_v_option_vars();
|
reset_v_option_vars();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -387,8 +387,9 @@ set_string_option_direct(
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
s = vim_strsave(val);
|
s = vim_strsave(val);
|
||||||
if (s != NULL)
|
if (s == NULL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
varp = (char_u **)get_option_varp_scope(idx,
|
varp = (char_u **)get_option_varp_scope(idx,
|
||||||
both ? OPT_LOCAL : opt_flags);
|
both ? OPT_LOCAL : opt_flags);
|
||||||
if ((opt_flags & OPT_FREE) && (get_option_flags(idx) & P_ALLOCED))
|
if ((opt_flags & OPT_FREE) && (get_option_flags(idx) & P_ALLOCED))
|
||||||
@ -425,7 +426,6 @@ set_string_option_direct(
|
|||||||
set_option_sctx_idx(idx, opt_flags, script_ctx);
|
set_option_sctx_idx(idx, opt_flags, script_ctx);
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -507,8 +507,9 @@ set_string_option(
|
|||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
s = vim_strsave(value == NULL ? (char_u *)"" : value);
|
s = vim_strsave(value == NULL ? (char_u *)"" : value);
|
||||||
if (s != NULL)
|
if (s == NULL)
|
||||||
{
|
return NULL;
|
||||||
|
|
||||||
varp = (char_u **)get_option_varp_scope(opt_idx,
|
varp = (char_u **)get_option_varp_scope(opt_idx,
|
||||||
(opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0
|
(opt_flags & (OPT_LOCAL | OPT_GLOBAL)) == 0
|
||||||
? (is_global_local_option(opt_idx)
|
? (is_global_local_option(opt_idx)
|
||||||
@ -554,7 +555,6 @@ set_string_option(
|
|||||||
vim_free(saved_oldval_g);
|
vim_free(saved_oldval_g);
|
||||||
vim_free(saved_newval);
|
vim_free(saved_newval);
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
return errmsg;
|
return errmsg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,13 +234,13 @@ mch_delay(long msec, int flags)
|
|||||||
void Delay(long);
|
void Delay(long);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (msec > 0)
|
if (msec <= 0)
|
||||||
{
|
return;
|
||||||
|
|
||||||
if (flags & MCH_DELAY_IGNOREINPUT)
|
if (flags & MCH_DELAY_IGNOREINPUT)
|
||||||
Delay(msec / 20L); // Delay works with 20 msec intervals
|
Delay(msec / 20L); // Delay works with 20 msec intervals
|
||||||
else
|
else
|
||||||
WaitForChar(raw_in, msec * 1000L);
|
WaitForChar(raw_in, msec * 1000L);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -577,8 +577,9 @@ fname_case(
|
|||||||
size_t flen;
|
size_t flen;
|
||||||
|
|
||||||
fib = get_fib(name);
|
fib = get_fib(name);
|
||||||
if (fib != NULL)
|
if (fib == NULL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
flen = STRLEN(name);
|
flen = STRLEN(name);
|
||||||
// TODO: Check if this fix applies to AmigaOS < 4 too.
|
// TODO: Check if this fix applies to AmigaOS < 4 too.
|
||||||
#ifdef __amigaos4__
|
#ifdef __amigaos4__
|
||||||
@ -588,7 +589,6 @@ fname_case(
|
|||||||
if (flen == strlen(fib->fib_FileName)) // safety check
|
if (flen == strlen(fib->fib_FileName)) // safety check
|
||||||
mch_memmove(name, fib->fib_FileName, flen);
|
mch_memmove(name, fib->fib_FileName, flen);
|
||||||
free_fib(fib);
|
free_fib(fib);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -609,8 +609,9 @@ get_fib(char_u *fname)
|
|||||||
#else
|
#else
|
||||||
fib = ALLOC_ONE(struct FileInfoBlock);
|
fib = ALLOC_ONE(struct FileInfoBlock);
|
||||||
#endif
|
#endif
|
||||||
if (fib != NULL)
|
if (fib == NULL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
flock = Lock((UBYTE *)fname, (long)ACCESS_READ);
|
flock = Lock((UBYTE *)fname, (long)ACCESS_READ);
|
||||||
if (flock == (BPTR)NULL || !Examine(flock, fib))
|
if (flock == (BPTR)NULL || !Examine(flock, fib))
|
||||||
{
|
{
|
||||||
@ -619,7 +620,6 @@ get_fib(char_u *fname)
|
|||||||
}
|
}
|
||||||
if (flock)
|
if (flock)
|
||||||
UnLock(flock);
|
UnLock(flock);
|
||||||
}
|
|
||||||
return fib;
|
return fib;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -815,11 +815,11 @@ mch_getperm(char_u *name)
|
|||||||
long retval = -1;
|
long retval = -1;
|
||||||
|
|
||||||
fib = get_fib(name);
|
fib = get_fib(name);
|
||||||
if (fib != NULL)
|
if (fib == NULL)
|
||||||
{
|
return -1;
|
||||||
|
|
||||||
retval = fib->fib_Protection;
|
retval = fib->fib_Protection;
|
||||||
free_fib(fib);
|
free_fib(fib);
|
||||||
}
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -856,15 +856,15 @@ mch_isdir(char_u *name)
|
|||||||
int retval = FALSE;
|
int retval = FALSE;
|
||||||
|
|
||||||
fib = get_fib(name);
|
fib = get_fib(name);
|
||||||
if (fib != NULL)
|
if (fib == NULL)
|
||||||
{
|
return FALSE;
|
||||||
|
|
||||||
#ifdef __amigaos4__
|
#ifdef __amigaos4__
|
||||||
retval = (FIB_IS_DRAWER(fib)) ? TRUE : FALSE;
|
retval = (FIB_IS_DRAWER(fib)) ? TRUE : FALSE;
|
||||||
#else
|
#else
|
||||||
retval = ((fib->fib_DirEntryType >= 0) ? TRUE : FALSE);
|
retval = ((fib->fib_DirEntryType >= 0) ? TRUE : FALSE);
|
||||||
#endif
|
#endif
|
||||||
free_fib(fib);
|
free_fib(fib);
|
||||||
}
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -877,12 +877,11 @@ mch_mkdir(char_u *name)
|
|||||||
BPTR lock;
|
BPTR lock;
|
||||||
|
|
||||||
lock = CreateDir(name);
|
lock = CreateDir(name);
|
||||||
if (lock != NULL)
|
if (lock == NULL)
|
||||||
{
|
return -1;
|
||||||
|
|
||||||
UnLock(lock);
|
UnLock(lock);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
return -1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -1173,8 +1172,9 @@ out:
|
|||||||
void
|
void
|
||||||
mch_set_shellsize(void)
|
mch_set_shellsize(void)
|
||||||
{
|
{
|
||||||
if (term_console)
|
if (!term_console)
|
||||||
{
|
return;
|
||||||
|
|
||||||
size_set = TRUE;
|
size_set = TRUE;
|
||||||
out_char(CSI);
|
out_char(CSI);
|
||||||
out_num((long)Rows);
|
out_num((long)Rows);
|
||||||
@ -1183,7 +1183,6 @@ mch_set_shellsize(void)
|
|||||||
out_num((long)Columns);
|
out_num((long)Columns);
|
||||||
out_char('u');
|
out_char('u');
|
||||||
out_flush();
|
out_flush();
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -568,8 +568,9 @@ mac_utf8_to_utf16(
|
|||||||
void
|
void
|
||||||
mac_lang_init(void)
|
mac_lang_init(void)
|
||||||
{
|
{
|
||||||
if (mch_getenv((char_u *)"LANG") == NULL)
|
if (mch_getenv((char_u *)"LANG") != NULL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
char buf[50];
|
char buf[50];
|
||||||
|
|
||||||
// $LANG is not set, either because it was unset or Vim was started
|
// $LANG is not set, either because it was unset or Vim was started
|
||||||
@ -590,6 +591,5 @@ mac_lang_init(void)
|
|||||||
setlocale(LC_NUMERIC, "C");
|
setlocale(LC_NUMERIC, "C");
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif // MACOS_CONVERT
|
#endif // MACOS_CONVERT
|
||||||
|
@ -835,8 +835,9 @@ check_str_len(char_u *str)
|
|||||||
GetSystemInfo(&si);
|
GetSystemInfo(&si);
|
||||||
|
|
||||||
// get memory information
|
// get memory information
|
||||||
if (VirtualQuery(str, &mbi, sizeof(mbi)))
|
if (!VirtualQuery(str, &mbi, sizeof(mbi)))
|
||||||
{
|
return 0;
|
||||||
|
|
||||||
// pre cast these (typing savers)
|
// pre cast these (typing savers)
|
||||||
long_u dwStr = (long_u)str;
|
long_u dwStr = (long_u)str;
|
||||||
long_u dwBaseAddress = (long_u)mbi.BaseAddress;
|
long_u dwBaseAddress = (long_u)mbi.BaseAddress;
|
||||||
@ -852,7 +853,6 @@ check_str_len(char_u *str)
|
|||||||
for (i = 0; i < pageLength; ++i, ++length)
|
for (i = 0; i < pageLength; ++i, ++length)
|
||||||
if (p[i] == NUL)
|
if (p[i] == NUL)
|
||||||
return length + 1;
|
return length + 1;
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -1213,8 +1213,9 @@ PrintHookProc(
|
|||||||
RECT rc, rcDlg, rcOwner;
|
RECT rc, rcDlg, rcOwner;
|
||||||
PRINTDLGW *pPD;
|
PRINTDLGW *pPD;
|
||||||
|
|
||||||
if (uiMsg == WM_INITDIALOG)
|
if (uiMsg != WM_INITDIALOG)
|
||||||
{
|
return FALSE;
|
||||||
|
|
||||||
// Get the owner window and dialog box rectangles.
|
// Get the owner window and dialog box rectangles.
|
||||||
if ((hwndOwner = GetParent(hDlg)) == NULL)
|
if ((hwndOwner = GetParent(hDlg)) == NULL)
|
||||||
hwndOwner = GetDesktopWindow();
|
hwndOwner = GetDesktopWindow();
|
||||||
@ -1249,7 +1250,6 @@ PrintHookProc(
|
|||||||
// Bring the window to top
|
// Bring the window to top
|
||||||
BringWindowToTop(GetParent(hDlg));
|
BringWindowToTop(GetParent(hDlg));
|
||||||
SetForegroundWindow(hDlg);
|
SetForegroundWindow(hDlg);
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
@ -1571,7 +1571,6 @@ mch_print_init(prt_settings_T *psettings, char_u *jobname, int forceit)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
init_fail_dlg:
|
init_fail_dlg:
|
||||||
{
|
|
||||||
DWORD err = CommDlgExtendedError();
|
DWORD err = CommDlgExtendedError();
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
@ -1593,7 +1592,6 @@ init_fail_dlg:
|
|||||||
|
|
||||||
mch_print_cleanup();
|
mch_print_cleanup();
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1999,11 +1997,11 @@ serverSendEnc(HWND target)
|
|||||||
static void
|
static void
|
||||||
CleanUpMessaging(void)
|
CleanUpMessaging(void)
|
||||||
{
|
{
|
||||||
if (message_window != 0)
|
if (message_window == 0)
|
||||||
{
|
return;
|
||||||
|
|
||||||
DestroyWindow(message_window);
|
DestroyWindow(message_window);
|
||||||
message_window = 0;
|
message_window = 0;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int save_reply(HWND server, char_u *reply, int expr);
|
static int save_reply(HWND server, char_u *reply, int expr);
|
||||||
|
@ -67,8 +67,9 @@ clip_mch_request_selection(Clipboard_T *cbd)
|
|||||||
char_u *clip_text = NULL;
|
char_u *clip_text = NULL;
|
||||||
|
|
||||||
cbdata = PhClipboardPasteStart(PhInputGroup(NULL));
|
cbdata = PhClipboardPasteStart(PhInputGroup(NULL));
|
||||||
if (cbdata != NULL)
|
if (cbdata == NULL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
// Look for the vim specific clip first
|
// Look for the vim specific clip first
|
||||||
clip_header = PhClipboardPasteType(cbdata, CLIP_TYPE_VIM);
|
clip_header = PhClipboardPasteType(cbdata, CLIP_TYPE_VIM);
|
||||||
if (clip_header != NULL && clip_header->data != NULL)
|
if (clip_header != NULL && clip_header->data != NULL)
|
||||||
@ -98,7 +99,6 @@ clip_mch_request_selection(Clipboard_T *cbd)
|
|||||||
clip_yank_selection(type, clip_text, clip_length, cbd);
|
clip_yank_selection(type, clip_text, clip_length, cbd);
|
||||||
|
|
||||||
PhClipboardPasteFinish(cbdata);
|
PhClipboardPasteFinish(cbdata);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -780,8 +780,9 @@ get_stack_limit(void)
|
|||||||
int
|
int
|
||||||
mch_stackcheck(char *p)
|
mch_stackcheck(char *p)
|
||||||
{
|
{
|
||||||
if (stack_limit != NULL)
|
if (stack_limit == NULL)
|
||||||
{
|
return OK;
|
||||||
|
|
||||||
if (stack_grows_downwards)
|
if (stack_grows_downwards)
|
||||||
{
|
{
|
||||||
if (p < stack_limit)
|
if (p < stack_limit)
|
||||||
@ -789,7 +790,6 @@ mch_stackcheck(char *p)
|
|||||||
}
|
}
|
||||||
else if (p > stack_limit)
|
else if (p > stack_limit)
|
||||||
return FAIL;
|
return FAIL;
|
||||||
}
|
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -837,8 +837,9 @@ static char *signal_stack;
|
|||||||
static void
|
static void
|
||||||
init_signal_stack(void)
|
init_signal_stack(void)
|
||||||
{
|
{
|
||||||
if (signal_stack != NULL)
|
if (signal_stack == NULL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
# ifdef HAVE_SIGALTSTACK
|
# ifdef HAVE_SIGALTSTACK
|
||||||
# ifdef HAVE_SS_BASE
|
# ifdef HAVE_SS_BASE
|
||||||
sigstk.ss_base = signal_stack;
|
sigstk.ss_base = signal_stack;
|
||||||
@ -855,7 +856,6 @@ init_signal_stack(void)
|
|||||||
sigstk.ss_onstack = 0;
|
sigstk.ss_onstack = 0;
|
||||||
(void)sigstack(&sigstk, NULL);
|
(void)sigstack(&sigstk, NULL);
|
||||||
# endif
|
# endif
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2020,8 +2020,9 @@ get_x11_thing(
|
|||||||
int retval = FALSE;
|
int retval = FALSE;
|
||||||
Status status;
|
Status status;
|
||||||
|
|
||||||
if (get_x11_windis() == OK)
|
if (get_x11_windis() != OK)
|
||||||
{
|
return FALSE;
|
||||||
|
|
||||||
// Get window/icon name if any
|
// Get window/icon name if any
|
||||||
if (get_title)
|
if (get_title)
|
||||||
status = XGetWMName(x11_display, x11_window, &text_prop);
|
status = XGetWMName(x11_display, x11_window, &text_prop);
|
||||||
@ -2037,7 +2038,6 @@ get_x11_thing(
|
|||||||
// Previously this was only done for xterm and alike. I don't see a
|
// Previously this was only done for xterm and alike. I don't see a
|
||||||
// reason why it would fail for other terminal emulators.
|
// reason why it would fail for other terminal emulators.
|
||||||
// if (term_is_xterm)
|
// if (term_is_xterm)
|
||||||
{
|
|
||||||
Window root;
|
Window root;
|
||||||
Window parent;
|
Window parent;
|
||||||
Window win = x11_window;
|
Window win = x11_window;
|
||||||
@ -2060,7 +2060,7 @@ get_x11_thing(
|
|||||||
else
|
else
|
||||||
status = XGetWMIconName(x11_display, win, &text_prop);
|
status = XGetWMIconName(x11_display, win, &text_prop);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (status && text_prop.value != NULL)
|
if (status && text_prop.value != NULL)
|
||||||
{
|
{
|
||||||
retval = TRUE;
|
retval = TRUE;
|
||||||
@ -2105,7 +2105,6 @@ get_x11_thing(
|
|||||||
}
|
}
|
||||||
XFree((void *)text_prop.value);
|
XFree((void *)text_prop.value);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2772,8 +2771,9 @@ fname_case(
|
|||||||
DIR *dirp;
|
DIR *dirp;
|
||||||
struct dirent *dp;
|
struct dirent *dp;
|
||||||
|
|
||||||
if (mch_lstat((char *)name, &st) >= 0)
|
if (mch_lstat((char *)name, &st) < 0)
|
||||||
{
|
return;
|
||||||
|
|
||||||
// Open the directory where the file is located.
|
// Open the directory where the file is located.
|
||||||
slash = vim_strrchr(name, '/');
|
slash = vim_strrchr(name, '/');
|
||||||
if (slash == NULL)
|
if (slash == NULL)
|
||||||
@ -2789,8 +2789,9 @@ fname_case(
|
|||||||
tail = slash + 1;
|
tail = slash + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dirp != NULL)
|
if (dirp == NULL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
while ((dp = readdir(dirp)) != NULL)
|
while ((dp = readdir(dirp)) != NULL)
|
||||||
{
|
{
|
||||||
// Only accept names that differ in case and are the same byte
|
// Only accept names that differ in case and are the same byte
|
||||||
@ -2816,8 +2817,6 @@ fname_case(
|
|||||||
}
|
}
|
||||||
|
|
||||||
closedir(dirp);
|
closedir(dirp);
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -2902,8 +2901,9 @@ mch_copy_sec(char_u *from_file, char_u *to_file)
|
|||||||
if (selinux_enabled == -1)
|
if (selinux_enabled == -1)
|
||||||
selinux_enabled = is_selinux_enabled();
|
selinux_enabled = is_selinux_enabled();
|
||||||
|
|
||||||
if (selinux_enabled > 0)
|
if (selinux_enabled <= 0)
|
||||||
{
|
return;
|
||||||
|
|
||||||
// Use "char *" instead of "security_context_t" to avoid a deprecation
|
// Use "char *" instead of "security_context_t" to avoid a deprecation
|
||||||
// warning.
|
// warning.
|
||||||
char *from_context = NULL;
|
char *from_context = NULL;
|
||||||
@ -2941,7 +2941,6 @@ mch_copy_sec(char_u *from_file, char_u *to_file)
|
|||||||
}
|
}
|
||||||
freecon(to_context);
|
freecon(to_context);
|
||||||
freecon(from_context);
|
freecon(from_context);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif // HAVE_SELINUX
|
#endif // HAVE_SELINUX
|
||||||
|
|
||||||
@ -3549,8 +3548,9 @@ mch_tcgetattr(int fd, void *term)
|
|||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
|
||||||
tty_fd = get_tty_fd(fd);
|
tty_fd = get_tty_fd(fd);
|
||||||
if (tty_fd >= 0)
|
if (tty_fd < 0)
|
||||||
{
|
return -1;
|
||||||
|
|
||||||
#ifdef NEW_TTY_SYSTEM
|
#ifdef NEW_TTY_SYSTEM
|
||||||
# ifdef HAVE_TERMIOS_H
|
# ifdef HAVE_TERMIOS_H
|
||||||
retval = tcgetattr(tty_fd, (struct termios *)term);
|
retval = tcgetattr(tty_fd, (struct termios *)term);
|
||||||
@ -3563,7 +3563,6 @@ mch_tcgetattr(int fd, void *term)
|
|||||||
#endif
|
#endif
|
||||||
if (tty_fd != fd)
|
if (tty_fd != fd)
|
||||||
close(tty_fd);
|
close(tty_fd);
|
||||||
}
|
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3682,8 +3681,9 @@ get_stty(void)
|
|||||||
char_u buf[2];
|
char_u buf[2];
|
||||||
char_u *p;
|
char_u *p;
|
||||||
|
|
||||||
if (get_tty_info(read_cmd_fd, &info) == OK)
|
if (get_tty_info(read_cmd_fd, &info) != OK)
|
||||||
{
|
return;
|
||||||
|
|
||||||
intr_char = info.interrupt;
|
intr_char = info.interrupt;
|
||||||
buf[0] = info.backspace;
|
buf[0] = info.backspace;
|
||||||
buf[1] = NUL;
|
buf[1] = NUL;
|
||||||
@ -3693,7 +3693,6 @@ get_stty(void)
|
|||||||
p = find_termcode((char_u *)"kD");
|
p = find_termcode((char_u *)"kD");
|
||||||
if (p != NULL && p[0] == buf[0] && p[1] == buf[1])
|
if (p != NULL && p[0] == buf[0] && p[1] == buf[1])
|
||||||
do_fixdel(NULL);
|
do_fixdel(NULL);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -4160,8 +4159,9 @@ mch_report_winsize(int fd, int rows, int cols)
|
|||||||
int retval = -1;
|
int retval = -1;
|
||||||
|
|
||||||
tty_fd = get_tty_fd(fd);
|
tty_fd = get_tty_fd(fd);
|
||||||
if (tty_fd >= 0)
|
if (tty_fd < 0)
|
||||||
{
|
return FAIL;
|
||||||
|
|
||||||
# if defined(TIOCSWINSZ)
|
# if defined(TIOCSWINSZ)
|
||||||
struct winsize ws;
|
struct winsize ws;
|
||||||
|
|
||||||
@ -4183,7 +4183,6 @@ mch_report_winsize(int fd, int rows, int cols)
|
|||||||
# endif
|
# endif
|
||||||
if (tty_fd != fd)
|
if (tty_fd != fd)
|
||||||
close(tty_fd);
|
close(tty_fd);
|
||||||
}
|
|
||||||
return retval == 0 ? OK : FAIL;
|
return retval == 0 ? OK : FAIL;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -4362,8 +4361,9 @@ open_pty(int *pty_master_fd, int *pty_slave_fd, char_u **name1, char_u **name2)
|
|||||||
*name2 = NULL;
|
*name2 = NULL;
|
||||||
|
|
||||||
*pty_master_fd = mch_openpty(&tty_name); // open pty
|
*pty_master_fd = mch_openpty(&tty_name); // open pty
|
||||||
if (*pty_master_fd >= 0)
|
if (*pty_master_fd < 0)
|
||||||
{
|
return;
|
||||||
|
|
||||||
// Leaving out O_NOCTTY may lead to waitpid() always returning
|
// Leaving out O_NOCTTY may lead to waitpid() always returning
|
||||||
// 0 on Mac OS X 10.7 thereby causing freezes. Let's assume
|
// 0 on Mac OS X 10.7 thereby causing freezes. Let's assume
|
||||||
// adding O_NOCTTY always works when defined.
|
// adding O_NOCTTY always works when defined.
|
||||||
@ -4384,7 +4384,6 @@ open_pty(int *pty_master_fd, int *pty_slave_fd, char_u **name1, char_u **name2)
|
|||||||
if (name2 != NULL)
|
if (name2 != NULL)
|
||||||
*name2 = vim_strsave((char_u *)tty_name);
|
*name2 = vim_strsave((char_u *)tty_name);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -7250,8 +7249,9 @@ gpm_open(void)
|
|||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!gpm_flag)
|
if (gpm_flag)
|
||||||
{
|
return 1; // already open
|
||||||
|
|
||||||
gpm_connect.eventMask = (GPM_UP | GPM_DRAG | GPM_DOWN);
|
gpm_connect.eventMask = (GPM_UP | GPM_DRAG | GPM_DOWN);
|
||||||
gpm_connect.defaultMask = ~GPM_HARD;
|
gpm_connect.defaultMask = ~GPM_HARD;
|
||||||
// Default handling for mouse move
|
// Default handling for mouse move
|
||||||
@ -7271,8 +7271,6 @@ gpm_open(void)
|
|||||||
if (gpm_fd == -2)
|
if (gpm_fd == -2)
|
||||||
Gpm_Close(); // We don't want to talk to xterm via gpm
|
Gpm_Close(); // We don't want to talk to xterm via gpm
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
return 1; // already open
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -7395,14 +7393,13 @@ sysmouse_open(void)
|
|||||||
mouse.operation = MOUSE_MODE;
|
mouse.operation = MOUSE_MODE;
|
||||||
mouse.u.mode.mode = 0;
|
mouse.u.mode.mode = 0;
|
||||||
mouse.u.mode.signal = SIGUSR2;
|
mouse.u.mode.signal = SIGUSR2;
|
||||||
if (ioctl(1, CONS_MOUSECTL, &mouse) != -1)
|
if (ioctl(1, CONS_MOUSECTL, &mouse) == -1)
|
||||||
{
|
return FAIL;
|
||||||
|
|
||||||
signal(SIGUSR2, (void (*)())sig_sysmouse);
|
signal(SIGUSR2, (void (*)())sig_sysmouse);
|
||||||
mouse.operation = MOUSE_SHOW;
|
mouse.operation = MOUSE_SHOW;
|
||||||
ioctl(1, CONS_MOUSECTL, &mouse);
|
ioctl(1, CONS_MOUSECTL, &mouse);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
|
||||||
return FAIL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -8243,14 +8240,14 @@ xsmp_init(void)
|
|||||||
void
|
void
|
||||||
xsmp_close(void)
|
xsmp_close(void)
|
||||||
{
|
{
|
||||||
if (xsmp_icefd != -1)
|
if (xsmp_icefd == -1)
|
||||||
{
|
return;
|
||||||
|
|
||||||
SmcCloseConnection(xsmp.smcconn, 0, NULL);
|
SmcCloseConnection(xsmp.smcconn, 0, NULL);
|
||||||
if (xsmp.clientid != NULL)
|
if (xsmp.clientid != NULL)
|
||||||
free(xsmp.clientid);
|
free(xsmp.clientid);
|
||||||
xsmp.clientid = NULL;
|
xsmp.clientid = NULL;
|
||||||
xsmp_icefd = -1;
|
xsmp_icefd = -1;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif // USE_XSMP
|
#endif // USE_XSMP
|
||||||
|
|
||||||
@ -8348,11 +8345,11 @@ start_timeout(long msec)
|
|||||||
void
|
void
|
||||||
delete_timer(void)
|
delete_timer(void)
|
||||||
{
|
{
|
||||||
if (timer_created)
|
if (!timer_created)
|
||||||
{
|
return;
|
||||||
|
|
||||||
timer_delete(timer_id);
|
timer_delete(timer_id);
|
||||||
timer_created = FALSE;
|
timer_created = FALSE;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
# else // HAVE_TIMER_CREATE
|
# else // HAVE_TIMER_CREATE
|
||||||
|
111
src/os_win32.c
111
src/os_win32.c
@ -278,15 +278,15 @@ get_build_number(void)
|
|||||||
|
|
||||||
osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
|
osver.dwOSVersionInfoSize = sizeof(OSVERSIONINFOW);
|
||||||
hNtdll = GetModuleHandle("ntdll.dll");
|
hNtdll = GetModuleHandle("ntdll.dll");
|
||||||
if (hNtdll != NULL)
|
if (hNtdll == NULL)
|
||||||
{
|
return ver;
|
||||||
|
|
||||||
pRtlGetVersion =
|
pRtlGetVersion =
|
||||||
(PfnRtlGetVersion)GetProcAddress(hNtdll, "RtlGetVersion");
|
(PfnRtlGetVersion)GetProcAddress(hNtdll, "RtlGetVersion");
|
||||||
pRtlGetVersion(&osver);
|
pRtlGetVersion(&osver);
|
||||||
ver = MAKE_VER(min(osver.dwMajorVersion, 255),
|
ver = MAKE_VER(min(osver.dwMajorVersion, 255),
|
||||||
min(osver.dwMinorVersion, 255),
|
min(osver.dwMinorVersion, 255),
|
||||||
min(osver.dwBuildNumber, 32767));
|
min(osver.dwBuildNumber, 32767));
|
||||||
}
|
|
||||||
return ver;
|
return ver;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -478,11 +478,13 @@ get_exe_name(void)
|
|||||||
exe_name = FullName_save((char_u *)temp, FALSE);
|
exe_name = FullName_save((char_u *)temp, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (exe_path == NULL && exe_name != NULL)
|
if (exe_path != NULL || exe_name == NULL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
exe_path = vim_strnsave(exe_name, gettail_sep(exe_name) - exe_name);
|
exe_path = vim_strnsave(exe_name, gettail_sep(exe_name) - exe_name);
|
||||||
if (exe_path != NULL)
|
if (exe_path == NULL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
// Append our starting directory to $PATH, so that when doing
|
// Append our starting directory to $PATH, so that when doing
|
||||||
// "!xxd" it's found in our starting directory. Needed because
|
// "!xxd" it's found in our starting directory. Needed because
|
||||||
// SearchPath() also looks there.
|
// SearchPath() also looks there.
|
||||||
@ -500,8 +502,6 @@ get_exe_name(void)
|
|||||||
STRCAT(temp, exe_path);
|
STRCAT(temp, exe_path);
|
||||||
vim_setenv((char_u *)"PATH", (char_u *)temp);
|
vim_setenv((char_u *)"PATH", (char_u *)temp);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -533,18 +533,21 @@ vimLoadLib(const char *name)
|
|||||||
|
|
||||||
// No need to load any library when registering OLE.
|
// No need to load any library when registering OLE.
|
||||||
if (found_register_arg)
|
if (found_register_arg)
|
||||||
return dll;
|
return NULL;
|
||||||
|
|
||||||
// NOTE: Do not use mch_dirname() and mch_chdir() here, they may call
|
// NOTE: Do not use mch_dirname() and mch_chdir() here, they may call
|
||||||
// vimLoadLib() recursively, which causes a stack overflow.
|
// vimLoadLib() recursively, which causes a stack overflow.
|
||||||
if (exe_path == NULL)
|
if (exe_path == NULL)
|
||||||
get_exe_name();
|
get_exe_name();
|
||||||
if (exe_path != NULL)
|
|
||||||
{
|
if (exe_path == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
WCHAR old_dirw[MAXPATHL];
|
WCHAR old_dirw[MAXPATHL];
|
||||||
|
|
||||||
if (GetCurrentDirectoryW(MAXPATHL, old_dirw) != 0)
|
if (GetCurrentDirectoryW(MAXPATHL, old_dirw) == 0)
|
||||||
{
|
return NULL;
|
||||||
|
|
||||||
// Change directory to where the executable is, both to make
|
// Change directory to where the executable is, both to make
|
||||||
// sure we find a .dll there and to avoid looking for a .dll
|
// sure we find a .dll there and to avoid looking for a .dll
|
||||||
// in the current directory.
|
// in the current directory.
|
||||||
@ -552,9 +555,6 @@ vimLoadLib(const char *name)
|
|||||||
dll = LoadLibrary(name);
|
dll = LoadLibrary(name);
|
||||||
SetCurrentDirectoryW(old_dirw);
|
SetCurrentDirectoryW(old_dirw);
|
||||||
return dll;
|
return dll;
|
||||||
}
|
|
||||||
}
|
|
||||||
return dll;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(VIMDLL) || defined(PROTO)
|
#if defined(VIMDLL) || defined(PROTO)
|
||||||
@ -907,8 +907,9 @@ PlatformId(void)
|
|||||||
{
|
{
|
||||||
static int done = FALSE;
|
static int done = FALSE;
|
||||||
|
|
||||||
if (!done)
|
if (done)
|
||||||
{
|
return;
|
||||||
|
|
||||||
OSVERSIONINFO ovi;
|
OSVERSIONINFO ovi;
|
||||||
|
|
||||||
ovi.dwOSVersionInfoSize = sizeof(ovi);
|
ovi.dwOSVersionInfoSize = sizeof(ovi);
|
||||||
@ -931,7 +932,6 @@ PlatformId(void)
|
|||||||
win32_enable_privilege(SE_SECURITY_NAME, TRUE);
|
win32_enable_privilege(SE_SECURITY_NAME, TRUE);
|
||||||
#endif
|
#endif
|
||||||
done = TRUE;
|
done = TRUE;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
# pragma warning(pop)
|
# pragma warning(pop)
|
||||||
@ -3051,8 +3051,9 @@ FitConsoleWindow(
|
|||||||
COORD dwWindowSize;
|
COORD dwWindowSize;
|
||||||
BOOL NeedAdjust = FALSE;
|
BOOL NeedAdjust = FALSE;
|
||||||
|
|
||||||
if (GetConsoleScreenBufferInfo(g_hConOut, &csbi))
|
if (!GetConsoleScreenBufferInfo(g_hConOut, &csbi))
|
||||||
{
|
return FALSE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* A buffer resize will fail if the current console window does
|
* A buffer resize will fail if the current console window does
|
||||||
* not lie completely within that buffer. To avoid this, we might
|
* not lie completely within that buffer. To avoid this, we might
|
||||||
@ -3082,9 +3083,6 @@ FitConsoleWindow(
|
|||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
|
||||||
|
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
typedef struct ConsoleBufferStruct
|
typedef struct ConsoleBufferStruct
|
||||||
@ -3674,17 +3672,15 @@ mch_get_host_name(
|
|||||||
WCHAR wszHostName[256 + 1];
|
WCHAR wszHostName[256 + 1];
|
||||||
DWORD wcch = ARRAY_LENGTH(wszHostName);
|
DWORD wcch = ARRAY_LENGTH(wszHostName);
|
||||||
|
|
||||||
if (GetComputerNameW(wszHostName, &wcch))
|
if (!GetComputerNameW(wszHostName, &wcch))
|
||||||
{
|
return;
|
||||||
char_u *p = utf16_to_enc(wszHostName, NULL);
|
|
||||||
|
char_u *p = utf16_to_enc(wszHostName, NULL);
|
||||||
|
if (p == NULL)
|
||||||
|
return;
|
||||||
|
|
||||||
if (p != NULL)
|
|
||||||
{
|
|
||||||
vim_strncpy(s, p, len - 1);
|
vim_strncpy(s, p, len - 1);
|
||||||
vim_free(p);
|
vim_free(p);
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -3732,8 +3728,9 @@ mch_dirname(
|
|||||||
* But the Win32s known bug list says that getcwd() doesn't work
|
* But the Win32s known bug list says that getcwd() doesn't work
|
||||||
* so use the Win32 system call instead. <Negri>
|
* so use the Win32 system call instead. <Negri>
|
||||||
*/
|
*/
|
||||||
if (GetCurrentDirectoryW(_MAX_PATH, wbuf) != 0)
|
if (GetCurrentDirectoryW(_MAX_PATH, wbuf) == 0)
|
||||||
{
|
return FAIL;
|
||||||
|
|
||||||
WCHAR wcbuf[_MAX_PATH + 1];
|
WCHAR wcbuf[_MAX_PATH + 1];
|
||||||
char_u *p = NULL;
|
char_u *p = NULL;
|
||||||
|
|
||||||
@ -3750,14 +3747,12 @@ mch_dirname(
|
|||||||
if (p == NULL)
|
if (p == NULL)
|
||||||
p = utf16_to_enc(wbuf, NULL);
|
p = utf16_to_enc(wbuf, NULL);
|
||||||
|
|
||||||
if (p != NULL)
|
if (p == NULL)
|
||||||
{
|
return FAIL;
|
||||||
|
|
||||||
vim_strncpy(buf, p, len - 1);
|
vim_strncpy(buf, p, len - 1);
|
||||||
vim_free(p);
|
vim_free(p);
|
||||||
return OK;
|
return OK;
|
||||||
}
|
|
||||||
}
|
|
||||||
return FAIL;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -3974,14 +3969,14 @@ win32_fileinfo(char_u *fname, BY_HANDLE_FILE_INFORMATION *info)
|
|||||||
NULL); // handle to template file
|
NULL); // handle to template file
|
||||||
vim_free(wn);
|
vim_free(wn);
|
||||||
|
|
||||||
if (hFile != INVALID_HANDLE_VALUE)
|
if (hFile == INVALID_HANDLE_VALUE)
|
||||||
{
|
return FILEINFO_READ_FAIL;
|
||||||
|
|
||||||
if (GetFileInformationByHandle(hFile, info) != 0)
|
if (GetFileInformationByHandle(hFile, info) != 0)
|
||||||
res = FILEINFO_OK;
|
res = FILEINFO_OK;
|
||||||
else
|
else
|
||||||
res = FILEINFO_INFO_FAIL;
|
res = FILEINFO_INFO_FAIL;
|
||||||
CloseHandle(hFile);
|
CloseHandle(hFile);
|
||||||
}
|
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
@ -6170,12 +6165,12 @@ mch_signal_job(job_T *job, char_u *how)
|
|||||||
void
|
void
|
||||||
mch_clear_job(job_T *job)
|
mch_clear_job(job_T *job)
|
||||||
{
|
{
|
||||||
if (job->jv_status != JOB_FAILED)
|
if (job->jv_status == JOB_FAILED)
|
||||||
{
|
return;
|
||||||
|
|
||||||
if (job->jv_job_object != NULL)
|
if (job->jv_job_object != NULL)
|
||||||
CloseHandle(job->jv_job_object);
|
CloseHandle(job->jv_job_object);
|
||||||
CloseHandle(job->jv_proc_info.hProcess);
|
CloseHandle(job->jv_proc_info.hProcess);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -7988,8 +7983,9 @@ load_ntdll(void)
|
|||||||
{
|
{
|
||||||
static int loaded = -1;
|
static int loaded = -1;
|
||||||
|
|
||||||
if (loaded == -1)
|
if (loaded != -1)
|
||||||
{
|
return (BOOL) loaded;
|
||||||
|
|
||||||
HMODULE hNtdll = GetModuleHandle("ntdll.dll");
|
HMODULE hNtdll = GetModuleHandle("ntdll.dll");
|
||||||
if (hNtdll != NULL)
|
if (hNtdll != NULL)
|
||||||
{
|
{
|
||||||
@ -8013,7 +8009,6 @@ load_ntdll(void)
|
|||||||
loaded = FALSE;
|
loaded = FALSE;
|
||||||
else
|
else
|
||||||
loaded = TRUE;
|
loaded = TRUE;
|
||||||
}
|
|
||||||
return (BOOL) loaded;
|
return (BOOL) loaded;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -8190,11 +8185,11 @@ get_cmd_argsW(char ***argvp)
|
|||||||
void
|
void
|
||||||
free_cmd_argsW(void)
|
free_cmd_argsW(void)
|
||||||
{
|
{
|
||||||
if (ArglistW != NULL)
|
if (ArglistW == NULL)
|
||||||
{
|
return;
|
||||||
|
|
||||||
GlobalFree(ArglistW);
|
GlobalFree(ArglistW);
|
||||||
ArglistW = NULL;
|
ArglistW = NULL;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@ -8899,8 +8894,9 @@ resize_console_buf(void)
|
|||||||
COORD coord;
|
COORD coord;
|
||||||
SMALL_RECT newsize;
|
SMALL_RECT newsize;
|
||||||
|
|
||||||
if (GetConsoleScreenBufferInfo(g_hConOut, &csbi))
|
if (!GetConsoleScreenBufferInfo(g_hConOut, &csbi))
|
||||||
{
|
return;
|
||||||
|
|
||||||
coord.X = SRWIDTH(csbi.srWindow);
|
coord.X = SRWIDTH(csbi.srWindow);
|
||||||
coord.Y = SRHEIGHT(csbi.srWindow);
|
coord.Y = SRHEIGHT(csbi.srWindow);
|
||||||
SetConsoleScreenBufferSize(g_hConOut, coord);
|
SetConsoleScreenBufferSize(g_hConOut, coord);
|
||||||
@ -8912,7 +8908,6 @@ resize_console_buf(void)
|
|||||||
SetConsoleWindowInfo(g_hConOut, TRUE, &newsize);
|
SetConsoleWindowInfo(g_hConOut, TRUE, &newsize);
|
||||||
|
|
||||||
SetConsoleScreenBufferSize(g_hConOut, coord);
|
SetConsoleScreenBufferSize(g_hConOut, coord);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -8926,14 +8921,14 @@ GetWin32Error(void)
|
|||||||
NULL, GetLastError(), 0, (LPSTR)&msg, 0, NULL);
|
NULL, GetLastError(), 0, (LPSTR)&msg, 0, NULL);
|
||||||
if (oldmsg != NULL)
|
if (oldmsg != NULL)
|
||||||
LocalFree(oldmsg);
|
LocalFree(oldmsg);
|
||||||
if (msg != NULL)
|
if (msg == NULL)
|
||||||
{
|
return NULL;
|
||||||
|
|
||||||
// remove trailing \r\n
|
// remove trailing \r\n
|
||||||
char *pcrlf = strstr(msg, "\r\n");
|
char *pcrlf = strstr(msg, "\r\n");
|
||||||
if (pcrlf != NULL)
|
if (pcrlf != NULL)
|
||||||
*pcrlf = '\0';
|
*pcrlf = '\0';
|
||||||
oldmsg = msg;
|
oldmsg = msg;
|
||||||
}
|
|
||||||
return msg;
|
return msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -695,6 +695,8 @@ 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 */
|
||||||
|
/**/
|
||||||
|
1208,
|
||||||
/**/
|
/**/
|
||||||
1207,
|
1207,
|
||||||
/**/
|
/**/
|
||||||
|
Loading…
x
Reference in New Issue
Block a user