Dear vim_dev,
Since today is the final day for new features I would like to point to
two patches that I really like. First one is by Christian Brabandt and
it is quite recent. It makes a few options persistent accross vimdiff
& diffoff cycle. The second one is a color output of digraphs. The
patch was written by Dominique Pellé.
Both are attached.
Best regards,
Marcin Szamotulski
--
--
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php
---
You received this message because you are subscribed to the Google Groups
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.
diff --git a/src/diff.c b/src/diff.c
--- a/src/diff.c
+++ b/src/diff.c
@@ -1140,21 +1140,28 @@
wp->w_p_diff = TRUE;
/* Use 'scrollbind' and 'cursorbind' when available */
#ifdef FEAT_SCROLLBIND
+ wp->w_p_scb_save = wp->w_p_scb;
wp->w_p_scb = TRUE;
#endif
#ifdef FEAT_CURSORBIND
+ wp->w_p_crb_save = wp->w_p_crb;
wp->w_p_crb = TRUE;
#endif
+ wp->w_p_wrap_save = wp->w_p_wrap;
wp->w_p_wrap = FALSE;
# ifdef FEAT_FOLDING
curwin = wp;
curbuf = curwin->w_buffer;
+ wp->w_p_fdm_save = vim_strsave(wp->w_p_fdm);
set_string_option_direct((char_u *)"fdm", -1, (char_u *)"diff",
OPT_LOCAL|OPT_FREE, 0);
curwin = old_curwin;
curbuf = curwin->w_buffer;
+ wp->w_p_fdc_save = wp->w_p_fdc;
wp->w_p_fdc = diff_foldcolumn;
+ wp->w_p_fen_save = wp->w_p_fen;
wp->w_p_fen = TRUE;
+ wp->w_p_fdl_save = wp->w_p_fdl;
wp->w_p_fdl = 0;
foldUpdateAll(wp);
/* make sure topline is not halfway a fold */
@@ -1190,18 +1197,38 @@
{
/* Set 'diff', 'scrollbind' off and 'wrap' on. */
wp->w_p_diff = FALSE;
+ /* Use 'scrollbind' and 'cursorbind' when available */
+#ifdef FEAT_SCROLLBIND
+ if (wp->w_p_scb)
+ wp->w_p_scb = wp->w_p_scb_save;
+#endif
+#ifdef FEAT_CURSORBIND
+ if (wp->w_p_crb)
+ wp->w_p_crb = wp->w_p_crb_save;
+#endif
RESET_BINDING(wp);
- wp->w_p_wrap = TRUE;
+ if (!wp->w_p_wrap)
+ wp->w_p_wrap = wp->w_p_wrap_save;
#ifdef FEAT_FOLDING
curwin = wp;
curbuf = curwin->w_buffer;
- set_string_option_direct((char_u *)"fdm", -1,
- (char_u *)"manual", OPT_LOCAL|OPT_FREE, 0);
+ if (wp->w_p_fdm_save != NULL)
+ {
+ free_string_option(wp->w_p_fdm);
+ wp->w_p_fdm = wp->w_p_fdm_save;
+ wp->w_p_fdm_save = empty_option;
+ }
+ else
+ set_string_option_direct((char_u *)"fdm", -1,
+ (char_u *)"manual", OPT_LOCAL|OPT_FREE, 0);
curwin = old_curwin;
curbuf = curwin->w_buffer;
- wp->w_p_fdc = 0;
- wp->w_p_fen = FALSE;
- wp->w_p_fdl = 0;
+ if (wp->w_p_fdc == diff_foldcolumn)
+ wp->w_p_fdc = wp->w_p_fdc_save;
+ if (wp->w_p_fen)
+ wp->w_p_fen = wp->w_p_fen_save;
+ if (wp->w_p_fdl == 0)
+ wp->w_p_fdl = wp->w_p_fdl_save;
foldUpdateAll(wp);
/* make sure topline is not halfway a fold */
changed_window_setting_win(wp);
diff --git a/src/structs.h b/src/structs.h
--- a/src/structs.h
+++ b/src/structs.h
@@ -141,14 +141,22 @@
#ifdef FEAT_FOLDING
long wo_fdc;
# define w_p_fdc w_onebuf_opt.wo_fdc /* 'foldcolumn' */
+ int wo_fdc_save;
+# define w_p_fdc_save w_onebuf_opt.wo_fdc_save /* 'foldenable' saved for diff mode */
int wo_fen;
# define w_p_fen w_onebuf_opt.wo_fen /* 'foldenable' */
+ int wo_fen_save;
+# define w_p_fen_save w_onebuf_opt.wo_fen_save /* 'foldenable' saved for diff mode */
char_u *wo_fdi;
# define w_p_fdi w_onebuf_opt.wo_fdi /* 'foldignore' */
long wo_fdl;
# define w_p_fdl w_onebuf_opt.wo_fdl /* 'foldlevel' */
+ int wo_fdl_save;
+# define w_p_fdl_save w_onebuf_opt.wo_fdl_save /* 'foldlevel' state saved for diff mode */
char_u *wo_fdm;
# define w_p_fdm w_onebuf_opt.wo_fdm /* 'foldmethod' */
+ char_u *wo_fdm_save;
+# define w_p_fdm_save w_onebuf_opt.wo_fdm_save /* 'fdm' saved for diff mode */
long wo_fml;
# define w_p_fml w_onebuf_opt.wo_fml /* 'foldminlines' */
long wo_fdn;
@@ -213,9 +221,13 @@
#ifdef FEAT_SCROLLBIND
int wo_scb;
# define w_p_scb w_onebuf_opt.wo_scb /* 'scrollbind' */
+ int wo_scb_save;
+# define w_p_scb_save w_onebuf_opt.wo_scb_save /* 'scrollbind' saved for diff mode*/
#endif
int wo_wrap;
#define w_p_wrap w_onebuf_opt.wo_wrap /* 'wrap' */
+ int wo_wrap_save;
+# define w_p_wrap_save w_onebuf_opt.wo_wrap_save /* 'wrap' state saved for diff mode*/
#ifdef FEAT_CONCEAL
char_u *wo_cocu; /* 'concealcursor' */
# define w_p_cocu w_onebuf_opt.wo_cocu
@@ -225,6 +237,8 @@
#ifdef FEAT_CURSORBIND
int wo_crb;
# define w_p_crb w_onebuf_opt.wo_crb /* 'cursorbind' */
+ int wo_crb_save;
+# define w_p_crb_save w_onebuf_opt.wo_crb_save /* 'cursorbind' state saved for diff mode*/
#endif
#ifdef FEAT_EVAL
diff -r 538ff809ae53 src/digraph.c
--- a/src/digraph.c Thu Nov 29 20:10:00 2012 +0100
+++ b/src/digraph.c Sat Dec 01 20:59:47 2012 +0100
@@ -2324,6 +2324,9 @@
*p++ = dp->char1;
*p++ = dp->char2;
*p++ = ' ';
+ *p = NUL;
+ msg_outtrans(buf);
+ p = buf;
#ifdef FEAT_MBYTE
if (has_mbyte)
{
@@ -2335,6 +2338,9 @@
else
#endif
*p++ = (char_u)dp->result;
+ *p = NUL;
+ msg_outtrans_attr(buf, hl_attr(HLF_D));
+ p = buf;
if (char2cells(dp->result) == 1)
*p++ = ' ';
vim_snprintf((char *)p, sizeof(buf) - (p - buf), " %3d", dp->result);