1
0
forked from aniani/vim

updated for version 7.0063

This commit is contained in:
Bram Moolenaar
2005-03-22 23:03:44 +00:00
parent fc73515f7b
commit 6bb683663a
26 changed files with 55633 additions and 55454 deletions

View File

@@ -83,6 +83,7 @@ EXE_dependencies = \
regexp.obj \
screen.obj \
search.obj \
spell.obj \
syntax.obj \
tag.obj \
term.obj \

View File

@@ -392,6 +392,7 @@ OBJ = \
$(OUTDIR)/regexp.o \
$(OUTDIR)/screen.o \
$(OUTDIR)/search.o \
$(OUTDIR)/spell.o \
$(OUTDIR)/syntax.o \
$(OUTDIR)/tag.o \
$(OUTDIR)/term.o \

View File

@@ -15,8 +15,8 @@ OBJS = o.buffer o.charset o.diff o.digraph o.edit o.eval o.ex_cmds o.ex_cmds2
o.ex_docmd o.ex_eval o.ex_getln o.fileio o.fold o.getchar o.hashtable o.main o.mark o.mbyte \
o.memfile o.memline o.menu o.message o.misc1 o.misc2 o.move \
o.normal o.ops o.option o.quickfix o.regexp o.screen o.search \
o.syntax o.tag o.term o.termlib o.ui o.undo o.version o.window \
o.os_riscos o.swis o.gui o.gui_riscos
o.spell o.syntax o.tag o.term o.termlib o.ui o.undo o.version \
o.window o.os_riscos o.swis o.gui o.gui_riscos
Vim: $(OBJS)
$(GCC) -o Vim $(OBJS)
@@ -109,6 +109,8 @@ o.screen: c.screen
o.search: c.search
o.spell: c.spell
o.syntax: c.syntax
o.tag: c.tag

View File

@@ -110,6 +110,7 @@ ObjFiles = \
$(INTDIR)\regexp.obj\
$(INTDIR)\screen.obj\
$(INTDIR)\search.obj\
$(INTDIR)\spell.obj\
$(INTDIR)\syntax.obj\
$(INTDIR)\tag.obj\
$(INTDIR)\term.obj\

View File

@@ -130,12 +130,13 @@ buf_init_chartab(buf, global)
*/
vim_memset(buf->b_chartab, 0, (size_t)32);
#ifdef FEAT_MBYTE
for (c = 0; c < 256; ++c)
{
/* double-byte characters are probably word characters */
if (enc_dbcs != 0 && MB_BYTE2LEN(c) == 2)
SET_CHARTAB(buf, c);
}
if (enc_dbcs != 0)
for (c = 0; c < 256; ++c)
{
/* double-byte characters are probably word characters */
if (MB_BYTE2LEN(c) == 2)
SET_CHARTAB(buf, c);
}
#endif
#ifdef FEAT_LISP
@@ -913,6 +914,96 @@ vim_iswordc_buf(p, buf)
# endif
return (GET_CHARTAB(buf, *p) != 0);
}
static char spell_chartab[256];
/*
* Init the chartab used for spelling. Only depends on 'encoding'.
* Called once while starting up and when 'encoding' was changed.
* Unfortunately, we can't use isalpha() here, since the current locale may
* differ from 'encoding'.
*/
void
init_spell_chartab()
{
int i;
/* ASCII is always the same, no matter what 'encoding' is used.
* EBCDIC is not supported! */
for (i = 0; i < '0'; ++i)
spell_chartab[i] = FALSE;
/* We include numbers. A word shouldn't start with a number, but handling
* that is done separately. */
for ( ; i <= '9'; ++i)
spell_chartab[i] = TRUE;
for ( ; i < 'A'; ++i)
spell_chartab[i] = FALSE;
for ( ; i <= 'Z'; ++i)
spell_chartab[i] = TRUE;
for ( ; i < 'a'; ++i)
spell_chartab[i] = FALSE;
for ( ; i <= 'z'; ++i)
spell_chartab[i] = TRUE;
#ifdef FEAT_MBYTE
if (enc_dbcs)
{
/* DBCS: assume double-wide characters are word characters. */
for ( ; i <= 255; ++i)
if (MB_BYTE2LEN(i) == 2)
spell_chartab[i] = TRUE;
else
spell_chartab[i] = FALSE;
}
else if (STRCMP(p_enc, "cp850") == 0)
#endif
#if defined(MSDOS) || defined(FEAT_MBYTE)
{
/* cp850, MS-DOS */
for ( ; i < 128; ++i)
spell_chartab[i] = FALSE;
for ( ; i <= 0x9a; ++i)
spell_chartab[i] = TRUE;
for ( ; i < 0xa0; ++i)
spell_chartab[i] = FALSE;
for ( ; i <= 0xa5; ++i)
spell_chartab[i] = TRUE;
for ( ; i <= 255; ++i)
spell_chartab[i] = FALSE;
}
#endif
#ifdef FEAT_MBYTE
else
#endif
#if defined(FEAT_MBYTE) || !defined(MSDOS)
{
/* Rough guess: anything we don't recognize assumes word characters
* like latin1. */
for ( ; i < 0xc0; ++i)
spell_chartab[i] = FALSE;
for ( ; i <= 255; ++i)
spell_chartab[i] = TRUE;
# ifdef FEAT_MBYTE
if (STRCMP(p_enc, "latin1") == 0)
# endif
spell_chartab[0xf7] = FALSE; /* divide-by */
}
#endif
}
/*
* Return TRUE if "p" points to a word character.
* This only depends on 'encoding', not on 'iskeyword'.
*/
int
spell_iswordc(p)
char_u *p;
{
# ifdef FEAT_MBYTE
if (has_mbyte && MB_BYTE2LEN(*p) > 1)
return mb_get_class(p) >= 2;
# endif
return spell_chartab[*p];
}
#endif
/*

View File

@@ -362,7 +362,7 @@ EXTERN int mouse_dragging INIT(= 0); /* extending Visual area with
* When the DEC mouse has been pressed but not yet released we enable
* automatic querys for the mouse position.
*/
EXTERN int WantQueryMouse INIT(= 0);
EXTERN int WantQueryMouse INIT(= FALSE);
# endif
# ifdef FEAT_GUI

View File

@@ -3096,7 +3096,7 @@ iconv_string(vcp, str, slen, unconvlenp)
else
{
l = (*mb_ptr2len_check)((char_u *)from);
if (l > fromlen)
if (l > (int)fromlen)
l = fromlen;
}
from += l;

View File

@@ -3146,7 +3146,7 @@ update_mouseshape(shape_idx)
int new_mouse_shape;
/* Only works in GUI mode. */
if (!gui.in_use)
if (!gui.in_use || gui.starting)
return;
/* Postpone the updating when more is to come. Speeds up executing of

View File

@@ -2029,7 +2029,7 @@ static struct vimoption
(char_u *)NULL, PV_NONE,
#endif
{(char_u *)FALSE, (char_u *)0L}},
{"spelllang", "spl", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA,
{"spelllang", "spl", P_STRING|P_ALLOCED|P_VI_DEF|P_COMMA|P_RBUF,
#ifdef FEAT_SYN_HL
(char_u *)&p_spl, PV_SPL,
{(char_u *)"", (char_u *)0L}
@@ -2825,6 +2825,11 @@ set_init_1()
/* Must be before option_expand(), because that one needs vim_isIDc() */
didset_options();
#ifdef FEAT_SYN_HL
/* Use the current chartab for the generic chartab. */
init_spell_chartab();
#endif
#ifdef FEAT_LINEBREAK
/*
* initialize the table for 'breakat'.
@@ -5558,7 +5563,8 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
errmsg = e_invarg;
else
check_mouse_termcode();
setmouse(); /* may switch it on again */
if (termcap_active)
setmouse(); /* may switch it on again */
}
#endif
@@ -5656,7 +5662,7 @@ did_set_string_option(opt_idx, varp, new_value_alloced, oldval, errbuf,
#endif
#ifdef FEAT_SYN_HL
/* When 'spellang' is set, load the wordlists. */
/* When 'spelllang' is set, load the wordlists. */
else if (varp == &(curbuf->b_p_spl))
{
errmsg = did_set_spelllang(curbuf);

View File

@@ -4273,7 +4273,7 @@ WaitForChar(msec)
/* May need to query the mouse position. */
if (WantQueryMouse)
{
WantQueryMouse = 0;
WantQueryMouse = FALSE;
mch_write((char_u *)IF_EB("\033[1'|", ESC_STR "[1'|"), 5);
}
#endif

View File

@@ -3600,7 +3600,7 @@ win_line(wp, lnum, startrow, endrow)
1);
spell_attr = 0;
iswordc = vim_iswordc_buf(prev_ptr, wp->w_buffer);
iswordc = spell_iswordc(prev_ptr);
if (iswordc && !prev_iswordc)
{
word_end = v + spell_check(wp, prev_ptr,

View File

@@ -1424,6 +1424,7 @@ struct file_buffer
garray_T b_syn_patterns; /* table for syntax patterns */
garray_T b_syn_clusters; /* table for syntax clusters */
int b_spell_cluster_id; /* @Spell cluster ID or 0 */
int b_nospell_cluster_id; /* @NoSpell cluster ID or 0 */
int b_syn_containedin; /* TRUE when there is an item with a
"containedin" argument */
int b_syn_sync_flags; /* flags about how to sync */

View File

@@ -2202,9 +2202,20 @@ syn_current_attr(syncing, displaying, can_spell)
* done in the current item.
*/
/* Always do spelling if there is no @Spell cluster. */
/* If there is no @Spell cluster: Do spelling for items without
* @NoSpell. Otherwise only in items with @Spell */
if (syn_buf->b_spell_cluster_id == 0)
*can_spell = TRUE;
{
if (syn_buf->b_nospell_cluster_id == 0 || current_trans_id == 0)
*can_spell = TRUE;
else
{
sps.inc_tag = 0;
sps.id = syn_buf->b_nospell_cluster_id;
sps.cont_in_list = NULL;
*can_spell = !in_id_list(sip, sip->si_cont_list, &sps, 0);
}
}
else if (current_trans_id == 0)
*can_spell = FALSE;
else
@@ -5094,6 +5105,8 @@ syn_add_cluster(name)
if (STRICMP(name, "Spell") == 0)
curbuf->b_spell_cluster_id = len + SYNID_CLUSTER;
if (STRICMP(name, "NoSpell") == 0)
curbuf->b_nospell_cluster_id = len + SYNID_CLUSTER;
return len + SYNID_CLUSTER;
}

View File

@@ -4521,23 +4521,23 @@ check_termcode(max_offset, buf, buflen)
{
held_button = mouse_code;
mouse_code |= MOUSE_DRAG;
WantQueryMouse = 1;
WantQueryMouse = TRUE;
}
is_drag = TRUE;
showmode();
break;
case 2: mouse_code = MOUSE_LEFT;
WantQueryMouse = 1;
WantQueryMouse = TRUE;
break;
case 3: mouse_code = MOUSE_RELEASE | MOUSE_LEFT;
break;
case 4: mouse_code = MOUSE_MIDDLE;
WantQueryMouse = 1;
WantQueryMouse = TRUE;
break;
case 5: mouse_code = MOUSE_RELEASE | MOUSE_MIDDLE;
break;
case 6: mouse_code = MOUSE_RIGHT;
WantQueryMouse = 1;
WantQueryMouse = TRUE;
break;
case 7: mouse_code = MOUSE_RELEASE | MOUSE_RIGHT;
break;

View File

@@ -36,5 +36,5 @@
#define VIM_VERSION_NODOT "vim70aa"
#define VIM_VERSION_SHORT "7.0aa"
#define VIM_VERSION_MEDIUM "7.0aa ALPHA"
#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Mar 20)"
#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Mar 20, compiled "
#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 Mar 22)"
#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 Mar 22, compiled "