diff options
author | Bram Moolenaar <Bram@vim.org> | 2005-10-03 21:52:09 +0000 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2005-10-03 21:52:09 +0000 |
commit | bb15b658647d8eca01e67df871f7cb5ed95e2534 (patch) | |
tree | 6214d5476e5b780728462e5832306a9050bef26b /src | |
parent | 69e0ff94dce3a017feafbd0bb60e5720cda0441b (diff) | |
download | vim-git-bb15b658647d8eca01e67df871f7cb5ed95e2534.tar.gz |
updated for version 7.0153
Diffstat (limited to 'src')
-rw-r--r-- | src/Make_bc5.mak | 1 | ||||
-rw-r--r-- | src/Make_ivc.mak | 5 | ||||
-rw-r--r-- | src/Make_mvc.mak | 4 | ||||
-rw-r--r-- | src/main.aap | 1 | ||||
-rw-r--r-- | src/message.c | 55 | ||||
-rw-r--r-- | src/normal.c | 3 | ||||
-rw-r--r-- | src/proto.h | 3 | ||||
-rw-r--r-- | src/spell.c | 50 | ||||
-rw-r--r-- | src/vim.h | 11 |
9 files changed, 118 insertions, 15 deletions
diff --git a/src/Make_bc5.mak b/src/Make_bc5.mak index 99009c554..3e1640ed8 100644 --- a/src/Make_bc5.mak +++ b/src/Make_bc5.mak @@ -561,6 +561,7 @@ vimobj = \ $(OBJDIR)\normal.obj \ $(OBJDIR)\ops.obj \ $(OBJDIR)\option.obj \ + $(OBJDIR)\popupmenu.obj \ $(OBJDIR)\quickfix.obj \ $(OBJDIR)\regexp.obj \ $(OBJDIR)\screen.obj \ diff --git a/src/Make_ivc.mak b/src/Make_ivc.mak index 2326c3086..f6b3694f6 100644 --- a/src/Make_ivc.mak +++ b/src/Make_ivc.mak @@ -241,6 +241,7 @@ LINK32_OBJS= \ "$(INTDIR)/option.obj" \ "$(INTDIR)/os_mswin.obj" \ "$(INTDIR)/os_win32.obj" \ + "$(INTDIR)/popupmenu.obj" \ "$(INTDIR)/quickfix.obj" \ "$(INTDIR)/regexp.obj" \ "$(INTDIR)/screen.obj" \ @@ -597,6 +598,10 @@ SOURCE=.\os_win32.c # End Source File # Begin Source File +SOURCE=.\popupmenu.c +# End Source File +# Begin Source File + SOURCE=.\quickfix.c # End Source File # Begin Source File diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak index 164ed50d4..ad46c19fb 100644 --- a/src/Make_mvc.mak +++ b/src/Make_mvc.mak @@ -402,6 +402,7 @@ OBJ = \ $(OUTDIR)\os_mswin.obj \ $(OUTDIR)\os_win32.obj \ $(OUTDIR)\pathdef.obj \ + $(OUTDIR)\popupmenu.obj \ $(OUTDIR)\quickfix.obj \ $(OUTDIR)\regexp.obj \ $(OUTDIR)\screen.obj \ @@ -896,6 +897,8 @@ $(OUTDIR)/os_w32exe.obj: $(OUTDIR) os_w32exe.c $(INCL) $(OUTDIR)/pathdef.obj: $(OUTDIR) auto/pathdef.c $(INCL) $(CC) $(CFLAGS) auto/pathdef.c +$(OUTDIR)/popupmenu.obj: $(OUTDIR) popupmenu.c $(INCL) + $(OUTDIR)/quickfix.obj: $(OUTDIR) quickfix.c $(INCL) $(OUTDIR)/regexp.obj: $(OUTDIR) regexp.c $(INCL) @@ -986,6 +989,7 @@ proto.h: \ proto/option.pro \ proto/os_mswin.pro \ proto/os_win32.pro \ + proto/popupmenu.pro \ proto/quickfix.pro \ proto/regexp.pro \ proto/screen.pro \ diff --git a/src/main.aap b/src/main.aap index f31f929ed..3b16f175c 100644 --- a/src/main.aap +++ b/src/main.aap @@ -256,6 +256,7 @@ Source = option.c os_unix.c auto/pathdef.c + popupmenu.c quickfix.c regexp.c screen.c diff --git a/src/message.c b/src/message.c index 0a2fe995b..147867248 100644 --- a/src/message.c +++ b/src/message.c @@ -27,6 +27,7 @@ static char_u *screen_puts_mbyte __ARGS((char_u *s, int l, int attr)); static void msg_puts_attr_len __ARGS((char_u *str, int maxlen, int attr)); static void msg_puts_display __ARGS((char_u *str, int maxlen, int attr, int recurse)); static void msg_scroll_up __ARGS((void)); +static void inc_msg_scrolled __ARGS((void)); static void store_sb_text __ARGS((char_u **sb_str, char_u *s, int attr, int *sb_col, int finish)); static void t_puts __ARGS((int *t_col, char_u *t_s, char_u *s, int attr)); static void msg_puts_printf __ARGS((char_u *str, int maxlen)); @@ -207,7 +208,7 @@ msg_strtrunc(s, force) && !exmode_active && msg_silent == 0) || force) { len = vim_strsize(s); - if (msg_scrolled) + if (msg_scrolled != 0) /* Use all the columns. */ room = (int)(Rows - msg_row) * Columns - 1; else @@ -634,7 +635,7 @@ emsg(s) emsg_on_display = TRUE; /* remember there is an error message */ ++msg_scroll; /* don't overwrite a previous message */ attr = hl_attr(HLF_E); /* set highlight mode for error messages */ - if (msg_scrolled) + if (msg_scrolled != 0) need_wait_return = TRUE; /* needed in case emsg() is called after * wait_return has reset need_wait_return * and a redraw is expected because @@ -1762,7 +1763,7 @@ msg_puts_attr_len(str, maxlen, attr) * need_wait_return after some prompt, and then outputting something * without scrolling */ - if (msg_scrolled && !msg_scrolled_ign) + if (msg_scrolled != 0 && !msg_scrolled_ign) need_wait_return = TRUE; msg_didany = TRUE; /* remember that something was outputted */ @@ -1875,7 +1876,7 @@ msg_puts_display(str, maxlen, attr, recurse) /* store text for scrolling back */ store_sb_text(&sb_str, s, attr, &sb_col, TRUE); - ++msg_scrolled; + inc_msg_scrolled(); need_wait_return = TRUE; /* may need wait_return in main() */ if (must_redraw < VALID) must_redraw = VALID; @@ -1899,6 +1900,15 @@ msg_puts_display(str, maxlen, attr, recurse) if (quit_more) return; } + + /* When we displayed a char in last column need to check if there + * is still more. */ + if (*s >= ' ' +#ifdef FEAT_RIGHTLEFT + && !cmdmsg_rl +#endif + ) + continue; } wrap = *s == '\n' @@ -2044,6 +2054,41 @@ msg_scroll_up() } /* + * Increment "msg_scrolled". + */ + static void +inc_msg_scrolled() +{ +#ifdef FEAT_EVAL + if (*get_vim_var_str(VV_SCROLLSTART) == NUL) + { + char_u *p = sourcing_name; + char_u *tofree = NULL; + int len; + + /* v:scrollstart is empty, set it to the script/function name and line + * number */ + if (p == NULL) + p = (char_u *)_("Unknown"); + else + { + len = STRLEN(p) + 40; + tofree = alloc(len); + if (tofree != NULL) + { + vim_snprintf((char *)tofree, len, _("%s line %ld"), + p, (long)sourcing_lnum); + p = tofree; + } + } + set_vim_var_string(VV_SCROLLSTART, p, -1); + vim_free(tofree); + } +#endif + ++msg_scrolled; +} + +/* * To be able to scroll back at the "more" and "hit-enter" prompts we need to * store the displayed text and remember where screen lines start. */ @@ -2527,7 +2572,7 @@ do_more_prompt(typed_char) { /* scroll up, display line at bottom */ msg_scroll_up(); - ++msg_scrolled; + inc_msg_scrolled(); screen_fill((int)Rows - 2, (int)Rows - 1, 0, (int)Columns, ' ', ' ', 0); mp_last = disp_sb_line((int)Rows - 2, mp_last); diff --git a/src/normal.c b/src/normal.c index 1e645e447..73c4cfd00 100644 --- a/src/normal.c +++ b/src/normal.c @@ -3984,14 +3984,15 @@ find_decl(ptr, len, locally, thisblock, searchflags) { setpcmark(); /* Set in findpar() otherwise */ curwin->w_cursor.lnum = 1; + par_pos = curwin->w_cursor; } else { + par_pos = curwin->w_cursor; while (curwin->w_cursor.lnum > 1 && *skipwhite(ml_get_curline()) != NUL) --curwin->w_cursor.lnum; } curwin->w_cursor.col = 0; - par_pos = curwin->w_cursor; /* Search forward for the identifier, ignore comment lines. */ found_pos.lnum = 0; diff --git a/src/proto.h b/src/proto.h index 611657863..490f9695c 100644 --- a/src/proto.h +++ b/src/proto.h @@ -143,6 +143,7 @@ void qsort __ARGS((void *base, size_t elm_count, size_t elm_size, int (*cmp)(con # include "normal.pro" # include "ops.pro" # include "option.pro" +# include "popupmenu.pro" # include "quickfix.pro" # include "regexp.pro" # include "screen.pro" @@ -243,7 +244,7 @@ extern char *vim_SelFile __ARGS((Widget toplevel, char *prompt, char *init_path, # endif /* - * The perl include files pollute the namespace, therfore proto.h must be + * The perl include files pollute the namespace, therefore proto.h must be * included before the perl include files. But then CV is not defined, which * is used in if_perl.pro. To get around this, the perl prototype files are * not included here for the perl files. Use a dummy define for CV for the diff --git a/src/spell.c b/src/spell.c index be5dc951d..d65be9098 100644 --- a/src/spell.c +++ b/src/spell.c @@ -10035,19 +10035,38 @@ suggest_try_change(su) sp->ts_state = STATE_FINAL; break; } + + /* Don't swap if the first character is not a word character. + * SWAP3 etc. also don't make sense then. */ + if (!spell_iswordp(p, curbuf)) + { + sp->ts_state = STATE_REP_INI; + break; + } + #ifdef FEAT_MBYTE if (has_mbyte) { n = mb_cptr2len(p); c = mb_ptr2char(p); - c2 = mb_ptr2char(p + n); + if (!spell_iswordp(p + n, curbuf)) + c2 = c; /* don't swap non-word char */ + else + c2 = mb_ptr2char(p + n); } else #endif - c2 = p[1]; + { + if (!spell_iswordp(p + 1, curbuf)) + c2 = c; /* don't swap non-word char */ + else + c2 = p[1]; + } + + /* When characters are identical, swap won't do anything. + * Also get here if the second char is not a word character. */ if (c == c2) { - /* Characters are identical, swap won't do anything. */ sp->ts_state = STATE_SWAP3; break; } @@ -10107,20 +10126,28 @@ suggest_try_change(su) c = mb_ptr2char(p); fl = mb_cptr2len(p + n); c2 = mb_ptr2char(p + n); - c3 = mb_ptr2char(p + n + fl); + if (!spell_iswordp(p + n + fl, curbuf)) + c3 = c; /* don't swap non-word char */ + else + c3 = mb_ptr2char(p + n + fl); } else #endif { c = *p; c2 = p[1]; - c3 = p[2]; + if (!spell_iswordp(p + 2, curbuf)) + c3 = c; /* don't swap non-word char */ + else + c3 = p[2]; } /* When characters are identical: "121" then SWAP3 result is * identical, ROT3L result is same as SWAP: "211", ROT3L * result is same as SWAP on next char: "112". Thus skip all - * swapping. Also skip when c3 is NUL. */ + * swapping. Also skip when c3 is NUL. + * Also get here when the third character is not a word + * character. Second character may any char: "a.b" -> "b.a" */ if (c == c3 || c3 == NUL) { sp->ts_state = STATE_REP_INI; @@ -10165,6 +10192,7 @@ suggest_try_change(su) mch_memmove(p + fl + tl, p, n); mb_char2bytes(c, p); mb_char2bytes(c2, p + tl); + p = p + tl; } else #endif @@ -10172,6 +10200,16 @@ suggest_try_change(su) c = *p; *p = p[2]; p[2] = c; + ++p; + } + + if (!spell_iswordp(p, curbuf)) + { + /* Middle char is not a word char, skip the rotate. + * First and third char were already checked at swap + * and swap3. */ + sp->ts_state = STATE_REP_INI; + break; } /* Rotate three characters left: "123" -> "231". We change @@ -1150,13 +1150,19 @@ typedef enum , HLF_SPC /* SpellCap */ , HLF_SPR /* SpellRare */ , HLF_SPL /* SpellLocal */ + , HLF_PNI /* popup menu normal item */ + , HLF_PSI /* popup menu selected item */ + , HLF_PSB /* popup menu scrollbar */ + , HLF_PST /* popup menu scrollbar thumb */ , HLF_COUNT /* MUST be the last one */ } hlf_T; /* the HL_FLAGS must be in the same order as the HLF_ enums! */ #define HL_FLAGS {'8', '@', 'd', 'e', 'h', 'i', 'l', 'm', 'M', \ 'n', 'r', 's', 'S', 'c', 't', 'v', 'V', 'w', 'W', \ - 'f', 'F', 'A', 'C', 'D', 'T', '>', 'B', 'P', 'R', 'L'} + 'f', 'F', 'A', 'C', 'D', 'T', '>', \ + 'B', 'P', 'R', 'L', \ + '+', '=', 'x', 'X'} /* * Boolean constants @@ -1566,7 +1572,8 @@ int vim_memcmp __ARGS((void *, void *, size_t)); #define VV_BEVAL_LNUM 41 #define VV_BEVAL_COL 42 #define VV_BEVAL_TEXT 43 -#define VV_LEN 44 /* number of v: vars */ +#define VV_SCROLLSTART 44 +#define VV_LEN 45 /* number of v: vars */ #ifdef FEAT_CLIPBOARD |