Compare commits

...

20 Commits

Author SHA1 Message Date
Bram Moolenaar
73881403a2 updated for version 7.2-100 2009-02-04 16:50:47 +00:00
Bram Moolenaar
faff14ae03 updated for version 7.2-099 2009-02-04 16:29:07 +00:00
Bram Moolenaar
b67cc16e02 updated for version 7.2-098 2009-02-04 15:27:06 +00:00
Bram Moolenaar
0725608d1a updated for version 7.2-097 2009-02-04 13:19:42 +00:00
Bram Moolenaar
65b9a6ad59 updated for version 7.2-096 2009-02-04 12:14:51 +00:00
Bram Moolenaar
57fb0da2f9 updated for version 7.2-095 2009-02-04 10:46:25 +00:00
Bram Moolenaar
5b3e460036 updated for version 7.2-094 2009-02-04 10:20:58 +00:00
Bram Moolenaar
3ca9a8a00d updated for version 7.2-093 2009-01-28 20:23:17 +00:00
Bram Moolenaar
7b76b0a0e9 updated for version 7.2-092 2009-01-28 18:09:38 +00:00
Bram Moolenaar
db867d50ba updated for version 7.2-091 2009-01-28 15:04:42 +00:00
Bram Moolenaar
a850a711fa updated for version 7.2-090 2009-01-28 14:42:59 +00:00
Bram Moolenaar
370feaf87f updated for version 7.2-089 2009-01-28 13:18:26 +00:00
Bram Moolenaar
282937bc56 updated for version 7.2-088 2009-01-22 20:50:10 +00:00
Bram Moolenaar
6bab9fa19a updated for version 7.2-087 2009-01-22 20:32:12 +00:00
Bram Moolenaar
5cc6a6e739 updated for version 7.2-086 2009-01-22 19:48:55 +00:00
Bram Moolenaar
6768a3305a updated for version 7.2-085 2009-01-22 17:33:49 +00:00
Bram Moolenaar
d72b386a63 updated for version 7.2-084 2009-01-13 17:11:05 +00:00
Bram Moolenaar
51460cd634 updated for version 7.2-083 2009-01-13 16:28:21 +00:00
Bram Moolenaar
1418a0d586 updated for version 7.2-082 2009-01-13 15:58:01 +00:00
Bram Moolenaar
c937213e08 updated for version 7.2-081 2009-01-13 15:38:37 +00:00
20 changed files with 361 additions and 67 deletions

View File

@@ -8,7 +8,7 @@
*/
/*
* diff.c: code for diff'ing two or three buffers.
* diff.c: code for diff'ing two, three or four buffers.
*/
#include "vim.h"
@@ -116,7 +116,7 @@ diff_buf_adjust(win)
* Add a buffer to make diffs for.
* Call this when a new buffer is being edited in the current window where
* 'diff' is set.
* Marks the current buffer as being part of the diff and requireing updating.
* Marks the current buffer as being part of the diff and requiring updating.
* This must be done before any autocmd, because a command may use info
* about the screen contents.
*/
@@ -929,7 +929,7 @@ ex_diffpatch(eap)
goto theend;
#ifdef UNIX
/* Temporaraly chdir to /tmp, to avoid patching files in the current
/* Temporarily chdir to /tmp, to avoid patching files in the current
* directory when the patch file contains more than one patch. When we
* have our own temp dir use that instead, it will be cleaned up when we
* exit (any .rej files created). Don't change directory if we can't
@@ -2129,6 +2129,8 @@ ex_diffgetput(eap)
EMSG2(_("E102: Can't find buffer \"%s\""), eap->arg);
return;
}
if (buf == curbuf)
return; /* nothing to do */
idx_other = diff_buf_idx(buf);
if (idx_other == DB_COUNT)
{

View File

@@ -1958,6 +1958,7 @@ backspace_until_column(col)
* Only matters when there are composing characters.
* Return TRUE when something was deleted.
*/
/*ARGSUSED*/
static int
del_char_after_col(limit_col)
int limit_col;
@@ -1971,7 +1972,7 @@ del_char_after_col(limit_col)
* skip forward again when going too far back because of a
* composing character. */
mb_adjust_cursor();
while (curwin->w_cursor.col < limit_col)
while (curwin->w_cursor.col < (colnr_T)limit_col)
{
int l = utf_ptr2len(ml_get_cursor());
@@ -4240,7 +4241,7 @@ ins_compl_get_exp(ini)
}
/* check if compl_curr_match has changed, (e.g. other type of
* expansion added somenthing) */
* expansion added something) */
if (type != 0 && compl_curr_match != old_match)
found_new_match = OK;
@@ -4741,7 +4742,7 @@ ins_complete(c)
}
compl_length = curwin->w_cursor.col - (int)compl_col;
/* IObuff is used to add a "word from the next line" would we
* have enough space? just being paranoic */
* have enough space? just being paranoid */
#define MIN_SPACE 75
if (compl_length > (IOSIZE - MIN_SPACE))
{
@@ -8206,7 +8207,7 @@ ins_ctrl_o()
/*
* If the cursor is on an indent, ^T/^D insert/delete one
* shiftwidth. Otherwise ^T/^D behave like a "<<" or ">>".
* Always round the indent to 'shiftwith', this is compatible
* Always round the indent to 'shiftwidth', this is compatible
* with vi. But vi only supports ^T and ^D after an
* autoindent, we support it everywhere.
*/

View File

@@ -3928,7 +3928,7 @@ eval0(arg, rettv, nextcmd, evaluate)
/*
* Handle top level expression:
* expr1 ? expr0 : expr0
* expr2 ? expr1 : expr1
*
* "arg" must point to the first non-white of the expression.
* "arg" is advanced to the next non-white after the recognized expression.
@@ -7918,9 +7918,9 @@ get_func_tv(name, len, rettv, arg, firstline, lastline, doesrange,
else if (!aborting())
{
if (argcount == MAX_FUNC_ARGS)
emsg_funcname("E740: Too many arguments for function %s", name);
emsg_funcname(N_("E740: Too many arguments for function %s"), name);
else
emsg_funcname("E116: Invalid arguments for function %s", name);
emsg_funcname(N_("E116: Invalid arguments for function %s"), name);
}
while (--argcount >= 0)
@@ -8153,6 +8153,7 @@ call_func(name, len, rettv, argcount, argvars, firstline, lastline,
/*
* Give an error message with a function name. Handle <SNR> things.
* "ermsg" is to be passed without translation, use N_() instead of _().
*/
static void
emsg_funcname(ermsg, name)
@@ -19867,7 +19868,7 @@ ex_function(eap)
}
}
else
emsg_funcname("E123: Undefined function: %s", name);
emsg_funcname(N_("E123: Undefined function: %s"), name);
}
goto ret_free;
}
@@ -19911,7 +19912,7 @@ ex_function(eap)
: eval_isnamec(arg[j])))
++j;
if (arg[j] != NUL)
emsg_funcname(_(e_invarg2), arg);
emsg_funcname((char *)e_invarg2, arg);
}
}
@@ -20183,7 +20184,7 @@ ex_function(eap)
v = find_var(name, &ht);
if (v != NULL && v->di_tv.v_type == VAR_FUNC)
{
emsg_funcname("E707: Function name conflicts with variable: %s",
emsg_funcname(N_("E707: Function name conflicts with variable: %s"),
name);
goto erret;
}
@@ -20198,7 +20199,7 @@ ex_function(eap)
}
if (fp->uf_calls > 0)
{
emsg_funcname("E127: Cannot redefine function %s: It is in use",
emsg_funcname(N_("E127: Cannot redefine function %s: It is in use"),
name);
goto erret;
}
@@ -21477,7 +21478,7 @@ call_user_func(fp, argcount, argvars, rettv, firstline, lastline, selfdict)
/*
* Return TRUE if items in "fc" do not have "copyID". That means they are not
* referenced from anywyere.
* referenced from anywhere.
*/
static int
can_free_funccal(fc, copyID)

View File

@@ -49,6 +49,7 @@ do_ascii(eap)
exarg_T *eap;
{
int c;
int cval;
char buf1[20];
char buf2[20];
char_u buf3[7];
@@ -75,6 +76,10 @@ do_ascii(eap)
{
if (c == NL) /* NUL is stored as NL */
c = NUL;
if (c == CAR && get_fileformat(curbuf) == EOL_MAC)
cval = NL; /* NL is stored as CR */
else
cval = c;
if (vim_isprintc_strict(c) && (c < ' '
#ifndef EBCDIC
|| c > '~'
@@ -94,7 +99,7 @@ do_ascii(eap)
buf2[0] = NUL;
vim_snprintf((char *)IObuff, IOSIZE,
_("<%s>%s%s %d, Hex %02x, Octal %03o"),
transchar(c), buf1, buf2, c, c, c);
transchar(c), buf1, buf2, cval, cval, cval);
#ifdef FEAT_MBYTE
if (enc_utf8)
c = cc[ci++];
@@ -2412,8 +2417,8 @@ print_line(lnum, use_number, list)
cursor_on(); /* msg_start() switches it off */
out_flush();
silent_mode = save_silent;
info_message = FALSE;
}
info_message = FALSE;
}
/*

View File

@@ -2842,6 +2842,7 @@ do_source(fname, check_other, is_vimrc)
linenr_T save_sourcing_lnum;
char_u *p;
char_u *fname_exp;
char_u *firstline = NULL;
int retval = FAIL;
#ifdef FEAT_EVAL
scid_T save_current_SID;
@@ -2992,23 +2993,6 @@ do_source(fname, check_other, is_vimrc)
cookie.level = ex_nesting_level;
#endif
#ifdef FEAT_MBYTE
cookie.conv.vc_type = CONV_NONE; /* no conversion */
/* Try reading the first few bytes to check for a UTF-8 BOM. */
{
char_u buf[3];
if (fread((char *)buf, sizeof(char_u), (size_t)3, cookie.fp)
== (size_t)3
&& buf[0] == 0xef && buf[1] == 0xbb && buf[2] == 0xbf)
/* Found BOM, setup conversion and skip over it. */
convert_setup(&cookie.conv, (char_u *)"utf-8", p_enc);
else
/* No BOM found, rewind. */
fseek(cookie.fp, 0L, SEEK_SET);
}
#endif
/*
* Keep the sourcing name/lnum, for recursive calls.
@@ -3018,6 +3002,25 @@ do_source(fname, check_other, is_vimrc)
save_sourcing_lnum = sourcing_lnum;
sourcing_lnum = 0;
#ifdef FEAT_MBYTE
cookie.conv.vc_type = CONV_NONE; /* no conversion */
/* Read the first line so we can check for a UTF-8 BOM. */
firstline = getsourceline(0, (void *)&cookie, 0);
if (firstline != NULL && STRLEN(firstline) >= 3 && firstline[0] == 0xef
&& firstline[1] == 0xbb && firstline[2] == 0xbf)
{
/* Found BOM; setup conversion, skip over BOM and recode the line. */
convert_setup(&cookie.conv, (char_u *)"utf-8", p_enc);
p = string_convert(&cookie.conv, firstline + 3, NULL);
if (p != NULL)
{
vim_free(firstline);
firstline = p;
}
}
#endif
#ifdef STARTUPTIME
time_push(&tv_rel, &tv_start);
#endif
@@ -3111,9 +3114,8 @@ do_source(fname, check_other, is_vimrc)
/*
* Call do_cmdline, which will call getsourceline() to get the lines.
*/
do_cmdline(NULL, getsourceline, (void *)&cookie,
do_cmdline(firstline, getsourceline, (void *)&cookie,
DOCMD_VERBOSE|DOCMD_NOWAIT|DOCMD_REPEAT);
retval = OK;
#ifdef FEAT_PROFILE
@@ -3171,6 +3173,7 @@ almosttheend:
#endif
fclose(cookie.fp);
vim_free(cookie.nextline);
vim_free(firstline);
#ifdef FEAT_MBYTE
convert_setup(&cookie.conv, NULL, NULL);
#endif

View File

@@ -5482,6 +5482,9 @@ invalid_count:
return OK;
}
/*
* ":command ..."
*/
static void
ex_command(eap)
exarg_T *eap;
@@ -5914,6 +5917,7 @@ do_ucmd(eap)
char_u *start;
char_u *end;
char_u *ksp;
size_t len, totlen;
size_t split_len = 0;
@@ -5930,16 +5934,51 @@ do_ucmd(eap)
/*
* Replace <> in the command by the arguments.
* First round: "buf" is NULL, compute length, allocate "buf".
* Second round: copy result into "buf".
*/
buf = NULL;
for (;;)
{
p = cmd->uc_rep;
q = buf;
p = cmd->uc_rep; /* source */
q = buf; /* destinateion */
totlen = 0;
while ((start = vim_strchr(p, '<')) != NULL
&& (end = vim_strchr(start + 1, '>')) != NULL)
for (;;)
{
start = vim_strchr(p, '<');
if (start != NULL)
end = vim_strchr(start + 1, '>');
if (buf != NULL)
{
ksp = vim_strchr(p, K_SPECIAL);
if (ksp != NULL && (start == NULL || ksp < start || end == NULL)
&& ((ksp[1] == KS_SPECIAL && ksp[2] == KE_FILLER)
# ifdef FEAT_GUI
|| (ksp[1] == KS_EXTRA && ksp[2] == (int)KE_CSI)
# endif
))
{
/* K_SPECIAL han been put in the buffer as K_SPECIAL
* KS_SPECIAL KE_FILLER, like for mappings, but
* do_cmdline() doesn't handle that, so convert it back.
* Also change K_SPECIAL KS_EXTRA KE_CSI into CSI. */
len = ksp - p;
if (len > 0)
{
mch_memmove(q, p, len);
q += len;
}
*q++ = ksp[1] == KS_SPECIAL ? K_SPECIAL : CSI;
p = ksp + 3;
continue;
}
}
/* break if there no <item> is found */
if (start == NULL || end == NULL)
break;
/* Include the '>' */
++end;

View File

@@ -1582,6 +1582,17 @@ gui_mch_init(void)
s_findrep_struct.lpstrReplaceWith[0] = NUL;
s_findrep_struct.wFindWhatLen = MSWIN_FR_BUFSIZE;
s_findrep_struct.wReplaceWithLen = MSWIN_FR_BUFSIZE;
# if defined(FEAT_MBYTE) && defined(WIN3264)
s_findrep_struct_w.lStructSize = sizeof(s_findrep_struct_w);
s_findrep_struct_w.lpstrFindWhat =
(LPWSTR)alloc(MSWIN_FR_BUFSIZE * sizeof(WCHAR));
s_findrep_struct_w.lpstrFindWhat[0] = NUL;
s_findrep_struct_w.lpstrReplaceWith =
(LPWSTR)alloc(MSWIN_FR_BUFSIZE * sizeof(WCHAR));
s_findrep_struct_w.lpstrReplaceWith[0] = NUL;
s_findrep_struct_w.wFindWhatLen = MSWIN_FR_BUFSIZE;
s_findrep_struct_w.wReplaceWithLen = MSWIN_FR_BUFSIZE;
# endif
#endif
theend:
@@ -2938,8 +2949,27 @@ dialog_callback(
/* If the edit box exists, copy the string. */
if (s_textfield != NULL)
GetDlgItemText(hwnd, DLG_NONBUTTON_CONTROL + 2,
{
# if defined(FEAT_MBYTE) && defined(WIN3264)
/* If the OS is Windows NT, and 'encoding' differs from active
* codepage: use wide function and convert text. */
if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT
&& enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{
WCHAR *wp = (WCHAR *)alloc(IOSIZE * sizeof(WCHAR));
char_u *p;
GetDlgItemTextW(hwnd, DLG_NONBUTTON_CONTROL + 2, wp, IOSIZE);
p = utf16_to_enc(wp, NULL);
vim_strncpy(s_textfield, p, IOSIZE);
vim_free(p);
vim_free(wp);
}
else
# endif
GetDlgItemText(hwnd, DLG_NONBUTTON_CONTROL + 2,
s_textfield, IOSIZE);
}
/*
* Need to check for IDOK because if the user just hits Return to

View File

@@ -153,6 +153,9 @@ static int destroying = FALSE; /* call DestroyWindow() ourselves */
#ifdef MSWIN_FIND_REPLACE
static UINT s_findrep_msg = 0; /* set in gui_w[16/32].c */
static FINDREPLACE s_findrep_struct;
# if defined(FEAT_MBYTE) && defined(WIN3264)
static FINDREPLACEW s_findrep_struct_w;
# endif
static HWND s_findrep_hwnd = NULL;
static int s_findrep_is_find; /* TRUE for find dialog, FALSE
for find/replace dialog */
@@ -884,6 +887,45 @@ _OnMenu(
#endif
#ifdef MSWIN_FIND_REPLACE
# if defined(FEAT_MBYTE) && defined(WIN3264)
/*
* copy useful data from structure LPFINDREPLACE to structure LPFINDREPLACEW
*/
static void
findrep_atow(LPFINDREPLACEW lpfrw, LPFINDREPLACE lpfr)
{
WCHAR *wp;
lpfrw->hwndOwner = lpfr->hwndOwner;
lpfrw->Flags = lpfr->Flags;
wp = enc_to_utf16(lpfr->lpstrFindWhat, NULL);
wcsncpy(lpfrw->lpstrFindWhat, wp, lpfrw->wFindWhatLen - 1);
vim_free(wp);
/* the field "lpstrReplaceWith" doesn't need to be copied */
}
/*
* copy useful data from structure LPFINDREPLACEW to structure LPFINDREPLACE
*/
static void
findrep_wtoa(LPFINDREPLACE lpfr, LPFINDREPLACEW lpfrw)
{
char_u *p;
lpfr->Flags = lpfrw->Flags;
p = utf16_to_enc(lpfrw->lpstrFindWhat, NULL);
vim_strncpy(lpfr->lpstrFindWhat, p, lpfr->wFindWhatLen - 1);
vim_free(p);
p = utf16_to_enc(lpfrw->lpstrReplaceWith, NULL);
vim_strncpy(lpfr->lpstrReplaceWith, p, lpfr->wReplaceWithLen - 1);
vim_free(p);
}
# endif
/*
* Handle a Find/Replace window message.
*/
@@ -893,6 +935,16 @@ _OnFindRepl(void)
int flags = 0;
int down;
# if defined(FEAT_MBYTE) && defined(WIN3264)
/* If the OS is Windows NT, and 'encoding' differs from active codepage:
* convert text from wide string. */
if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT
&& enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{
findrep_wtoa(&s_findrep_struct, &s_findrep_struct_w);
}
# endif
if (s_findrep_struct.Flags & FR_DIALOGTERM)
/* Give main window the focus back. */
(void)SetFocus(s_hwnd);
@@ -1663,8 +1715,17 @@ process_message(void)
if (msg.message == WM_OLE)
{
char_u *str = (char_u *)msg.lParam;
add_to_input_buf(str, (int)STRLEN(str));
vim_free(str);
if (str == NULL || *str == NUL)
{
/* Message can't be ours, forward it. Fixes problem with Ultramon
* 3.0.4 */
DispatchMessage(&msg);
}
else
{
add_to_input_buf(str, (int)STRLEN(str));
vim_free(str); /* was allocated in CVim::SendKeys() */
}
return;
}
#endif
@@ -2553,7 +2614,19 @@ gui_mch_find_dialog(exarg_T *eap)
if (!IsWindow(s_findrep_hwnd))
{
initialise_findrep(eap->arg);
s_findrep_hwnd = FindText((LPFINDREPLACE) &s_findrep_struct);
# if defined(FEAT_MBYTE) && defined(WIN3264)
/* If the OS is Windows NT, and 'encoding' differs from active
* codepage: convert text and use wide function. */
if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT
&& enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{
findrep_atow(&s_findrep_struct_w, &s_findrep_struct);
s_findrep_hwnd = FindTextW(
(LPFINDREPLACEW) &s_findrep_struct_w);
}
else
# endif
s_findrep_hwnd = FindText((LPFINDREPLACE) &s_findrep_struct);
}
set_window_title(s_findrep_hwnd,
@@ -2578,7 +2651,18 @@ gui_mch_replace_dialog(exarg_T *eap)
if (!IsWindow(s_findrep_hwnd))
{
initialise_findrep(eap->arg);
s_findrep_hwnd = ReplaceText((LPFINDREPLACE) &s_findrep_struct);
# if defined(FEAT_MBYTE) && defined(WIN3264)
if (os_version.dwPlatformId == VER_PLATFORM_WIN32_NT
&& enc_codepage >= 0 && (int)GetACP() != enc_codepage)
{
findrep_atow(&s_findrep_struct_w, &s_findrep_struct);
s_findrep_hwnd = ReplaceTextW(
(LPFINDREPLACEW) &s_findrep_struct_w);
}
else
# endif
s_findrep_hwnd = ReplaceText(
(LPFINDREPLACE) &s_findrep_struct);
}
set_window_title(s_findrep_hwnd,

View File

@@ -1177,8 +1177,16 @@ cs_help(eap)
(void)MSG_PUTS(_("cscope commands:\n"));
while (cmdp->name != NULL)
{
(void)smsg((char_u *)_("%-5s: %-30s (Usage: %s)"),
cmdp->name, _(cmdp->help), cmdp->usage);
char *help = _(cmdp->help);
int space_cnt = 30 - vim_strsize((char_u *)help);
/* Use %*s rather than %30s to ensure proper alignment in utf-8 */
if (space_cnt < 0)
space_cnt = 0;
(void)smsg((char_u *)_("%-5s: %s%*s (Usage: %s)"),
cmdp->name,
help, space_cnt, " ",
cmdp->usage);
if (strcmp(cmdp->name, "find") == 0)
MSG_PUTS(_("\n"
" c: Find functions calling this function\n"

View File

@@ -353,9 +353,13 @@ CVim::SendKeys(BSTR keys)
}
/* Pass the string to the main input loop. The memory will be freed when
* the message is processed.
* the message is processed. Except for an empty message, we don't need
* to post it then.
*/
PostMessage(NULL, WM_OLE, 0, (LPARAM)str);
if (*str == NUL)
vim_free(str);
else
PostMessage(NULL, WM_OLE, 0, (LPARAM)str);
return S_OK;
}

View File

@@ -1151,14 +1151,23 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookupDict)
/* Check if we run into a recursive loop. The item must be in lookupDict
* then and we can use it again. */
sprintf(ptrBuf, PRINTF_DECIMAL_LONG_U, (long_u)our_tv);
result = PyDict_GetItemString(lookupDict, ptrBuf);
if (result != NULL)
Py_INCREF(result);
else if (our_tv->v_type == VAR_STRING)
if ((our_tv->v_type == VAR_LIST && our_tv->vval.v_list != NULL)
|| (our_tv->v_type == VAR_DICT && our_tv->vval.v_dict != NULL))
{
sprintf(ptrBuf, PRINTF_DECIMAL_LONG_U,
our_tv->v_type == VAR_LIST ? (long_u)our_tv->vval.v_list
: (long_u)our_tv->vval.v_dict);
result = PyDict_GetItemString(lookupDict, ptrBuf);
if (result != NULL)
{
Py_INCREF(result);
return result;
}
}
if (our_tv->v_type == VAR_STRING)
{
result = Py_BuildValue("s", our_tv->vval.v_string);
PyDict_SetItemString(lookupDict, ptrBuf, result);
}
else if (our_tv->v_type == VAR_NUMBER)
{
@@ -1167,7 +1176,6 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookupDict)
/* For backwards compatibility numbers are stored as strings. */
sprintf(buf, "%ld", (long)our_tv->vval.v_number);
result = Py_BuildValue("s", buf);
PyDict_SetItemString(lookupDict, ptrBuf, result);
}
# ifdef FEAT_FLOAT
else if (our_tv->v_type == VAR_FLOAT)
@@ -1176,7 +1184,6 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookupDict)
sprintf(buf, "%f", our_tv->vval.v_float);
result = Py_BuildValue("s", buf);
PyDict_SetItemString(lookupDict, ptrBuf, result);
}
# endif
else if (our_tv->v_type == VAR_LIST)
@@ -1185,10 +1192,11 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookupDict)
listitem_T *curr;
result = PyList_New(0);
PyDict_SetItemString(lookupDict, ptrBuf, result);
if (list != NULL)
{
PyDict_SetItemString(lookupDict, ptrBuf, result);
for (curr = list->lv_first; curr != NULL; curr = curr->li_next)
{
newObj = VimToPython(&curr->li_tv, depth + 1, lookupDict);
@@ -1200,7 +1208,6 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookupDict)
else if (our_tv->v_type == VAR_DICT)
{
result = PyDict_New();
PyDict_SetItemString(lookupDict, ptrBuf, result);
if (our_tv->vval.v_dict != NULL)
{
@@ -1209,6 +1216,8 @@ VimToPython(typval_T *our_tv, int depth, PyObject *lookupDict)
hashitem_T *hi;
dictitem_T *di;
PyDict_SetItemString(lookupDict, ptrBuf, result);
for (hi = ht->ht_array; todo > 0; ++hi)
{
if (!HASHITEM_EMPTY(hi))

View File

@@ -4556,7 +4556,13 @@ vim_snprintf(str, str_m, fmt, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10)
remove_trailing_zeroes = TRUE;
}
if (fmt_spec == 'f' && abs_f > 1.0e307)
if (fmt_spec == 'f' &&
#ifdef VAX
abs_f > 1.0e38
#else
abs_f > 1.0e307
#endif
)
{
/* Avoid a buffer overflow */
strcpy(tmp, "inf");

View File

@@ -4696,7 +4696,8 @@ vim_findfile(search_ctx_arg)
stackp->ffs_filearray_cur = i + 1;
ff_push(search_ctx, stackp);
simplify_filename(file_path);
if (!path_with_url(file_path))
simplify_filename(file_path);
if (mch_dirname(ff_expand_buffer, MAXPATHL)
== OK)
{

View File

@@ -6783,6 +6783,8 @@ nv_replace(cap)
/* Visual mode "r" */
if (VIsual_active)
{
if (got_int)
reset_VIsual();
nv_operator(cap);
return;
}
@@ -7839,7 +7841,7 @@ nv_g_cmd(cap)
else
i = curwin->w_leftcol;
/* Go to the middle of the screen line. When 'number' is on and lines
* are wrapping the middle can be more to the left.*/
* are wrapping the middle can be more to the left. */
if (cap->nchar == 'm')
i += (W_WIDTH(curwin) - curwin_col_off()
+ ((curwin->w_p_wrap && i > 0)

View File

@@ -5407,6 +5407,10 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
int did_chartab = FALSE;
char_u **gvarp;
long_u free_oldval = (options[opt_idx].flags & P_ALLOCED);
#ifdef FEAT_GUI
/* set when changing an option that only requires a redraw in the GUI */
int redraw_gui_only = FALSE;
#endif
/* Get the global option to compare with, otherwise we would have to check
* two values for all local options. */
@@ -6055,6 +6059,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
errmsg = (char_u *)N_("E596: Invalid font(s)");
}
}
redraw_gui_only = TRUE;
}
# ifdef FEAT_XFONTSET
else if (varp == &p_guifontset)
@@ -6063,6 +6068,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
errmsg = (char_u *)N_("E597: can't select fontset");
else if (gui.in_use && gui_init_font(p_guifontset, TRUE) != OK)
errmsg = (char_u *)N_("E598: Invalid fontset");
redraw_gui_only = TRUE;
}
# endif
# ifdef FEAT_MBYTE
@@ -6072,6 +6078,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
errmsg = (char_u *)N_("E533: can't select wide font");
else if (gui_get_wide_font() == FAIL)
errmsg = (char_u *)N_("E534: Invalid wide font");
redraw_gui_only = TRUE;
}
# endif
#endif
@@ -6133,13 +6140,24 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
#ifdef FEAT_GUI
/* 'guioptions' */
else if (varp == &p_go)
{
gui_init_which_components(oldval);
redraw_gui_only = TRUE;
}
#endif
#if defined(FEAT_GUI_TABLINE)
/* 'guitablabel' */
else if (varp == &p_gtl)
{
redraw_tabline = TRUE;
redraw_gui_only = TRUE;
}
/* 'guitabtooltip' */
else if (varp == &p_gtt)
{
redraw_gui_only = TRUE;
}
#endif
#if defined(FEAT_MOUSE_TTY) && (defined(UNIX) || defined(VMS))
@@ -6717,7 +6735,11 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
if (curwin->w_curswant != MAXCOL)
curwin->w_set_curswant = TRUE; /* in case 'showbreak' changed */
check_redraw(options[opt_idx].flags);
#ifdef FEAT_GUI
/* check redraw when it's not a GUI option or the GUI is active. */
if (!redraw_gui_only || gui.in_use)
#endif
check_redraw(options[opt_idx].flags);
return errmsg;
}

View File

@@ -1223,6 +1223,25 @@ utf16_to_enc(short_u *str, int *lenp)
}
#endif /* FEAT_MBYTE */
/*
* Wait for another process to Close the Clipboard.
* Returns TRUE for success.
*/
int
vim_open_clipboard()
{
int delay = 10;
while (!OpenClipboard(NULL))
{
if (delay > 500)
return FALSE; /* waited too long, give up */
Sleep(delay);
delay *= 2; /* wait for 10, 20, 40, 80, etc. msec */
}
return TRUE;
}
/*
* Get the current selection and put it in the clipboard register.
*
@@ -1254,7 +1273,7 @@ clip_mch_request_selection(VimClipboard *cbd)
* Don't pass GetActiveWindow() as an argument to OpenClipboard() because
* then we can't paste back into the same window for some reason - webb.
*/
if (!OpenClipboard(NULL))
if (!vim_open_clipboard())
return;
/* Check for vim's own clipboard format first. This only gets the type of
@@ -1562,7 +1581,7 @@ clip_mch_set_selection(VimClipboard *cbd)
* because then we can't paste back into the same window for some
* reason - webb.
*/
if (OpenClipboard(NULL))
if (vim_open_clipboard())
{
if (EmptyClipboard())
{

View File

@@ -3950,7 +3950,17 @@ mch_call_shell(cmd, options)
* children can be kill()ed. Don't do this when using pipes,
* because stdin is not a tty, we would lose /dev/tty. */
if (p_stmp)
{
(void)setsid();
# if defined(SIGHUP)
/* When doing "!xterm&" and 'shell' is bash: the shell
* will exit and send SIGHUP to all processes in its
* group, killing the just started process. Ignore SIGHUP
* to avoid that. (suggested by Simon Schubert)
*/
signal(SIGHUP, SIG_IGN);
# endif
}
# endif
# ifdef FEAT_GUI
if (pty_slave_fd >= 0)

View File

@@ -515,7 +515,7 @@ do_tag(tag, type, count, forceit, verbose)
* If a count is supplied to the ":tag <name>" command, then
* jump to count'th matching tag.
*/
if (type == DT_TAG && count > 0)
if (type == DT_TAG && *tag != NUL && count > 0)
cur_match = count - 1;
if (type == DT_SELECT || type == DT_JUMP

View File

@@ -4920,7 +4920,15 @@ check_termcode(max_offset, buf, buflen)
key_name[0] = KEY2TERMCAP0(key);
key_name[1] = KEY2TERMCAP1(key);
if (key_name[0] == KS_KEY)
string[new_slen++] = key_name[1]; /* from ":set <M-b>=xx" */
{
/* from ":set <M-b>=xx" */
#ifdef FEAT_MBYTE
if (has_mbyte)
new_slen += (*mb_char2bytes)(key_name[1], string + new_slen);
else
#endif
string[new_slen++] = key_name[1];
}
else
{
string[new_slen++] = K_SPECIAL;

View File

@@ -676,6 +676,46 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
100,
/**/
99,
/**/
98,
/**/
97,
/**/
96,
/**/
95,
/**/
94,
/**/
93,
/**/
92,
/**/
91,
/**/
90,
/**/
89,
/**/
88,
/**/
87,
/**/
86,
/**/
85,
/**/
84,
/**/
83,
/**/
82,
/**/
81,
/**/
80,
/**/