Compare commits

..

4 Commits

Author SHA1 Message Date
Bram Moolenaar
11b73d668f updated for version 7.3.577
Problem:    Size of memory does not fit in 32 bit unsigned.
Solution:   Use Kbyte instead of byte.  Call GlobalMemoryStatusEx() instead of
            GlobalMemoryStatus() when available.
2012-06-29 15:51:30 +02:00
Bram Moolenaar
96b7ca5142 updated for version 7.3.576
Problem:    Formatting of lists inside comments is not right yet.
Solution:   Use another solution and add a test. (Tor Perkins)
2012-06-29 15:04:49 +02:00
Bram Moolenaar
89f940fcac updated for version 7.3.575
Problem:    "ygt" tries to yank instead of giving an error. (Daniel Mueller)
Solution:   Check for a pending operator.
2012-06-29 13:56:06 +02:00
Bram Moolenaar
e79abddb2f updated for version 7.3.574
Problem:    When pasting a register in the search command line a CTRL-L
            character is not pasted. (Dominique Pelle)
Solution:   Escape the CTRL-L. (Christian Brabandt)
2012-06-29 13:44:41 +02:00
12 changed files with 110 additions and 76 deletions

View File

@@ -6320,14 +6320,15 @@ internal_format(textwidth, second_indent, flags, format_only, c)
if (!(flags & INSCHAR_COM_LIST))
{
/*
* This section is for numeric lists w/o comments. If comment
* indents are needed with numeric lists (formatoptions=nq),
* then the INSCHAR_COM_LIST flag will cause the corresponding
* OPENLINE_COM_LIST flag to be passed through to open_line()
* (as seen above)...
* This section is for auto-wrap of numeric lists. When not
* in insert mode (i.e. format_lines()), the INSCHAR_COM_LIST
* flag will be set and open_line() will handle it (as seen
* above). The code here (and in get_number_indent()) will
* recognize comments if needed...
*/
if (second_indent < 0 && has_format_option(FO_Q_NUMBER))
second_indent = get_number_indent(curwin->w_cursor.lnum -1);
second_indent =
get_number_indent(curwin->w_cursor.lnum - 1);
if (second_indent >= 0)
{
#ifdef FEAT_VREPLACE
@@ -6335,8 +6336,32 @@ internal_format(textwidth, second_indent, flags, format_only, c)
change_indent(INDENT_SET, second_indent,
FALSE, NUL, TRUE);
else
#endif
#ifdef FEAT_COMMENTS
if (leader_len > 0 && second_indent - leader_len > 0)
{
int i;
int padding = second_indent - leader_len;
/* We started at the first_line of a numbered list
* that has a comment. the open_line() function has
* inserted the proper comment leader and positioned
* the cursor at the end of the split line. Now we
* add the additional whitespace needed after the
* comment leader for the numbered list. */
for (i = 0; i < padding; i++)
{
ins_str((char_u *)" ");
changed_bytes(curwin->w_cursor.lnum, leader_len);
}
}
else
{
#endif
(void)set_indent(second_indent, SIN_CHANGED);
#ifdef FEAT_COMMENTS
}
#endif
}
}
first_line = FALSE;

View File

@@ -3133,7 +3133,8 @@ cmdline_paste_str(s, literally)
else
#endif
c = *s++;
if (cv == Ctrl_V || c == ESC || c == Ctrl_C || c == CAR || c == NL
if (cv == Ctrl_V || c == ESC || c == Ctrl_C
|| c == CAR || c == NL || c == Ctrl_L
#ifdef UNIX
|| c == intr_char
#endif
@@ -4692,7 +4693,7 @@ ExpandFromContext(xp, pat, num_file, file, options)
if (tab[i].ic)
regmatch.rm_ic = TRUE;
ret = ExpandGeneric(xp, &regmatch, num_file, file,
tab[i].func, tab[i].escaped);
tab[i].func, tab[i].escaped);
break;
}
}
@@ -5125,7 +5126,7 @@ ExpandRTDir(pat, num_file, file, dirnames)
vim_free(matches);
}
if (ga.ga_len == 0)
return FAIL;
return FAIL;
/* Sort and remove duplicates which can happen when specifying multiple
* directories in dirnames. */

View File

@@ -424,68 +424,35 @@ get_number_indent(lnum)
colnr_T col;
pos_T pos;
regmatch_T regmatch;
int lead_len = 0; /* length of comment leader */
if (lnum > curbuf->b_ml.ml_line_count)
return -1;
pos.lnum = 0;
#ifdef FEAT_COMMENTS
if (has_format_option(FO_Q_COMS) && has_format_option(FO_Q_NUMBER))
{
regmatch_T regmatch;
int lead_len; /* length of comment leader */
/* In format_lines() (i.e. not insert mode), fo+=q is needed too... */
if ((State & INSERT) || has_format_option(FO_Q_COMS))
lead_len = get_leader_len(ml_get(lnum), NULL, FALSE, TRUE);
regmatch.regprog = vim_regcomp(curbuf->b_p_flp, RE_MAGIC);
if (regmatch.regprog != NULL)
{
regmatch.rm_ic = FALSE;
/* vim_regexec() expects a pointer to a line. This lets us
* start matching for the flp beyond any comment leader... */
if (vim_regexec(&regmatch, ml_get(lnum) + lead_len, (colnr_T)0))
{
pos.lnum = lnum;
pos.col = (colnr_T)(*regmatch.endp - ml_get(lnum));
#ifdef FEAT_VIRTUALEDIT
pos.coladd = 0;
#endif
}
}
vim_free(regmatch.regprog);
}
else
regmatch.regprog = vim_regcomp(curbuf->b_p_flp, RE_MAGIC);
if (regmatch.regprog != NULL)
{
/*
* What follows is the orig code that is not "comment aware"...
*
* I'm not sure if regmmatch_T (multi-match) is needed in this case.
* It may be true that this section would work properly using the
* regmatch_T code above, in which case, these two separate sections
* should be consolidated w/ FEAT_COMMENTS making lead_len > 0...
*/
#endif
regmmatch_T regmatch;
regmatch.rm_ic = FALSE;
regmatch.regprog = vim_regcomp(curbuf->b_p_flp, RE_MAGIC);
if (regmatch.regprog != NULL)
/* vim_regexec() expects a pointer to a line. This lets us
* start matching for the flp beyond any comment leader... */
if (vim_regexec(&regmatch, ml_get(lnum) + lead_len, (colnr_T)0))
{
regmatch.rmm_ic = FALSE;
regmatch.rmm_maxcol = 0;
if (vim_regexec_multi(&regmatch, curwin, curbuf,
lnum, (colnr_T)0, NULL))
{
pos.lnum = regmatch.endpos[0].lnum + lnum;
pos.col = regmatch.endpos[0].col;
pos.lnum = lnum;
pos.col = (colnr_T)(*regmatch.endp - ml_get(lnum));
#ifdef FEAT_VIRTUALEDIT
pos.coladd = 0;
pos.coladd = 0;
#endif
}
vim_free(regmatch.regprog);
}
#ifdef FEAT_COMMENTS
}
#endif
vim_free(regmatch.regprog);
if (pos.lnum == 0 || *ml_get_pos(&pos) == NUL)
return -1;

View File

@@ -815,6 +815,7 @@ vim_mem_profile_dump()
#else
# define KEEP_ROOM (2 * 8192L)
#endif
#define KEEP_ROOM_KB (KEEP_ROOM / 1024L)
/*
* Note: if unsigned is 16 bits we can only allocate up to 64K with alloc().
@@ -940,7 +941,7 @@ lalloc(size, message)
allocated = 0;
# endif
/* 3. check for available memory: call mch_avail_mem() */
if (mch_avail_mem(TRUE) < KEEP_ROOM && !releasing)
if (mch_avail_mem(TRUE) < KEEP_ROOM_KB && !releasing)
{
free((char *)p); /* System is low... no go! */
p = NULL;

View File

@@ -8393,10 +8393,12 @@ nv_g_cmd(cap)
#ifdef FEAT_WINDOWS
case 't':
goto_tabpage((int)cap->count0);
if (!checkclearop(oap))
goto_tabpage((int)cap->count0);
break;
case 'T':
goto_tabpage(-(int)cap->count1);
if (!checkclearop(oap))
goto_tabpage(-(int)cap->count1);
break;
#endif

View File

@@ -3154,7 +3154,7 @@ set_init_1()
{
#ifdef HAVE_AVAIL_MEM
/* Use amount of memory available at this moment. */
n = (mch_avail_mem(FALSE) >> 11);
n = (mch_avail_mem(FALSE) >> 1);
#else
# ifdef HAVE_TOTAL_MEM
/* Use amount of memory available to Vim. */
@@ -6702,7 +6702,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
{
for (s = *varp; *s;)
{
while(*s == ',' || *s == ' ')
while (*s == ',' || *s == ' ')
s++;
if (!*s)
break;
@@ -7391,7 +7391,7 @@ check_clipboard_option()
new_unnamed |= CLIP_UNNAMED;
p += 7;
}
else if (STRNCMP(p, "unnamedplus", 11) == 0
else if (STRNCMP(p, "unnamedplus", 11) == 0
&& (p[11] == ',' || p[11] == NUL))
{
new_unnamed |= CLIP_UNNAMED_PLUS;

View File

@@ -191,16 +191,16 @@ mch_char_avail()
}
/*
* Return amount of memory still available.
* Return amount of memory still available in Kbyte.
*/
long_u
mch_avail_mem(special)
int special;
{
#ifdef __amigaos4__
return (long_u)AvailMem(MEMF_ANY);
return (long_u)AvailMem(MEMF_ANY) >> 10;
#else
return (long_u)AvailMem(special ? (long)MEMF_CHIP : (long)MEMF_ANY);
return (long_u)(AvailMem(special ? (long)MEMF_CHIP : (long)MEMF_ANY)) >> 10;
#endif
}

View File

@@ -550,15 +550,15 @@ mch_update_cursor(void)
#endif
/*
* Return amount of memory currently available.
* Return amount of memory currently available in Kbyte.
*/
long_u
mch_avail_mem(int special)
{
#ifdef DJGPP
return _go32_dpmi_remaining_virtual_memory();
return _go32_dpmi_remaining_virtual_memory() >> 10;
#else
return coreleft();
return coreleft() >> 10;
#endif
}

View File

@@ -379,13 +379,13 @@ mch_breakcheck()
/*
* How much memory is available?
* How much memory is available in Kbyte?
*/
long_u
mch_avail_mem(
int special)
{
return GetFreeSpace(0);
return GetFreeSpace(0) >> 10;
}

View File

@@ -4992,18 +4992,29 @@ mch_breakcheck(void)
/*
* How much memory is available?
* How much memory is available in Kbyte?
* Return sum of available physical and page file memory.
*/
/*ARGSUSED*/
long_u
mch_avail_mem(int special)
{
MEMORYSTATUS ms;
if (g_PlatformId != VER_PLATFORM_WIN32_NT)
{
MEMORYSTATUS ms;
ms.dwLength = sizeof(MEMORYSTATUS);
GlobalMemoryStatus(&ms);
return (long_u) (ms.dwAvailPhys + ms.dwAvailPageFile);
ms.dwLength = sizeof(MEMORYSTATUS);
GlobalMemoryStatus(&ms);
return (long_u)((ms.dwAvailPhys + ms.dwAvailPageFile) >> 10);
}
else
{
MEMORYSTATUSEX ms;
ms.dwLength = sizeof(MEMORYSTATUSEX);
GlobalMemoryStatusEx(&ms);
return (long_u)((ms.ullAvailPhys + ms.ullAvailPageFile) >> 10);
}
}
#ifdef FEAT_MBYTE

View File

@@ -50,6 +50,17 @@ a b
#a b
}
STARTTEST
/^{/+1
:set tw=5 fo=tcn comments=:#
A bjA b
ENDTEST
{
1 a
# 1 a
}
STARTTEST
/^{/+1
:set tw=5 fo=qn comments=:#
@@ -82,6 +93,14 @@ ENDTEST
2bb
}
STARTTEST
/^#/
:setl tw=12 fo=tqnc comments=:#
A foobar
ENDTEST
# 1 xxxxx
STARTTEST
:g/^STARTTEST/.,/^ENDTEST/d
:1;/^Results/,$wq! test.out

View File

@@ -714,6 +714,14 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
577,
/**/
576,
/**/
575,
/**/
574,
/**/
573,
/**/