Patch 8.0.1662
Problem: Showing dump diff doesn't mention both file names.
Solution: Add the file name in the separator line.
Files: src/terminal.c
*** ../vim-8.0.1661/src/terminal.c 2018-04-04 23:00:01.272965911 +0200
--- src/terminal.c 2018-04-05 18:29:11.665383621 +0200
***************
*** 41,47 ****
* - Add a way to set the 16 ANSI colors, to be used for 'termguicolors' and
in
* the GUI.
* - Win32: Make terminal used for :!cmd in the GUI work better. Allow for
! * redirection.
* - implement term_setsize()
* - Copy text in the vterm to the Vim buffer once in a while, so that
* completion works.
--- 41,47 ----
* - Add a way to set the 16 ANSI colors, to be used for 'termguicolors' and
in
* the GUI.
* - Win32: Make terminal used for :!cmd in the GUI work better. Allow for
! * redirection. Probably in call to channel_set_pipes().
* - implement term_setsize()
* - Copy text in the vterm to the Vim buffer once in a while, so that
* completion works.
***************
*** 3917,3922 ****
--- 3917,3973 ----
}
/*
+ * Return an allocated string with at least "text_width" "=" characters and
+ * "fname" inserted in the middle.
+ */
+ static char_u *
+ get_separator(int text_width, char_u *fname)
+ {
+ int width = MAX(text_width, curwin->w_width);
+ char_u *textline;
+ int fname_size;
+ char_u *p = fname;
+ int i;
+ int off;
+
+ textline = alloc(width + STRLEN(fname) + 1);
+ if (textline == NULL)
+ return NULL;
+
+ fname_size = vim_strsize(fname);
+ if (fname_size < width - 8)
+ {
+ /* enough room, don't use the full window width */
+ width = MAX(text_width, fname_size + 8);
+ }
+ else if (fname_size > width - 8)
+ {
+ /* full name doesn't fit, use only the tail */
+ p = gettail(fname);
+ fname_size = vim_strsize(p);
+ }
+ /* skip characters until the name fits */
+ while (fname_size > width - 8)
+ {
+ p += (*mb_ptr2len)(p);
+ fname_size = vim_strsize(p);
+ }
+
+ for (i = 0; i < (width - fname_size) / 2 - 1; ++i)
+ textline[i] = '=';
+ textline[i++] = ' ';
+
+ STRCPY(textline + i, p);
+ off = STRLEN(textline);
+ textline[off] = ' ';
+ for (i = 1; i < (width - fname_size) / 2; ++i)
+ textline[off + i] = '=';
+ textline[off + i] = NUL;
+
+ return textline;
+ }
+
+ /*
* Common for "term_dumpdiff()" and "term_dumpload()".
*/
static void
***************
*** 4013,4028 ****
term->tl_top_diff_rows = curbuf->b_ml.ml_line_count;
! textline = alloc(width + 1);
if (textline == NULL)
goto theend;
- for (i = 0; i < width; ++i)
- textline[i] = '=';
- textline[width] = NUL;
if (add_empty_scrollback(term, &term->tl_default_color, 0) == OK)
ml_append(curbuf->b_ml.ml_line_count, textline, 0, FALSE);
if (add_empty_scrollback(term, &term->tl_default_color, 0) == OK)
ml_append(curbuf->b_ml.ml_line_count, textline, 0, FALSE);
bot_lnum = curbuf->b_ml.ml_line_count;
width2 = read_dump_file(fd2, &cursor_pos2);
--- 4064,4082 ----
term->tl_top_diff_rows = curbuf->b_ml.ml_line_count;
! textline = get_separator(width, fname1);
if (textline == NULL)
goto theend;
if (add_empty_scrollback(term, &term->tl_default_color, 0) == OK)
ml_append(curbuf->b_ml.ml_line_count, textline, 0, FALSE);
+ vim_free(textline);
+
+ textline = get_separator(width, fname2);
+ if (textline == NULL)
+ goto theend;
if (add_empty_scrollback(term, &term->tl_default_color, 0) == OK)
ml_append(curbuf->b_ml.ml_line_count, textline, 0, FALSE);
+ textline[width] = NUL;
bot_lnum = curbuf->b_ml.ml_line_count;
width2 = read_dump_file(fd2, &cursor_pos2);
***************
*** 4143,4148 ****
--- 4197,4205 ----
}
term->tl_cols = width;
+
+ /* looks better without wrapping */
+ curwin->w_p_wrap = 0;
}
theend:
*** ../vim-8.0.1661/src/version.c 2018-04-04 23:00:01.272965911 +0200
--- src/version.c 2018-04-05 18:44:42.209071683 +0200
***************
*** 764,765 ****
--- 764,767 ----
{ /* Add new patch number below this line */
+ /**/
+ 1662,
/**/
--
To be rich is not the end, but only a change of worries.
/// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\ an exciting new programming language -- http://www.Zimbu.org ///
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
--
--
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/d/optout.