|
|
22c937 |
To: vim_dev@googlegroups.com
|
|
|
22c937 |
Subject: Patch 7.4.603
|
|
|
22c937 |
Fcc: outbox
|
|
|
22c937 |
From: Bram Moolenaar <Bram@moolenaar.net>
|
|
|
22c937 |
Mime-Version: 1.0
|
|
|
22c937 |
Content-Type: text/plain; charset=UTF-8
|
|
|
22c937 |
Content-Transfer-Encoding: 8bit
|
|
|
22c937 |
------------
|
|
|
22c937 |
|
|
|
22c937 |
Patch 7.4.603
|
|
|
22c937 |
Problem: 'foldcolumn' may be set such that it fills the whole window, not
|
|
|
22c937 |
leaving space for text.
|
|
|
22c937 |
Solution: Reduce the foldcolumn width when there is not sufficient room.
|
|
|
22c937 |
(idea by Christian Brabandt)
|
|
|
22c937 |
Files: src/srcreen.c
|
|
|
22c937 |
|
|
|
22c937 |
|
|
|
22c937 |
*** ../vim-7.4.602/src/screen.c 2015-01-20 19:01:32.380444290 +0100
|
|
|
22c937 |
--- src/screen.c 2015-01-27 16:25:47.264690419 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 109,114 ****
|
|
|
22c937 |
--- 109,115 ----
|
|
|
22c937 |
|
|
|
22c937 |
#ifdef FEAT_FOLDING
|
|
|
22c937 |
static foldinfo_T win_foldinfo; /* info for 'foldcolumn' */
|
|
|
22c937 |
+ static int compute_foldcolumn __ARGS((win_T *wp, int col));
|
|
|
22c937 |
#endif
|
|
|
22c937 |
|
|
|
22c937 |
/*
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 1202,1208 ****
|
|
|
22c937 |
lnumb = wp->w_lines[i].wl_lnum;
|
|
|
22c937 |
/* When there is a fold column it might need updating
|
|
|
22c937 |
* in the next line ("J" just above an open fold). */
|
|
|
22c937 |
! if (wp->w_p_fdc > 0)
|
|
|
22c937 |
++lnumb;
|
|
|
22c937 |
}
|
|
|
22c937 |
}
|
|
|
22c937 |
--- 1203,1209 ----
|
|
|
22c937 |
lnumb = wp->w_lines[i].wl_lnum;
|
|
|
22c937 |
/* When there is a fold column it might need updating
|
|
|
22c937 |
* in the next line ("J" just above an open fold). */
|
|
|
22c937 |
! if (compute_foldcolumn(wp, 0) > 0)
|
|
|
22c937 |
++lnumb;
|
|
|
22c937 |
}
|
|
|
22c937 |
}
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 2238,2250 ****
|
|
|
22c937 |
#else
|
|
|
22c937 |
# define FDC_OFF 0
|
|
|
22c937 |
#endif
|
|
|
22c937 |
|
|
|
22c937 |
#ifdef FEAT_RIGHTLEFT
|
|
|
22c937 |
if (wp->w_p_rl)
|
|
|
22c937 |
{
|
|
|
22c937 |
/* No check for cmdline window: should never be right-left. */
|
|
|
22c937 |
# ifdef FEAT_FOLDING
|
|
|
22c937 |
! n = wp->w_p_fdc;
|
|
|
22c937 |
|
|
|
22c937 |
if (n > 0)
|
|
|
22c937 |
{
|
|
|
22c937 |
--- 2239,2254 ----
|
|
|
22c937 |
#else
|
|
|
22c937 |
# define FDC_OFF 0
|
|
|
22c937 |
#endif
|
|
|
22c937 |
+ #ifdef FEAT_FOLDING
|
|
|
22c937 |
+ int fdc = compute_foldcolumn(wp, 0);
|
|
|
22c937 |
+ #endif
|
|
|
22c937 |
|
|
|
22c937 |
#ifdef FEAT_RIGHTLEFT
|
|
|
22c937 |
if (wp->w_p_rl)
|
|
|
22c937 |
{
|
|
|
22c937 |
/* No check for cmdline window: should never be right-left. */
|
|
|
22c937 |
# ifdef FEAT_FOLDING
|
|
|
22c937 |
! n = fdc;
|
|
|
22c937 |
|
|
|
22c937 |
if (n > 0)
|
|
|
22c937 |
{
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 2293,2301 ****
|
|
|
22c937 |
}
|
|
|
22c937 |
#endif
|
|
|
22c937 |
#ifdef FEAT_FOLDING
|
|
|
22c937 |
! if (wp->w_p_fdc > 0)
|
|
|
22c937 |
{
|
|
|
22c937 |
! int nn = n + wp->w_p_fdc;
|
|
|
22c937 |
|
|
|
22c937 |
/* draw the fold column at the left */
|
|
|
22c937 |
if (nn > W_WIDTH(wp))
|
|
|
22c937 |
--- 2297,2305 ----
|
|
|
22c937 |
}
|
|
|
22c937 |
#endif
|
|
|
22c937 |
#ifdef FEAT_FOLDING
|
|
|
22c937 |
! if (fdc > 0)
|
|
|
22c937 |
{
|
|
|
22c937 |
! int nn = n + fdc;
|
|
|
22c937 |
|
|
|
22c937 |
/* draw the fold column at the left */
|
|
|
22c937 |
if (nn > W_WIDTH(wp))
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 2346,2351 ****
|
|
|
22c937 |
--- 2350,2373 ----
|
|
|
22c937 |
|
|
|
22c937 |
#ifdef FEAT_FOLDING
|
|
|
22c937 |
/*
|
|
|
22c937 |
+ * Compute the width of the foldcolumn. Based on 'foldcolumn' and how much
|
|
|
22c937 |
+ * space is available for window "wp", minus "col".
|
|
|
22c937 |
+ */
|
|
|
22c937 |
+ static int
|
|
|
22c937 |
+ compute_foldcolumn(wp, col)
|
|
|
22c937 |
+ win_T *wp;
|
|
|
22c937 |
+ int col;
|
|
|
22c937 |
+ {
|
|
|
22c937 |
+ int fdc = wp->w_p_fdc;
|
|
|
22c937 |
+ int wmw = wp == curwin && p_wmw == 0 ? 1 : p_wmw;
|
|
|
22c937 |
+ int wwidth = W_WIDTH(wp);
|
|
|
22c937 |
+
|
|
|
22c937 |
+ if (fdc > wwidth - (col + wmw))
|
|
|
22c937 |
+ fdc = wwidth - (col + wmw);
|
|
|
22c937 |
+ return fdc;
|
|
|
22c937 |
+ }
|
|
|
22c937 |
+
|
|
|
22c937 |
+ /*
|
|
|
22c937 |
* Display one folded line.
|
|
|
22c937 |
*/
|
|
|
22c937 |
static void
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 2396,2405 ****
|
|
|
22c937 |
|
|
|
22c937 |
/*
|
|
|
22c937 |
* 2. Add the 'foldcolumn'
|
|
|
22c937 |
*/
|
|
|
22c937 |
! fdc = wp->w_p_fdc;
|
|
|
22c937 |
! if (fdc > W_WIDTH(wp) - col)
|
|
|
22c937 |
! fdc = W_WIDTH(wp) - col;
|
|
|
22c937 |
if (fdc > 0)
|
|
|
22c937 |
{
|
|
|
22c937 |
fill_foldcolumn(buf, wp, TRUE, lnum);
|
|
|
22c937 |
--- 2418,2426 ----
|
|
|
22c937 |
|
|
|
22c937 |
/*
|
|
|
22c937 |
* 2. Add the 'foldcolumn'
|
|
|
22c937 |
+ * Reduce the width when there is not enough space.
|
|
|
22c937 |
*/
|
|
|
22c937 |
! fdc = compute_foldcolumn(wp, col);
|
|
|
22c937 |
if (fdc > 0)
|
|
|
22c937 |
{
|
|
|
22c937 |
fill_foldcolumn(buf, wp, TRUE, lnum);
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 2787,2809 ****
|
|
|
22c937 |
int level;
|
|
|
22c937 |
int first_level;
|
|
|
22c937 |
int empty;
|
|
|
22c937 |
|
|
|
22c937 |
/* Init to all spaces. */
|
|
|
22c937 |
! copy_spaces(p, (size_t)wp->w_p_fdc);
|
|
|
22c937 |
|
|
|
22c937 |
level = win_foldinfo.fi_level;
|
|
|
22c937 |
if (level > 0)
|
|
|
22c937 |
{
|
|
|
22c937 |
/* If there is only one column put more info in it. */
|
|
|
22c937 |
! empty = (wp->w_p_fdc == 1) ? 0 : 1;
|
|
|
22c937 |
|
|
|
22c937 |
/* If the column is too narrow, we start at the lowest level that
|
|
|
22c937 |
* fits and use numbers to indicated the depth. */
|
|
|
22c937 |
! first_level = level - wp->w_p_fdc - closed + 1 + empty;
|
|
|
22c937 |
if (first_level < 1)
|
|
|
22c937 |
first_level = 1;
|
|
|
22c937 |
|
|
|
22c937 |
! for (i = 0; i + empty < wp->w_p_fdc; ++i)
|
|
|
22c937 |
{
|
|
|
22c937 |
if (win_foldinfo.fi_lnum == lnum
|
|
|
22c937 |
&& first_level + i >= win_foldinfo.fi_low_level)
|
|
|
22c937 |
--- 2808,2831 ----
|
|
|
22c937 |
int level;
|
|
|
22c937 |
int first_level;
|
|
|
22c937 |
int empty;
|
|
|
22c937 |
+ int fdc = compute_foldcolumn(wp, 0);
|
|
|
22c937 |
|
|
|
22c937 |
/* Init to all spaces. */
|
|
|
22c937 |
! copy_spaces(p, (size_t)fdc);
|
|
|
22c937 |
|
|
|
22c937 |
level = win_foldinfo.fi_level;
|
|
|
22c937 |
if (level > 0)
|
|
|
22c937 |
{
|
|
|
22c937 |
/* If there is only one column put more info in it. */
|
|
|
22c937 |
! empty = (fdc == 1) ? 0 : 1;
|
|
|
22c937 |
|
|
|
22c937 |
/* If the column is too narrow, we start at the lowest level that
|
|
|
22c937 |
* fits and use numbers to indicated the depth. */
|
|
|
22c937 |
! first_level = level - fdc - closed + 1 + empty;
|
|
|
22c937 |
if (first_level < 1)
|
|
|
22c937 |
first_level = 1;
|
|
|
22c937 |
|
|
|
22c937 |
! for (i = 0; i + empty < fdc; ++i)
|
|
|
22c937 |
{
|
|
|
22c937 |
if (win_foldinfo.fi_lnum == lnum
|
|
|
22c937 |
&& first_level + i >= win_foldinfo.fi_low_level)
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 2819,2825 ****
|
|
|
22c937 |
}
|
|
|
22c937 |
}
|
|
|
22c937 |
if (closed)
|
|
|
22c937 |
! p[i >= wp->w_p_fdc ? i - 1 : i] = '+';
|
|
|
22c937 |
}
|
|
|
22c937 |
#endif /* FEAT_FOLDING */
|
|
|
22c937 |
|
|
|
22c937 |
--- 2841,2847 ----
|
|
|
22c937 |
}
|
|
|
22c937 |
}
|
|
|
22c937 |
if (closed)
|
|
|
22c937 |
! p[i >= fdc ? i - 1 : i] = '+';
|
|
|
22c937 |
}
|
|
|
22c937 |
#endif /* FEAT_FOLDING */
|
|
|
22c937 |
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 3556,3567 ****
|
|
|
22c937 |
#ifdef FEAT_FOLDING
|
|
|
22c937 |
if (draw_state == WL_FOLD - 1 && n_extra == 0)
|
|
|
22c937 |
{
|
|
|
22c937 |
draw_state = WL_FOLD;
|
|
|
22c937 |
! if (wp->w_p_fdc > 0)
|
|
|
22c937 |
{
|
|
|
22c937 |
/* Draw the 'foldcolumn'. */
|
|
|
22c937 |
fill_foldcolumn(extra, wp, FALSE, lnum);
|
|
|
22c937 |
! n_extra = wp->w_p_fdc;
|
|
|
22c937 |
p_extra = extra;
|
|
|
22c937 |
p_extra[n_extra] = NUL;
|
|
|
22c937 |
c_extra = NUL;
|
|
|
22c937 |
--- 3578,3591 ----
|
|
|
22c937 |
#ifdef FEAT_FOLDING
|
|
|
22c937 |
if (draw_state == WL_FOLD - 1 && n_extra == 0)
|
|
|
22c937 |
{
|
|
|
22c937 |
+ int fdc = compute_foldcolumn(wp, 0);
|
|
|
22c937 |
+
|
|
|
22c937 |
draw_state = WL_FOLD;
|
|
|
22c937 |
! if (fdc > 0)
|
|
|
22c937 |
{
|
|
|
22c937 |
/* Draw the 'foldcolumn'. */
|
|
|
22c937 |
fill_foldcolumn(extra, wp, FALSE, lnum);
|
|
|
22c937 |
! n_extra = fdc;
|
|
|
22c937 |
p_extra = extra;
|
|
|
22c937 |
p_extra[n_extra] = NUL;
|
|
|
22c937 |
c_extra = NUL;
|
|
|
22c937 |
*** ../vim-7.4.602/src/version.c 2015-01-27 15:58:37.202395482 +0100
|
|
|
22c937 |
--- src/version.c 2015-01-27 16:14:45.703878550 +0100
|
|
|
22c937 |
***************
|
|
|
22c937 |
*** 743,744 ****
|
|
|
22c937 |
--- 743,746 ----
|
|
|
22c937 |
{ /* Add new patch number below this line */
|
|
|
22c937 |
+ /**/
|
|
|
22c937 |
+ 603,
|
|
|
22c937 |
/**/
|
|
|
22c937 |
|
|
|
22c937 |
--
|
|
|
22c937 |
hundred-and-one symptoms of being an internet addict:
|
|
|
22c937 |
129. You cancel your newspaper subscription.
|
|
|
22c937 |
|
|
|
22c937 |
/// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\
|
|
|
22c937 |
/// sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
|
|
|
22c937 |
\\\ an exciting new programming language -- http://www.Zimbu.org ///
|
|
|
22c937 |
\\\ help me help AIDS victims -- http://ICCF-Holland.org ///
|