summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--runtime/doc/eval.txt9
-rw-r--r--runtime/doc/options.txt39
-rw-r--r--runtime/doc/syntax.txt69
-rw-r--r--runtime/doc/tags17
-rw-r--r--runtime/doc/todo.txt8
-rw-r--r--runtime/doc/various.txt2
-rw-r--r--runtime/optwin.vim5
-rw-r--r--src/buffer.c31
-rw-r--r--src/diff.c75
-rw-r--r--src/edit.c34
-rw-r--r--src/eval.c48
-rw-r--r--src/ex_cmds.c14
-rw-r--r--src/ex_cmds.h2
-rw-r--r--src/ex_cmds2.c2
-rw-r--r--src/ex_docmd.c1
-rw-r--r--src/feature.h21
-rw-r--r--src/globals.h5
-rw-r--r--src/hardcopy.c2
-rw-r--r--src/if_python.c2
-rw-r--r--src/integration.c27
-rw-r--r--src/mbyte.c2
-rw-r--r--src/move.c65
-rw-r--r--src/normal.c117
-rw-r--r--src/option.c124
-rw-r--r--src/option.h6
-rw-r--r--src/proto/diff.pro1
-rw-r--r--src/proto/move.pro1
-rw-r--r--src/proto/screen.pro1
-rw-r--r--src/proto/spell.pro10
-rw-r--r--src/proto/syntax.pro10
-rw-r--r--src/screen.c272
-rw-r--r--src/search.c10
-rw-r--r--src/spell.c270
-rw-r--r--src/structs.h154
-rw-r--r--src/syntax.c920
-rw-r--r--src/ui.c2
-rw-r--r--src/version.c16
-rw-r--r--src/vim.h24
-rw-r--r--src/window.c14
-rw-r--r--src/workshop.c3
40 files changed, 1737 insertions, 698 deletions
diff --git a/runtime/doc/eval.txt b/runtime/doc/eval.txt
index 7d5e6d6e0b..fda756fbb9 100644
--- a/runtime/doc/eval.txt
+++ b/runtime/doc/eval.txt
@@ -1163,6 +1163,13 @@ b:changedtick The total number of changes to the current buffer. It is
A variable name that is preceded with "w:" is local to the current window. It
is deleted when the window is closed.
+One local window variable is predefined:
+ *w:ownsyntax-variable* *ownsyntax*
+w:ownsyntax Set to 1 if the window has an independent syntax installed
+ via the |:ownsyntax| command. The default for a window is
+ 0. Syntax scripts can use this to determine whether they
+ should set b:current_syntax or w:current_syntax.
+
*tabpage-variable* *t:var*
A variable name that is preceded with "t:" is local to the current tab page,
It is deleted when the tab page is closed. {not available when compiled
@@ -5772,7 +5779,7 @@ undofile({name}) *undofile()*
Return the name of the undo file that would be used for a file
with name {name} when writing. This uses the 'undodir'
option, finding directories that exist. It does not check if
- the undo file exist.
+ the undo file exists.
{name} is always expanded to the full path, since that is what
is used internally.
Useful in combination with |:wundo| and |:rundo|.
diff --git a/runtime/doc/options.txt b/runtime/doc/options.txt
index 63efd1c24b..c021edfc47 100644
--- a/runtime/doc/options.txt
+++ b/runtime/doc/options.txt
@@ -1707,6 +1707,25 @@ A jump table for the options with a short description can be found at |Q_op|.
combination with "menu" or "menuone".
+'conceallevel' 'conc' *'conceallevel'* *'conc'*
+ number (default 0)
+ local to window
+ {not in Vi}
+ {not available when compiled without the |+conceal|
+ feature}
+ Determine how text with the "conceal" syntax attribute is shown:
+
+ 'conceallevel' Effect
+ 0 Text is shown normally
+ 1 Each block of concealed text is replaced with the
+ character defined in 'listchars' (default is a dash)
+ and highlighted with the "Conceal" highlight group.
+ 2 Concealed text is completely hidden unless it has a
+ custom replacement character defined (see
+ |:syn-cchar|.
+ 3 Concealed text is completely hidden.
+
+
*'confirm'* *'cf'* *'noconfirm'* *'nocf'*
'confirm' 'cf' boolean (default off)
global
@@ -2132,6 +2151,20 @@ A jump table for the options with a short description can be found at |Q_op|.
Give messages when adding a cscope database. See |cscopeverbose|.
NOTE: This option is reset when 'compatible' is set.
+ *'cursorbind'* *'crb'* *'nocursorbind'* *'nocrb'*
+'cursorbind' 'crb' boolean (default off)
+ local to window
+ {not in Vi}
+ {not available when compiled without the |+cursorbind|
+ feature}
+ When this option is set, as the cursor in the current
+ window moves other cursorbound windows (windows that also have
+ this option set) move their cursors to the corresponding line and
+ column. This option is useful for viewing the
+ differences between two versions of a file (see 'diff'); in diff mode,
+ inserted and deleted lines (though not characters within a line) are
+ taken into account.
+
*'cursorcolumn'* *'cuc'* *'nocursorcolumn'* *'nocuc'*
'cursorcolumn' 'cuc' boolean (default off)
@@ -3615,7 +3648,7 @@ A jump table for the options with a short description can be found at |Q_op|.
f:Folded,F:FoldColumn,A:DiffAdd,
C:DiffChange,D:DiffDelete,T:DiffText,
>:SignColumn,B:SpellBad,P:SpellCap,
- R:SpellRare,L:SpellLocal,
+ R:SpellRare,L:SpellLocal,-:Conceal,
+:Pmenu,=:PmenuSel,
x:PmenuSbar,X:PmenuThumb")
global
@@ -3659,6 +3692,8 @@ A jump table for the options with a short description can be found at |Q_op|.
|hl-SpellCap| P word that should start with capital|spell|
|hl-SpellRare| R rare word |spell|
|hl-SpellLocal| L word from other region |spell|
+ |hl-Conceal| - the placeholders used for concealed characters
+ (see 'conceallevel')
|hl-Pmenu| + popup menu normal line
|hl-PmenuSel| = popup menu normal line
|hl-PmenuSbar| x popup menu scrollbar
@@ -4416,6 +4451,8 @@ A jump table for the options with a short description can be found at |Q_op|.
precedes:c Character to show in the first column, when 'wrap'
is off and there is text preceding the character
visible in the first column.
+ conceal:c Character to show in place of concealed text, when
+ 'conceallevel' is set to 1.
nbsp:c Character to show for a non-breakable space (character
0xA0, 160). Left blank when omitted.
diff --git a/runtime/doc/syntax.txt b/runtime/doc/syntax.txt
index 109276f40d..47a1aac797 100644
--- a/runtime/doc/syntax.txt
+++ b/runtime/doc/syntax.txt
@@ -35,7 +35,8 @@ In the User Manual:
13. Linking groups |:highlight-link|
14. Cleaning up |:syn-clear|
15. Highlighting tags |tag-highlight|
-16. Color xterms |xterm-color|
+16. Window-local syntax |:ownsyntax|
+17. Color xterms |xterm-color|
{Vi does not have any of these commands}
@@ -3115,12 +3116,14 @@ and may be mixed with patterns.
Not all commands accept all arguments. This table shows which arguments
can not be used for all commands:
*E395* *E396*
- contains oneline fold display extend ~
-:syntax keyword - - - - -
-:syntax match yes - yes yes yes
-:syntax region yes yes yes yes yes
+ contains oneline fold display extend concealends~
+:syntax keyword - - - - - -
+:syntax match yes - yes yes yes -
+:syntax region yes yes yes yes yes yes
These arguments can be used for all three commands:
+ conceal
+ cchar
contained
containedin
nextgroup
@@ -3129,6 +3132,27 @@ These arguments can be used for all three commands:
skipnl
skipempty
+conceal *conceal* *:syn-conceal*
+
+When the "conceal" argument is given, the item is marked as concealable.
+Whether or not it is actually concealed depends on the setting on the
+'conceallevel' option.
+
+concealends *:syn-concealends*
+
+When the "concealends" argument is given, the start and end matches of
+the region, but not the contents of the region, are marked as concealable.
+Whether or not they are actually concealed depends on the setting on the
+'conceallevel' option. The ends of a region can only be concealed separately
+in this way when they have their own highlighting via "matchgroup"
+
+cchar *:syn-cchar*
+
+The "cchar" argument defines the character shown in place of the item
+when it is concealed (setting "cchar" only makes sense when the conceal
+argument is given.) If "cchar" is not set then the default conceal
+character defined in the 'listchars' option is used. Example: >
+ :syntax match Entity "&" conceal cchar=&
contained *:syn-contained*
@@ -3385,6 +3409,16 @@ Note that this example doesn't work for nested "if"s. You need to add
"contains" arguments to make that work (omitted for simplicity of the
example).
+IMPLICIT CONCEAL *:syn-conceal-implicit*
+
+:sy[ntax] conceal [on|off]
+ This defines if the following ":syntax" commands will define keywords,
+ matches or regions with the "conceal" flag set. After ":syn conceal
+ on", all subsequent ":syn keyword", ":syn match" or ":syn region"
+ defined will have the "conceal" flag set implicitly. ":syn conceal
+ off" returns to the normal state where the "conceal" flag must be
+ given explicitly.
+
==============================================================================
7. Syntax patterns *:syn-pattern* *E401* *E402*
@@ -4169,6 +4203,9 @@ These are the default highlighting groups. These groups are used by the
'highlight' option default. Note that the highlighting depends on the value
of 'background'. You can see the current settings with the ":highlight"
command.
+ *hl-Conceal*
+Conceal placeholder characters substituted for concealed
+ text (see 'conceallevel')
*hl-Cursor*
Cursor the character under the cursor
*hl-CursorIM*
@@ -4472,6 +4509,28 @@ And put these lines in your .vimrc: >
autocmd BufRead,BufNewFile *.[ch] endif
==============================================================================
+16. Window-local syntax *:ownsyntax*
+
+Normally all windows on a buffer share the same syntax settings. It is
+possible, however, to set a particular window on a file to have its own
+private syntax setting. A possible example would be to edit LaTeX source
+with conventional highlighting in one window, while seeing the same source
+highlighted differently (so as to hide control sequences and indicate bold,
+italic etc regions) in another. The 'scrollbind' option is useful here.
+
+To set the current window to have the syntax "foo", separately from all other
+windows on the buffer: >
+ :ownsyntax foo
+
+Once a window has its own syntax, syntax commands executed from other windows
+on the same buffer (including :syntax clear) have no effect. Conversely,
+syntax commands executed from that window do not effect other windows on the
+same buffer.
+
+A window with its own syntax reverts to normal behaviour when another buffer
+is loaded into that window.
+
+==============================================================================
16. Color xterms *xterm-color* *color-xterm*
Most color xterms have only eight colors. If you don't get colors with the
diff --git a/runtime/doc/tags b/runtime/doc/tags
index 632f288458..18cd16b89b 100644
--- a/runtime/doc/tags
+++ b/runtime/doc/tags
@@ -134,6 +134,8 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
'complete' options.txt /*'complete'*
'completefunc' options.txt /*'completefunc'*
'completeopt' options.txt /*'completeopt'*
+'conc' options.txt /*'conc'*
+'conceallevel' options.txt /*'conceallevel'*
'confirm' options.txt /*'confirm'*
'consk' options.txt /*'consk'*
'conskey' options.txt /*'conskey'*
@@ -143,6 +145,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
'cpo' options.txt /*'cpo'*
'cpoptions' options.txt /*'cpoptions'*
'cpt' options.txt /*'cpt'*
+'crb' options.txt /*'crb'*
'cryptmethod' options.txt /*'cryptmethod'*
'cscopepathcomp' options.txt /*'cscopepathcomp'*
'cscopeprg' options.txt /*'cscopeprg'*
@@ -158,6 +161,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
'csverb' options.txt /*'csverb'*
'cuc' options.txt /*'cuc'*
'cul' options.txt /*'cul'*
+'cursorbind' options.txt /*'cursorbind'*
'cursorcolumn' options.txt /*'cursorcolumn'*
'cursorline' options.txt /*'cursorline'*
'cwh' options.txt /*'cwh'*
@@ -482,12 +486,14 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
'noconskey' options.txt /*'noconskey'*
'nocopyindent' options.txt /*'nocopyindent'*
'nocp' options.txt /*'nocp'*
+'nocrb' options.txt /*'nocrb'*
'nocscopetag' options.txt /*'nocscopetag'*
'nocscopeverbose' options.txt /*'nocscopeverbose'*
'nocst' options.txt /*'nocst'*
'nocsverb' options.txt /*'nocsverb'*
'nocuc' options.txt /*'nocuc'*
'nocul' options.txt /*'nocul'*
+'nocursorbind' options.txt /*'nocursorbind'*
'nocursorcolumn' options.txt /*'nocursorcolumn'*
'nocursorline' options.txt /*'nocursorline'*
'nodeco' options.txt /*'nodeco'*
@@ -1120,8 +1126,10 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
+cmdline_hist various.txt /*+cmdline_hist*
+cmdline_info various.txt /*+cmdline_info*
+comments various.txt /*+comments*
++conceal various.txt /*+conceal*
+cryptv various.txt /*+cryptv*
+cscope various.txt /*+cscope*
++cursorbind various.txt /*+cursorbind*
+cursorshape various.txt /*+cursorshape*
+debug various.txt /*+debug*
+dialog_con various.txt /*+dialog_con*
@@ -2495,6 +2503,7 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
:ounmap map.txt /*:ounmap*
:ounme gui.txt /*:ounme*
:ounmenu gui.txt /*:ounmenu*
+:ownsyntax syntax.txt /*:ownsyntax*
:p various.txt /*:p*
:pc windows.txt /*:pc*
:pclose windows.txt /*:pclose*
@@ -2761,8 +2770,12 @@ $VIMRUNTIME starting.txt /*$VIMRUNTIME*
:syn syntax.txt /*:syn*
:syn-arguments syntax.txt /*:syn-arguments*
:syn-case syntax.txt /*:syn-case*
+:syn-cchar syntax.txt /*:syn-cchar*
:syn-clear syntax.txt /*:syn-clear*
:syn-cluster syntax.txt /*:syn-cluster*
+:syn-conceal syntax.txt /*:syn-conceal*
+:syn-conceal-implicit syntax.txt /*:syn-conceal-implicit*
+:syn-concealends syntax.txt /*:syn-concealends*
:syn-contained syntax.txt /*:syn-contained*
:syn-containedin syntax.txt /*:syn-containedin*
:syn-contains syntax.txt /*:syn-contains*
@@ -4956,6 +4969,7 @@ complete_check() eval.txt /*complete_check()*
complex-change change.txt /*complex-change*
complex-repeat repeat.txt /*complex-repeat*
compress pi_gzip.txt /*compress*
+conceal syntax.txt /*conceal*
confirm() eval.txt /*confirm()*
connection-refused message.txt /*connection-refused*
console-menus gui.txt /*console-menus*
@@ -6019,6 +6033,7 @@ hit-enter-prompt message.txt /*hit-enter-prompt*
hit-return message.txt /*hit-return*
hitest.vim syntax.txt /*hitest.vim*
hjkl usr_02.txt /*hjkl*
+hl-Conceal syntax.txt /*hl-Conceal*
hl-Cursor syntax.txt /*hl-Cursor*
hl-CursorColumn syntax.txt /*hl-CursorColumn*
hl-CursorIM syntax.txt /*hl-CursorIM*
@@ -6895,6 +6910,7 @@ os_unix.txt os_unix.txt /*os_unix.txt*
os_vms.txt os_vms.txt /*os_vms.txt*
os_win32.txt os_win32.txt /*os_win32.txt*
other-features vi_diff.txt /*other-features*
+ownsyntax eval.txt /*ownsyntax*
p change.txt /*p*
page-down intro.txt /*page-down*
page-up intro.txt /*page-up*
@@ -8200,6 +8216,7 @@ vt100-cursor-keys term.txt /*vt100-cursor-keys*
vt100-function-keys term.txt /*vt100-function-keys*
w motion.txt /*w*
w32-clientserver remote.txt /*w32-clientserver*
+w:ownsyntax-variable eval.txt /*w:ownsyntax-variable*
w:var eval.txt /*w:var*
warningmsg-variable eval.txt /*warningmsg-variable*
white-space pattern.txt /*white-space*
diff --git a/runtime/doc/todo.txt b/runtime/doc/todo.txt
index 27039a2492..12c6b682ab 100644
--- a/runtime/doc/todo.txt
+++ b/runtime/doc/todo.txt
@@ -1082,6 +1082,10 @@ restored. (Luc St-Louis)
Vim 7.3:
+- Included conceal patch.
+ remove w:ownsyntax, automatically set w:current_syntax to the value of
+ b:current_syntax after loading a syntax file.
+ :ownsyntax only sets w:current_syntax.
- using NSIS 2.46: install on Windows 7 works, but no "Edit with Vim" menu.
Use register_shell_extension()? (George Reilly, 2010 May 26)
Ron's version: http://dev.ronware.org/p/vim/finfo?name=gvim.nsi
@@ -1108,10 +1112,6 @@ Vim 7.3:
- Create a helphelp.txt file, move instructions there to write help files from
various.txt and list by Tony.
Patches to include:
-- Include conceal patch?
- http://vince.negri.googlepages.com/
- http://vim.wikia.com/wiki/Patch_to_conceal_parts_of_lines
- http://sites.google.com/site/vincenegri/conceal-ownsyntax.diff?attredirects=0
- Patch for Lisp support with ECL (Mikael Jansson, 2008 Oct 25)
- Minor patches from Dominique Pelle, 2010 May 15
- Gvimext patch to support wide file names. (Szabolcs Horvat 2008 Sep 10)
diff --git a/runtime/doc/various.txt b/runtime/doc/various.txt
index 3f1d061ba5..63b279b322 100644
--- a/runtime/doc/various.txt
+++ b/runtime/doc/various.txt
@@ -293,8 +293,10 @@ N *+cmdline_compl* command line completion |cmdline-completion|
N *+cmdline_hist* command line history |cmdline-history|
N *+cmdline_info* |'showcmd'| and |'ruler'|
N *+comments* |'comments'| support
+m *+conceal* "conceal" support, see ||conceal|| |:syn-conceal| etc.
N *+cryptv* encryption support |encryption|
B *+cscope* |cscope| support
+m *+cursorbind* |'cursorbind'| support
m *+cursorshape* |termcap-cursor-shape| support
m *+debug* Compiled for debugging.
N *+dialog_gui* Support for |:confirm| with GUI dialog.
diff --git a/runtime/optwin.vim b/runtime/optwin.vim
index 0ace4cc6d4..12e934f2dd 100644
--- a/runtime/optwin.vim
+++ b/runtime/optwin.vim
@@ -373,6 +373,11 @@ if has("linebreak")
call append("$", "\t(local to window)")
call <SID>OptionL("nuw")
endif
+if has("conceal")
+ call append("$", "conceallevel\tcontrols whether concealable elements are hidden")
+ call append("$", "\t(local to window)")
+ call <SID>OptionL("conc")
+endif
call <SID>Header("syntax, highlighting and spelling")
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
<