Compare commits

...

9 Commits

Author SHA1 Message Date
Bram Moolenaar
da4d7a92d5 updated for version 7.2.348
Problem:    Unicode double-width characters are not up-to date.
Solution:   Produce the double-width table like the others.
2010-01-27 18:29:26 +01:00
Bram Moolenaar
0dbf720d86 updated for version 7.2.347
Problem:    Crash when executing <expr> mapping redefines that same mapping.
Solution:   Save the values used before evaluating the expression.
2010-01-27 17:31:43 +01:00
Bram Moolenaar
38ef43b262 updated for version 7.2.346
Problem:    Repeating a command with @: causes a mapping to be applied twice.
Solution:   Do not remap characters inserted in the typeahead buffer. (Kana
            Natsuno)
2010-01-27 16:31:13 +01:00
Bram Moolenaar
5075aad6a8 updated for version 7.2.345
Problem:    Tab line is not updated when the value of 'bt' is changed.
Solution:   Call redraw_titles(). (Lech Lorens)
2010-01-27 15:58:13 +01:00
Bram Moolenaar
7ad01410da Add more pathdef.c to .hgignore. 2010-01-20 21:56:50 +01:00
Bram Moolenaar
8d8ef0b0b9 updated for version 7.2.344
Problem:    Can't compile on some systems
Solution:   Move the #ifdef outside of the mch_open macro. (Patrick Texier)
2010-01-20 21:41:47 +01:00
Bram Moolenaar
fc307fa1a6 updated for version 7.2.343
Problem:    Can't compile on Win32.
Solution:   Insert the missing bar.
2010-01-19 23:30:41 +01:00
Bram Moolenaar
d836bb90ab updated for version 7.2.342
Problem:    Popup menu displayed wrong in 'rightleft' mode when there are
            multi-byte characters.
Solution:   Adjust the column computations. (Dominique Pelle)
2010-01-19 18:06:03 +01:00
Bram Moolenaar
e4ebd29ea9 updated for version 7.2.341
Problem:    Popup menu wraps to next line when double-wide character doesn't
            fit. (Jiang Ma)
Solution:   Display a ">" instead. (Dominique Pelle)
2010-01-19 17:40:46 +01:00
10 changed files with 173 additions and 53 deletions

1
.gitignore vendored
View File

@@ -28,6 +28,7 @@ src/auto/pathdef.c
*.res
*.RES
src/pathdef.c
src/Obj*/pathdef.c
gvimext.dll
gvimext.lib

View File

@@ -187,16 +187,27 @@ func! BuildCombiningTable()
wincmd p
endfunc
" Build the ambiguous table in a new buffer.
" Build the double width or ambiguous width table in a new buffer.
" Uses s:widthprops and s:dataprops.
func! BuildAmbiguousTable()
func! BuildWidthTable(pattern, tableName)
let start = -1
let end = -1
let ranges = []
let dataidx = 0
for p in s:widthprops
if p[1][0] == 'A'
let n = ('0x' . p[0]) + 0
if p[1][0] =~ a:pattern
if p[0] =~ '\.\.'
" It is a range. we don't check for composing char then.
let rng = split(p[0], '\.\.')
if len(rng) != 2
echoerr "Cannot parse range: '" . p[0] . "' in width table"
endif
let n = ('0x' . rng[0]) + 0
let n_last = ('0x' . rng[1]) + 0
else
let n = ('0x' . p[0]) + 0
let n_last = n
endif
" Find this char in the data table.
while 1
let dn = ('0x' . s:dataprops[dataidx][0]) + 0
@@ -205,27 +216,23 @@ func! BuildAmbiguousTable()
endif
let dataidx += 1
endwhile
if dn != n
if dn != n && n_last == n
echoerr "Cannot find character " . n . " in data table"
endif
" Only use the char when it's not a composing char.
" But use all chars from a range.
let dp = s:dataprops[dataidx]
if dp[2] != 'Mn' && dp[2] != 'Mc' && dp[2] != 'Me'
if n_last > n || (dp[2] != 'Mn' && dp[2] != 'Mc' && dp[2] != 'Me')
if start >= 0 && end + 1 == n
" continue with same range.
let end = n
else
if start >= 0
" produce previous range
call add(ranges, printf("\t{0x%04x, 0x%04x},", start, end))
endif
let start = n
if p[0] =~ '\.\.'
let end = ('0x' . substitute(p[0], '.*\.\.', '', '')) + 0
else
let end = n
endif
endif
let end = n_last
endif
endif
endfor
@@ -235,8 +242,8 @@ func! BuildAmbiguousTable()
" New buffer to put the result in.
new
file ambiguous
call setline(1, " static struct interval ambiguous[] =")
exe "file " . a:tableName
call setline(1, " static struct interval " . a:tableName . "[] =")
call setline(2, " {")
call append('$', ranges)
call setline('$', getline('$')[:-2]) " remove last comma
@@ -276,5 +283,8 @@ edit http://www.unicode.org/Public/UNIDATA/EastAsianWidth.txt
" Parse each line, create a list of lists.
call ParseWidthProps()
" Build the ambiguous table.
call BuildAmbiguousTable()
" Build the double width table.
call BuildWidthTable('[WF]', 'doublewidth')
" Build the ambiguous width table.
call BuildWidthTable('A', 'ambiguous')

View File

@@ -2814,11 +2814,11 @@ static FILE *fopen_noinh_readbin __ARGS((char *filename));
fopen_noinh_readbin(filename)
char *filename;
{
int fd_tmp = mch_open(filename, O_RDONLY
# ifdef WIN32
O_BINARY | O_NOINHERIT
int fd_tmp = mch_open(filename, O_RDONLY | O_BINARY | O_NOINHERIT, 0);
# else
int fd_tmp = mch_open(filename, O_RDONLY, 0);
# endif
, 0);
if (fd_tmp == -1)
return NULL;

View File

@@ -2389,6 +2389,17 @@ vgetorpeek(advance)
/* complete match */
if (keylen >= 0 && keylen <= typebuf.tb_len)
{
#ifdef FEAT_EVAL
int save_m_expr;
int save_m_noremap;
int save_m_silent;
char_u *save_m_keys;
char_u *save_m_str;
#else
# define save_m_noremap mp->m_noremap
# define save_m_silent mp->m_silent
#endif
/* write chars to script file(s) */
if (keylen > typebuf.tb_maplen)
gotchars(typebuf.tb_buf + typebuf.tb_off
@@ -2431,6 +2442,16 @@ vgetorpeek(advance)
#endif
#ifdef FEAT_EVAL
/* Copy the values from *mp that are used, because
* evaluating the expression may invoke a function
* that redefines the mapping, thereby making *mp
* invalid. */
save_m_expr = mp->m_expr;
save_m_noremap = mp->m_noremap;
save_m_silent = mp->m_silent;
save_m_keys = NULL; /* only saved when needed */
save_m_str = NULL; /* only saved when needed */
/*
* Handle ":map <expr>": evaluate the {rhs} as an
* expression. Save and restore the typeahead so that
@@ -2446,7 +2467,9 @@ vgetorpeek(advance)
if (tabuf.typebuf_valid)
{
vgetc_busy = 0;
s = eval_map_expr(mp->m_str, NUL);
save_m_keys = vim_strsave(mp->m_keys);
save_m_str = vim_strsave(mp->m_str);
s = eval_map_expr(save_m_str, NUL);
vgetc_busy = save_vgetc_busy;
}
else
@@ -2470,17 +2493,25 @@ vgetorpeek(advance)
else
{
i = ins_typebuf(s,
mp->m_noremap != REMAP_YES
? mp->m_noremap
: STRNCMP(s, mp->m_keys,
save_m_noremap != REMAP_YES
? save_m_noremap
: STRNCMP(s,
#ifdef FEAT_EVAL
save_m_keys != NULL ? save_m_keys :
#endif
mp->m_keys,
(size_t)keylen) != 0
? REMAP_YES : REMAP_SKIP,
0, TRUE, cmd_silent || mp->m_silent);
0, TRUE, cmd_silent || save_m_silent);
#ifdef FEAT_EVAL
if (mp->m_expr)
if (save_m_expr)
vim_free(s);
#endif
}
#ifdef FEAT_EVAL
vim_free(save_m_keys);
vim_free(save_m_str);
#endif
if (i == FAIL)
{
c = -1;

View File

@@ -1200,6 +1200,49 @@ intable(table, size, c)
utf_char2cells(c)
int c;
{
/* Sorted list of non-overlapping intervals of East Asian double width
* characters, generated with ../runtime/tools/unicode.vim. */
static struct interval doublewidth[] =
{
{0x1100, 0x115f},
{0x11a3, 0x11a7},
{0x11fa, 0x11ff},
{0x2329, 0x232a},
{0x2e80, 0x2e99},
{0x2e9b, 0x2ef3},
{0x2f00, 0x2fd5},
{0x2ff0, 0x2ffb},
{0x3000, 0x3029},
{0x3030, 0x303e},
{0x3041, 0x3096},
{0x309b, 0x30ff},
{0x3105, 0x312d},
{0x3131, 0x318e},
{0x3190, 0x31b7},
{0x31c0, 0x31e3},
{0x31f0, 0x321e},
{0x3220, 0x3247},
{0x3250, 0x32fe},
{0x3300, 0x4dbf},
{0x4e00, 0xa48c},
{0xa490, 0xa4c6},
{0xa960, 0xa97c},
{0xac00, 0xd7a3},
{0xd7b0, 0xd7c6},
{0xd7cb, 0xd7fb},
{0xf900, 0xfaff},
{0xfe10, 0xfe19},
{0xfe30, 0xfe52},
{0xfe54, 0xfe66},
{0xfe68, 0xfe6b},
{0xff01, 0xff60},
{0xffe0, 0xffe6},
{0x1f200, 0x1f200},
{0x1f210, 0x1f231},
{0x1f240, 0x1f248},
{0x20000, 0x2fffd},
{0x30000, 0x3fffd}
};
/* Sorted list of non-overlapping intervals of East Asian Ambiguous
* characters, generated with ../runtime/tools/unicode.vim. */
static struct interval ambiguous[] =
@@ -1403,20 +1446,7 @@ utf_char2cells(c)
#else
if (!utf_printable(c))
return 6; /* unprintable, displays <xxxx> */
if (c >= 0x1100
&& (c <= 0x115f /* Hangul Jamo */
|| c == 0x2329
|| c == 0x232a
|| (c >= 0x2e80 && c <= 0xa4cf
&& c != 0x303f) /* CJK ... Yi */
|| (c >= 0xac00 && c <= 0xd7a3) /* Hangul Syllables */
|| (c >= 0xf900 && c <= 0xfaff) /* CJK Compatibility
Ideographs */
|| (c >= 0xfe30 && c <= 0xfe6f) /* CJK Compatibility Forms */
|| (c >= 0xff00 && c <= 0xff60) /* Fullwidth Forms */
|| (c >= 0xffe0 && c <= 0xffe6)
|| (c >= 0x20000 && c <= 0x2fffd)
|| (c >= 0x30000 && c <= 0x3fffd)))
if (intable(doublewidth, sizeof(doublewidth), c))
return 2;
#endif
}

View File

@@ -1301,10 +1301,16 @@ put_reedit_in_typebuf(silent)
}
}
/*
* Insert register contents "s" into the typeahead buffer, so that it will be
* executed again.
* When "esc" is TRUE it is to be taken literally: Escape CSI characters and
* no remapping.
*/
static int
put_in_typebuf(s, esc, colon, silent)
char_u *s;
int esc; /* Escape CSI characters */
int esc;
int colon; /* add ':' before the line */
int silent;
{
@@ -1312,7 +1318,7 @@ put_in_typebuf(s, esc, colon, silent)
put_reedit_in_typebuf(silent);
if (colon)
retval = ins_typebuf((char_u *)"\n", REMAP_YES, 0, TRUE, silent);
retval = ins_typebuf((char_u *)"\n", REMAP_NONE, 0, TRUE, silent);
if (retval == OK)
{
char_u *p;
@@ -1324,12 +1330,13 @@ put_in_typebuf(s, esc, colon, silent)
if (p == NULL)
retval = FAIL;
else
retval = ins_typebuf(p, REMAP_YES, 0, TRUE, silent);
retval = ins_typebuf(p, esc ? REMAP_NONE : REMAP_YES,
0, TRUE, silent);
if (esc)
vim_free(p);
}
if (colon && retval == OK)
retval = ins_typebuf((char_u *)":", REMAP_YES, 0, TRUE, silent);
retval = ins_typebuf((char_u *)":", REMAP_NONE, 0, TRUE, silent);
return retval;
}

View File

@@ -6410,6 +6410,9 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
}
# endif
curbuf->b_help = (curbuf->b_p_bt[0] == 'h');
# ifdef FEAT_TITLE
redraw_titles();
# endif
}
}
#endif

View File

@@ -345,21 +345,36 @@ pum_redraw()
if (st != NULL)
{
char_u *rt = reverse_text(st);
char_u *rt_saved = rt;
int len, j;
if (rt != NULL)
{
len = (int)STRLEN(rt);
if (len > pum_width)
char_u *rt_start = rt;
int size;
size = vim_strsize(rt);
if (size > pum_width)
{
for (j = pum_width; j < len; ++j)
do
{
size -= has_mbyte
? (*mb_ptr2cells)(rt) : 1;
mb_ptr_adv(rt);
len = pum_width;
} while (size > pum_width);
if (size < pum_width)
{
/* Most left character requires
* 2-cells but only 1 cell is
* available on screen. Put a
* '<' on the left of the pum
* item */
*(--rt) = '<';
size++;
}
}
screen_puts_len(rt, len, row,
col - len + 1, attr);
vim_free(rt_saved);
screen_puts_len(rt, (int)STRLEN(rt),
row, col - size + 1, attr);
vim_free(rt_start);
}
vim_free(st);
}

View File

@@ -6434,6 +6434,13 @@ screen_puts_len(text, len, row, col, attr)
else
prev_c = u8c;
# endif
if (col + mbyte_cells > screen_Columns)
{
/* Only 1 cell left, but character requires 2 cells:
* display a '>' in the last column to avoid wrapping. */
c = '>';
mbyte_cells = 1;
}
}
}
#endif
@@ -9210,7 +9217,7 @@ unshowmode(force)
int force;
{
/*
* Don't delete it right now, when not redrawing or insided a mapping.
* Don't delete it right now, when not redrawing or inside a mapping.
*/
if (!redrawing() || (!force && char_avail() && !KeyTyped))
redraw_cmdline = TRUE; /* delete mode later */

View File

@@ -681,6 +681,22 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
348,
/**/
347,
/**/
346,
/**/
345,
/**/
344,
/**/
343,
/**/
342,
/**/
341,
/**/
340,
/**/