diff options
author | Bram Moolenaar <Bram@vim.org> | 2010-06-05 23:22:07 +0200 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2010-06-05 23:22:07 +0200 |
commit | 860cae1cec85aeb06668a2b071727c43869acf15 (patch) | |
tree | 8f7b62b69f4a7d3340902178927bbc3f9d24cc3e /src | |
parent | 945e2dbb633ed29b697a8d4eea51672e3c11143b (diff) |
Add the conceal patch from Vince Negri.
Diffstat (limited to 'src')
-rw-r--r-- | src/buffer.c | 31 | ||||
-rw-r--r-- | src/diff.c | 75 | ||||
-rw-r--r-- | src/edit.c | 34 | ||||
-rw-r--r-- | src/eval.c | 48 | ||||
-rw-r--r-- | src/ex_cmds.c | 14 | ||||
-rw-r--r-- | src/ex_cmds.h | 2 | ||||
-rw-r--r-- | src/ex_cmds2.c | 2 | ||||
-rw-r--r-- | src/ex_docmd.c | 1 | ||||
-rw-r--r-- | src/feature.h | 21 | ||||
-rw-r--r-- | src/globals.h | 5 | ||||
-rw-r--r-- | src/hardcopy.c | 2 | ||||
-rw-r--r-- | src/if_python.c | 2 | ||||
-rw-r--r-- | src/integration.c | 27 | ||||
-rw-r--r-- | src/mbyte.c | 2 | ||||
-rw-r--r-- | src/move.c | 65 | ||||
-rw-r--r-- | src/normal.c | 117 | ||||
-rw-r--r-- | src/option.c | 124 | ||||
-rw-r--r-- | src/option.h | 6 | ||||
-rw-r--r-- | src/proto/diff.pro | 1 | ||||
-rw-r--r-- | src/proto/move.pro | 1 | ||||
-rw-r--r-- | src/proto/screen.pro | 1 | ||||
-rw-r--r-- | src/proto/spell.pro | 10 | ||||
-rw-r--r-- | src/proto/syntax.pro | 10 | ||||
-rw-r--r-- | src/screen.c | 272 | ||||
-rw-r--r-- | src/search.c | 10 | ||||
-rw-r--r-- | src/spell.c | 270 | ||||
-rw-r--r-- | src/structs.h | 154 | ||||
-rw-r--r-- | src/syntax.c | 920 | ||||
-rw-r--r-- | src/ui.c | 2 | ||||
-rw-r--r-- | src/version.c | 16 | ||||
-rw-r--r-- | src/vim.h | 24 | ||||
-rw-r--r-- | src/window.c | 14 | ||||
-rw-r--r-- | src/workshop.c | 3 |
33 files changed, 1599 insertions, 687 deletions
diff --git a/src/buffer.c b/src/buffer.c index 5ecb638727..cf7ecbbe95 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -581,7 +581,7 @@ buf_freeall(buf, del_buf, wipe_buf) buf->b_ml.ml_line_count = 0; /* no lines in buffer */ u_clearall(buf); /* reset all undo information */ #ifdef FEAT_SYN_HL - syntax_clear(buf); /* reset syntax info */ + syntax_clear(&buf->b_s); /* reset syntax info */ #endif buf->b_flags &= ~BF_READERR; /* a read error is no longer relevant */ } @@ -648,7 +648,7 @@ free_buffer_stuff(buf, free_options) buf->b_start_fenc = NULL; #endif #ifdef FEAT_SPELL - ga_clear(&buf->b_langp); + ga_clear(&buf->b_s.b_langp); #endif } @@ -1378,6 +1378,15 @@ enter_buffer(buf) foldUpdateAll(curwin); /* update folds (later). */ #endif +#ifdef FEAT_SYN_HL + if (curwin->w_s != &curwin->w_buffer->b_s) + { + /* Get rid of independant syntax */ + syntax_clear(curwin->w_s); + vim_free(curwin->w_s); + } + curwin->w_s = &(buf->b_s); +#endif /* Get the buffer in the current window. */ curwin->w_buffer = buf; curbuf = buf; @@ -1460,8 +1469,8 @@ enter_buffer(buf) #ifdef FEAT_SPELL /* May need to set the spell language. Can only do this after the buffer * has been properly setup. */ - if (!curbuf->b_help && curwin->w_p_spell && *curbuf->b_p_spl != NUL) - (void)did_set_spelllang(curbuf); + if (!curbuf->b_help && curwin->w_p_spell && *curwin->w_s->b_p_spl != NUL) + (void)did_set_spelllang(curwin); #endif redraw_later(NOT_VALID); @@ -1672,8 +1681,8 @@ buflist_new(ffname, sfname, lnum, flags) init_var_dict(&buf->b_vars, &buf->b_bufvar); /* init b: variables */ #endif #ifdef FEAT_SYN_HL - hash_init(&buf->b_keywtab); - hash_init(&buf->b_keywtab_ic); + hash_init(&buf->b_s.b_keywtab); + hash_init(&buf->b_s.b_keywtab_ic); #endif buf->b_fname = buf->b_sfname; @@ -1772,11 +1781,11 @@ free_buf_options(buf, free_p_ff) clear_string_option(&buf->b_p_syn); #endif #ifdef FEAT_SPELL - clear_string_option(&buf->b_p_spc); - clear_string_option(&buf->b_p_spf); - vim_free(buf->b_cap_prog); - buf->b_cap_prog = NULL; - clear_string_option(&buf->b_p_spl); + clear_string_option(&buf->b_s.b_p_spc); + clear_string_option(&buf->b_s.b_p_spf); + vim_free(buf->b_s.b_cap_prog); + buf->b_s.b_cap_prog = NULL; + clear_string_option(&buf->b_s.b_p_spl); #endif #ifdef FEAT_SEARCHPATH clear_string_option(&buf->b_p_sua); diff --git a/src/diff.c b/src/diff.c index bf6254598f..e733ccd45c 100644 --- a/src/diff.c +++ b/src/diff.c @@ -1127,6 +1127,10 @@ diff_win_options(wp, addbuf) # endif wp->w_p_diff = TRUE; +#ifdef FEAT_CURSORBIND + /* Use cursorbind if it's available */ + wp->w_p_crb = TRUE; +#endif wp->w_p_scb = TRUE; wp->w_p_wrap = FALSE; # ifdef FEAT_FOLDING @@ -2473,6 +2477,77 @@ diff_move_to(dir, count) return OK; } +#if defined(FEAT_CURSORBIND) || defined(PROTO) + linenr_T +diff_get_corresponding_line(buf1, lnum1, buf2, lnum3) + buf_T *buf1; + linenr_T lnum1; + buf_T *buf2; + linenr_T lnum3; +{ + int idx1; + int idx2; + diff_T *dp; + int baseline = 0; + linenr_T lnum2; + + idx1 = diff_buf_idx(buf1); + idx2 = diff_buf_idx(buf2); + if (idx1 == DB_COUNT || idx2 == DB_COUNT || curtab->tp_first_diff == NULL) + return lnum1; + + if (curtab->tp_diff_invalid) + ex_diffupdate(NULL); /* update after a big change */ + + if (curtab->tp_first_diff == NULL) /* no diffs today */ + return lnum1; + + for (dp = curtab->tp_first_diff; dp != NULL; dp = dp->df_next) + { + if (dp->df_lnum[idx1] > lnum1) + { + lnum2 = lnum1 - baseline; + /* don't end up past the end of the file */ + if (lnum2 > buf2->b_ml.ml_line_count) + lnum2 = buf2->b_ml.ml_line_count; + + return lnum2; + } + else if ((dp->df_lnum[idx1] + dp->df_count[idx1]) > lnum1) + { + /* Inside the diffblock */ + baseline = lnum1 - dp->df_lnum[idx1]; + if (baseline > dp->df_count[idx2]) + baseline = dp->df_count[idx2]; + + return dp->df_lnum[idx2] + baseline; + } + else if ( (dp->df_lnum[idx1] == lnum1) + && (dp->df_count[idx1] == 0) + && (dp->df_lnum[idx2] <= lnum3) + && ((dp->df_lnum[idx2] + dp->df_count[idx2]) > lnum3)) + /* + * Special case: if the cursor is just after a zero-count + * block (i.e. all filler) and the target cursor is already + * inside the corresponding block, leave the target cursor + * unmoved. This makes repeated CTRL-W W operations work + * as expected. + */ + return lnum3; + baseline = (dp->df_lnum[idx1] + dp->df_count[idx1]) + - (dp->df_lnum[idx2] + dp->df_count[idx2]); + } + + /* If we get here then the cursor is after the last diff */ + lnum2 = lnum1 - baseline; + /* don't end up past the end of the file */ + if (lnum2 > buf2->b_ml.ml_line_count) + lnum2 = buf2->b_ml.ml_line_count; + + return lnum2; +} +#endif + #if defined(FEAT_FOLDING) || defined(PROTO) /* * For line "lnum" in the current window find the equivalent lnum in window diff --git a/src/edit.c b/src/edit.c index a6a28cc9a3..9f7106165e 100644 --- a/src/edit.c +++ b/src/edit.c @@ -698,6 +698,10 @@ edit(cmdchar, startln, count) do_check_scrollbind(TRUE); #endif +#ifdef FEAT_CURSORBIND + if (curwin->w_p_crb) + do_check_cursorbind(); +#endif update_curswant(); old_topline = curwin->w_topline; #ifdef FEAT_DIFF @@ -1277,7 +1281,7 @@ doESCkey: inserted_space = FALSE; break; -#if defined(FEAT_DIGRAPHS) || defined (FEAT_INS_EXPAND) +#if defined(FEAT_DIGRAPHS) || defined(FEAT_INS_EXPAND) case Ctrl_K: /* digraph or keyword completion */ # ifdef FEAT_INS_EXPAND if (ctrl_x_mode == CTRL_X_DICTIONARY) @@ -1470,7 +1474,7 @@ ins_redraw(ready) * highlighting is correct after making a change (e.g., inserting * a "(". The autocommand may also require a redraw, so it's done * again below, unfortunately. */ - if (syntax_present(curbuf) && must_redraw) + if (syntax_present(curwin) && must_redraw) update_screen(0); # endif apply_autocmds(EVENT_CURSORMOVEDI, NULL, NULL, FALSE, curbuf); @@ -2960,7 +2964,7 @@ ins_compl_dictionaries(dict_start, pat, flags, thesaurus) ptr = pat + 2; else ptr = pat; - spell_dump_compl(curbuf, ptr, regmatch.rm_ic, &dir, 0); + spell_dump_compl(ptr, regmatch.rm_ic, &dir, 0); } else # endif @@ -9119,6 +9123,9 @@ ins_s_right() ins_up(startcol) int startcol; /* when TRUE move to Insstart.col */ { +#ifdef FEAT_CONCEAL + linenr_T oldline = curwin->w_cursor.lnum; +#endif pos_T tpos; linenr_T old_topline = curwin->w_topline; #ifdef FEAT_DIFF @@ -9141,6 +9148,13 @@ ins_up(startcol) #ifdef FEAT_CINDENT can_cindent = TRUE; #endif +#ifdef FEAT_CONCEAL + if (curwin->w_p_conceal && oldline != curwin->w_cursor.lnum) + { + update_single_line(curwin, oldline); + update_single_line(curwin, curwin->w_cursor.lnum); + } +#endif } else vim_beep(); @@ -9182,6 +9196,10 @@ ins_pageup() ins_down(startcol) int startcol; /* when TRUE move to Insstart.col */ { +#ifdef FEAT_CONCEAL + linenr_T oldline = curwin->w_cursor.lnum; + linenr_T oldbotline = curwin->w_botline; +#endif pos_T tpos; linenr_T old_topline = curwin->w_topline; #ifdef FEAT_DIFF @@ -9204,6 +9222,16 @@ ins_down(startcol) #ifdef FEAT_CINDENT can_cindent = TRUE; #endif +#ifdef FEAT_CONCEAL + if (curwin->w_p_conceal && oldline != curwin->w_cursor.lnum) + { + update_single_line(curwin, oldline); + /* Don't do this if we've scrolled, the line is already + * drawn */ + if (oldbotline == curwin->w_botline) + update_single_line(curwin, curwin->w_cursor.lnum); + } +#endif } else vim_beep(); diff --git a/src/eval.c b/src/eval.c index e777d32558..ca9389fb39 100644 --- a/src/eval.c +++ b/src/eval.c @@ -3884,6 +3884,11 @@ get_user_var_name(xp, idx) ++hi; return cat_prefix_varname('w', hi->hi_key); } + if (wdone == ht->ht_used) + { + ++wdone; + return (char_u *)"w:ownsyntax"; + } #ifdef FEAT_WINDOWS /* t: variables */ @@ -9389,6 +9394,9 @@ f_cursor(argvars, rettv) typval_T *rettv; { long line, col; +#ifdef FEAT_CONCEAL + linenr_T oldline = curwin->w_cursor.lnum; +#endif #ifdef FEAT_VIRTUALEDIT long coladd = 0; #endif @@ -9438,6 +9446,13 @@ f_cursor(argvars, rettv) #endif curwin->w_set_curswant = TRUE; +#ifdef FEAT_CONCEAL + if (curwin->w_p_conceal && oldline != curwin->w_cursor.lnum) + { + update_single_line(curwin, oldline); + update_single_line(curwin, curwin->w_cursor.lnum); + } +#endif rettv->vval.v_number = 0; } @@ -11722,12 +11737,18 @@ f_has(argvars, rettv) #ifdef FEAT_COMMENTS "comments", #endif +#ifdef FEAT_CONCEAL + "conceal", +#endif #ifdef FEAT_CRYPT "cryptv", #endif #ifdef FEAT_CSCOPE "cscope", #endif +#ifdef FEAT_CURSORBIND + "cursorbind", +#endif #ifdef CURSOR_SHAPE "cursorshape", #endif @@ -12138,7 +12159,7 @@ f_has(argvars, rettv) #endif #ifdef FEAT_SYN_HL else if (STRICMP(name, "syntax_items") == 0) - n = syntax_present(curbuf); + n = syntax_present(curwin); #endif #if defined(WIN3264) else if (STRICMP(name, "win95") == 0) @@ -15103,6 +15124,15 @@ search_cmn(argvars, match_pos, flagsp) /* If 'n' flag is used: restore cursor position. */ if (flags & SP_NOMOVE) curwin->w_cursor = save_cursor; +#ifdef FEAT_CONCEAL + else if (curwin->w_p_conceal + && save_cursor.lnum != curwin->w_cursor.lnum) + { + curwin->w_set_curswant = TRUE; + update_single_line(curwin, save_cursor.lnum); + update_single_line(curwin, curwin->w_cursor.lnum); + } +#endif else curwin->w_set_curswant = TRUE; theend: @@ -16329,7 +16359,7 @@ f_spellbadword(argvars, rettv) if (len != 0) word = ml_get_cursor(); } - else if (curwin->w_p_spell && *curbuf->b_p_spl != NUL) + else if (curwin->w_p_spell && *curbuf->b_s.b_p_spl != NUL) { char_u *str = get_tv_string_chk(&argvars[0]); int capcol = -1; @@ -16382,7 +16412,7 @@ f_spellsuggest(argvars, rettv) return; #ifdef FEAT_SPELL - if (curwin->w_p_spell && *curbuf->b_p_spl != NUL) + if (curwin->w_p_spell && *curwin->w_s->b_p_spl != NUL) { str = get_tv_string(&argvars[0]); if (argvars[1].v_type != VAR_UNKNOWN) @@ -18728,6 +18758,18 @@ get_var_tv(name, len, rettv, verbose) tv = &atv; } + if (STRCMP(name, "w:ownsyntax") == 0) + { + atv.v_type = VAR_NUMBER; +#ifdef FEAT_SYN_HL + atv.vval.v_number = (curwin->w_s != &curwin->w_buffer->b_s) ? 1 : 0; +#else + atv.vval.v_number = 0; +#endif + tv = &atv; + } + + /* * Check for user-defined variables. */ diff --git a/src/ex_cmds.c b/src/ex_cmds.c index 2df5a4ae8e..f05a0656d4 100644 --- a/src/ex_cmds.c +++ b/src/ex_cmds.c @@ -3411,6 +3411,14 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin) else #endif { +#ifdef FEAT_SYN_HL + /* + * <VN> We could instead free the synblock + * and re-attach to buffer, perhaps. + */ + if (curwin->w_s == &(curwin->w_buffer->b_s)) + curwin->w_s = &(buf->b_s); +#endif curwin->w_buffer = buf; curbuf = buf; ++curbuf->b_nwindows; @@ -3717,8 +3725,8 @@ do_ecmd(fnum, ffname, sfname, eap, newlnum, flags, oldwin) #ifdef FEAT_SPELL /* If the window options were changed may need to set the spell language. * Can only do this after the buffer has been properly setup. */ - if (did_get_winopts && curwin->w_p_spell && *curbuf->b_p_spl != NUL) - (void)did_set_spelllang(curbuf); + if (did_get_winopts && curwin->w_p_spell && *curwin->w_s->b_p_spl != NUL) + (void)did_set_spelllang(curwin); #endif if (command == NULL) @@ -5963,7 +5971,7 @@ fix_help_buffer() set_option_value((char_u *)"ft", 0L, (char_u *)"help", OPT_LOCAL); #ifdef FEAT_SYN_HL - if (!syntax_present(curbuf)) + if (!syntax_present(curwin)) #endif { for (lnum = 1; lnum <= curbuf->b_ml.ml_line_count; ++lnum) diff --git a/src/ex_cmds.h b/src/ex_cmds.h index f41e0f449d..4e0e169180 100644 --- a/src/ex_cmds.h +++ b/src/ex_cmds.h @@ -677,6 +677,8 @@ EX(CMD_ounmap, "ounmap", ex_unmap, EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), EX(CMD_ounmenu, "ounmenu", ex_menu, EXTRA|TRLBAR|NOTRLCOM|USECTRLV|CMDWIN), +EX(CMD_ownsyntax, "ownsyntax", ex_ownsyntax, + EXTRA|NOTRLCOM|SBOXOK|CMDWIN), EX(CMD_print, "print", ex_print, RANGE|WHOLEFOLD|COUNT|EXFLAGS|TRLBAR|CMDWIN|SBOXOK), EX(CMD_pclose, "pclose", ex_pclose, diff --git a/src/ex_cmds2.c b/src/ex_cmds2.c index e5ce640e23..f07bb4ce6e 100644 --- a/src/ex_cmds2.c +++ b/src/ex_cmds2.c @@ -2824,7 +2824,7 @@ struct source_cookie FILE *fp; /* opened file for sourcing */ char_u *nextline; /* if not NULL: line that was read ahead */ int finished; /* ":finish" used */ -#if defined (USE_CRNL) || defined (USE_CR) +#if defined(USE_CRNL) || defined(USE_CR) int fileformat; /* EOL_UNKNOWN, EOL_UNIX or EOL_DOS */ int error; /* TRUE if LF found after CR-LF */ #endif diff --git a/src/ex_docmd.c b/src/ex_docmd.c index c6d0b40ecb..96a3a872f0 100644 --- a/src/ex_docmd.c +++ b/src/ex_docmd.c @@ -235,6 +235,7 @@ static void ex_popup __ARGS((exarg_T *eap)); #endif #ifndef FEAT_SYN_HL # define ex_syntax ex_ni +# define ex_ownsyntax ex_ni #endif #ifndef FEAT_SPELL # define ex_spell ex_ni diff --git a/src/feature.h b/src/feature.h index 4f35280b70..5bca7c7d76 100644 --- a/src/feature.h +++ b/src/feature.h @@ -535,10 +535,17 @@ #endif /* + * +conceal 'conceal' option. Needs syntax highlighting + * as this is how the concealed text is defined. + */ +#if defined(FEAT_BIG) && defined(FEAT_SYN_HL) +# define FEAT_CONCEAL +#endif + +/* * +spell spell checking * - * Disabled for EBCDIC: - * Doesn't work (SIGSEGV). + * Disabled for EBCDIC: * Doesn't work (SIGSEGV). */ #if (defined(FEAT_NORMAL) || defined(PROTO)) && !defined(EBCDIC) # define FEAT_SPELL @@ -730,6 +737,13 @@ #endif /* + * +cursorbind synchronization of split windows + */ +#if defined(FEAT_NORMAL) && defined(FEAT_WINDOWS) +# define FEAT_CURSORBIND +#endif + +/* * +menu ":menu" command */ #ifdef FEAT_NORMAL @@ -770,7 +784,8 @@ && (defined(FEAT_GUI_GTK) \ || (defined(FEAT_GUI_MOTIF) && defined(HAVE_XM_NOTEBOOK_H)) \ || defined(FEAT_GUI_MAC) \ - || (defined(FEAT_GUI_MSWIN) && (!defined(_MSC_VER) || _MSC_VER > 1020))) + || (defined(FEAT_GUI_MSWIN) && !defined(WIN16) \ + && (!defined(_MSC_VER) || _MSC_VER > 1020))) # define FEAT_GUI_TABLINE #endif diff --git a/src/globals.h b/src/globals.h index b085bcb73c..f4ec25713c 100644 --- a/src/globals.h +++ b/src/globals.h @@ -1151,6 +1151,9 @@ EXTERN int lcs_nbsp INIT(= NUL); EXTERN int lcs_tab1 INIT(= NUL); EXTERN int lcs_tab2 INIT(= NUL); EXTERN int lcs_trail INIT(= NUL); +#ifdef FEAT_CONCEAL +EXTERN int lcs_conceal INIT(= '-'); +#endif #if defined(FEAT_WINDOWS) || defined(FEAT_WILDMENU) || defined(FEAT_STL_OPT) \ || defined(FEAT_FOLDING) @@ -1412,7 +1415,7 @@ EXTERN char_u e_invexpr2[] INIT(= N_("E15: Invalid expression: %s")); #endif EXTERN char_u e_invrange[] INIT(= N_("E16: Invalid range")); EXTERN char_u e_invcmd[] INIT(= N_("E476: Invalid command")); -#if defined(UNIX) || defined(FEAT_SYN_HL) +#if defined(UNIX) || defined(FEAT_SYN_HL) || defined(FEAT_SPELL) EXTERN char_u e_isadir2[] INIT(= N_("E17: \"%s\" is a directory")); #endif #ifdef FEAT_LIBCALL diff --git a/src/hardcopy.c b/src/hardcopy.c index e70390d443..744a2a2f19 100644 --- a/src/hardcopy.c +++ b/src/hardcopy.c @@ -616,7 +616,7 @@ ex_hardcopy(eap) else settings.modec = 't'; - if (!syntax_present(curbuf)) + if (!syntax_present(curwin)) settings.do_syntax = FALSE; else if (printer_opts[OPT_PRINT_SYNTAX].present && TOLOWER_ASC(printer_opts[OPT_PRINT_SYNTAX].string[0]) != 'a') diff --git a/src/if_python.c b/src/if_python.c index 4f23ffa8b8..1b0780158e 100644 --- a/src/if_python.c +++ b/src/if_python.c @@ -26,7 +26,7 @@ # undef _POSIX_THREADS #endif -#if defined(_WIN32) && defined (HAVE_FCNTL_H) +#if defined(_WIN32) && defined(HAVE_FCNTL_H) # undef HAVE_FCNTL_H #endif diff --git a/src/integration.c b/src/integration.c index 4b1492c63c..88962755bf 100644 --- a/src/integration.c +++ b/src/integration.c @@ -86,6 +86,7 @@ static void process_menuItem(char *); static void process_toolbarButton(char *); static void workshop_set_option_first(char *name, char *value); +static size_t dummy; /* to ignore return value of write() */ #define CMDBUFSIZ 2048 @@ -183,7 +184,7 @@ messageFromEserve(XtPointer clientData UNUSED, ackNum = atoi(&cmd[4]); vim_snprintf(buf, sizeof(buf), NOCATGETS("ack %d\n"), ackNum); - (void)write(sd, buf, strlen(buf)); + dummy = write(sd, buf, strlen(buf)); } else if (strncmp(cmd, NOCATGETS("addMarkType "), 12) == 0) { int idx; @@ -280,7 +281,7 @@ messageFromEserve(XtPointer clientData UNUSED, vim_snprintf(buf, sizeof(buf), NOCATGETS("markLine %s %d %d\n"), file, markid, line); - (void)write(sd, buf, strlen(buf)); + dummy = write(sd, buf, strlen(buf)); } else if (cmd[1] == 'o' && cmd[4] == 'L' && strncmp(cmd, NOCATGETS("gotoLine "), 9) == 0) { char *file; @@ -729,10 +730,10 @@ void workshop_connect(XtAppContext context) workshop_get_editor_name(), PROTOCOL_VERSION, workshop_get_editor_version()); - (void)write(sd, buf, strlen(buf)); + dummy = write(sd, buf, strlen(buf)); vim_snprintf(buf, sizeof(buf), NOCATGETS("ack 1\n")); - (void)write(sd, buf, strlen(buf)); + dummy = write(sd, buf, strlen(buf)); } void workshop_disconnect() @@ -1059,7 +1060,7 @@ void workshop_file_closed(char *filename) char buffer[2*MAXPATHLEN]; vim_snprintf(buffer, sizeof(buffer), NOCATGETS("deletedFile %s\n"), filename); - (void)write(sd, buffer, strlen(buffer)); + dummy = write(sd, buffer, strlen(buffer)); } #endif @@ -1068,7 +1069,7 @@ void workshop_file_closed_lineno(char *filename, int lineno) char buffer[2*MAXPATHLEN]; vim_snprintf(buffer, sizeof(buffer), NOCATGETS("deletedFile %s %d\n"), filename, lineno); - (void)write(sd, buffer, strlen(buffer)); + dummy = write(sd, buffer, strlen(buffer)); } void workshop_file_opened(char *filename, int readOnly) @@ -1076,7 +1077,7 @@ void workshop_file_opened(char *filename, int readOnly) char buffer[2*MAXPATHLEN]; vim_snprintf(buffer, sizeof(buffer), NOCATGETS("loadedFile %s %d\n"), filename, readOnly); - (void)write(sd, buffer, strlen(buffer)); + dummy = write(sd, buffer, strlen(buffer)); } @@ -1085,7 +1086,7 @@ void workshop_file_saved(char *filename) char buffer[2*MAXPATHLEN]; vim_snprintf(buffer, sizeof(buffer), NOCATGETS("savedFile %s\n"), filename); - (void)write(sd, buffer, strlen(buffer)); + dummy = write(sd, buffer, strlen(buffer)); /* Let editor report any moved marks that the eserve client * should deal with (for example, moving location-based breakpoints) */ @@ -1098,7 +1099,7 @@ void workshop_file_modified(char *filename) char buffer[2*MAXPATHLEN]; vim_snprintf(buffer, sizeof(buffer), NOCATGETS("modifiedFile %s\n"), filename); - (void)write(sd, buffer, strlen(buffer)); + dummy = write(sd, buffer, strlen(buffer)); } void workshop_move_mark(char *filename, int markId, int newLineno) @@ -1106,7 +1107,7 @@ void workshop_move_mark(char *filename, int markId, int newLineno) char buffer[2*MAXPATHLEN]; vim_snprintf(buffer, sizeof(buffer), NOCATGETS("moveMark %s %d %d\n"), filename, markId, newLineno); - (void)write(sd, buffer, strlen(buffer)); + dummy = write(sd, buffer, strlen(buffer)); } #endif @@ -1119,7 +1120,7 @@ void workshop_frame_moved(int new_x, int new_y, int new_w, int new_h) vim_snprintf(buffer, sizeof(buffer), NOCATGETS("frameAt %d %d %d %d\n"), new_x, new_y, new_w, new_h); - (void)write(sd, buffer, strlen(buffer)); + dummy = write(sd, buffer, strlen(buffer)); } } @@ -1179,7 +1180,7 @@ void workshop_perform_verb(char *verb, void *clientData) selEndLine, selEndCol, selLength, selection); - (void)write(sd, buf, strlen(buf)); + dummy = write(sd, buf, strlen(buf)); if (*selection) { free(selection); } @@ -1190,7 +1191,7 @@ void workshop_perform_verb(char *verb, void *clientData) #if defined(NOHANDS_SUPPORT_FUNCTIONS) || defined(FEAT_BEVAL) void workshop_send_message(char *buf) { - (void)write(sd, buf, strlen(buf)); + dummy = write(sd, buf, strlen(buf)); } #endif diff --git a/src/mbyte.c b/src/mbyte.c index e6275899c2..e4df00ad5e 100644 --- a/src/mbyte.c +++ b/src/mbyte.c @@ -5222,7 +5222,7 @@ im_set_active(active) /* If 'imdisable' is set, XIM is never active. */ if (p_imdisable) active = FALSE; -#if !defined (FEAT_GUI_GTK) +#if !defined(FEAT_GUI_GTK) else if (input_style & XIMPreeditPosition) /* There is a problem in switching XIM off when preediting is used, * and it is not clear how this can be solved. For now, keep XIM on diff --git a/src/move.c b/src/move.c index cdc8c14790..3dd45c00db 100644 --- a/src/move.c +++ b/src/move.c @@ -2884,3 +2884,68 @@ halfpage(flag, Prenum) beginline(BL_SOL | BL_FIX); redraw_later(VALID); } + +#if defined(FEAT_CURSORBIND) || defined(PROTO) + void +do_check_cursorbind() +{ + linenr_T line = curwin->w_cursor.lnum; + colnr_T col = curwin->w_cursor.col; + win_T *old_curwin = curwin; + buf_T *old_curbuf = curbuf; +# ifdef FEAT_VISUAL + int old_VIsual_select = VIsual_select; + int old_VIsual_active = VIsual_active; +# endif + + /* + * loop through the cursorbound windows + */ +# ifdef FEAT_VISUAL + VIsual_select = VIsual_active = 0; +# endif + for (curwin = firstwin; curwin; curwin = curwin->w_next) + { + curbuf = curwin->w_buffer; + /* skip original window and windows with 'noscrollbind' */ + if (curwin != old_curwin && curwin->w_p_crb) + { +# ifdef FEAT_DIFF + if (curwin->w_p_diff) + curwin->w_cursor.lnum + = diff_get_corresponding_line(old_curbuf, + line, + curbuf, + curwin->w_cursor.lnum); + else +# endif + curwin->w_cursor.lnum = line; + curwin->w_cursor.col = col; + + /* Make sure the cursor is in a valid position. */ + check_cursor(); +# ifdef FEAT_MBYTE + /* Correct cursor for multi-byte character. */ + if (has_mbyte) + mb_adjust_cursor(); +# endif + + redraw_later(VALID); + update_topline(); +# ifdef FEAT_WINDOWS + curwin->w_redr_status = TRUE; +# endif + } + } + + /* + * reset current-window + */ +# ifdef FEAT_VISUAL + VIsual_select = old_VIsual_select; + VIsual_active = old_VIsual_active; +# endif + curwin = old_curwin; + curbuf = old_curbuf; +} +#endif /* FEAT_CURSORBIND */ diff --git a/src/normal.c b/src/normal.c index 3e8a492ec9..002430d712 100644 --- a/src/normal.c +++ b/src/normal.c @@ -1335,6 +1335,14 @@ normal_end: } #endif +#ifdef FEAT_CURSORBIND + if (curwin->w_p_crb && toplevel) + { + validate_cursor(); /* may need to update w_leftcol */ + do_check_cursorbind(); + } +#endif + /* * May restart edit(), if we got here with CTRL-O in Insert mode (but not * if still inside a mapping that started in Visual mode). @@ -2290,6 +2298,9 @@ do_mouse(oap, c, dir, count, fixindent) int old_mode = VIsual_mode; #endif int regname; +#ifdef FEAT_CONCEAL + linenr_T oldline = curwin->w_cursor.lnum; +#endif #if defined(FEAT_FOLDING) save_cursor = curwin->w_cursor; @@ -2762,6 +2773,14 @@ do_mouse(oap, c, dir, count, fixindent) curwin->w_cursor = save_cursor; } #endif +#ifdef FEAT_CONCEAL + if (curwin->w_p_conceal && moved + && (old_curwin != curwin || oldline != curwin->w_cursor.lnum)) + { + update_single_line(old_curwin, oldline); + update_single_line(curwin, curwin->w_cursor.lnum); + } +#endif #if defined(FEAT_CLIPBOARD) && defined(FEAT_CMDWIN) if ((jump_flags & IN_OTHER_WIN) && !VIsual_active && clip_star.available) @@ -5302,7 +5321,7 @@ nv_clear(cap) #endif #ifdef FEAT_SYN_HL /* Clear all syntax states to force resyncing. */ - syn_stack_free_all(curbuf); + syn_stack_free_all(curwin->w_s); #endif redraw_later(CLEAR); } @@ -5694,6 +5713,9 @@ nv_scroll(cap) linenr_T lnum; #endif int half; +#ifdef FEAT_CONCEAL + linenr_T oldline = curwin->w_cursor.lnum; +#endif cap->oap->motion_type = MLINE; setpcmark(); @@ -5781,6 +5803,13 @@ nv_scroll(cap) cursor_correct(); /* correct for 'so' */ beginline(BL_SOL | BL_FIX); +#ifdef FEAT_CONCEAL + if (curwin->w_p_conceal && oldline != curwin->w_cursor.lnu |