Patch 8.0.1375
Problem:    Window size wrong after maximizing with WinBar. (Lifepillar)
Solution:   Fix height computations. Redraw window when it is zero height but
            has a WinBar. (closes #2356)
Files:      src/window.c, src/screen.c, src/vim.h


*** ../vim-8.0.1374/src/window.c        2017-11-25 14:19:39.284798632 +0100
--- src/window.c        2017-12-05 20:29:45.789346094 +0100
***************
*** 782,788 ****
      /* add a status line when p_ls == 1 and splitting the first window */
      if (ONE_WINDOW && p_ls == 1 && oldwin->w_status_height == 0)
      {
!       if (oldwin->w_height <= p_wmh && new_wp == NULL)
        {
            EMSG(_(e_noroom));
            return FAIL;
--- 782,788 ----
      /* add a status line when p_ls == 1 and splitting the first window */
      if (ONE_WINDOW && p_ls == 1 && oldwin->w_status_height == 0)
      {
!       if (VISIBLE_HEIGHT(oldwin) <= p_wmh && new_wp == NULL)
        {
            EMSG(_(e_noroom));
            return FAIL;
***************
*** 892,898 ****
         * height.
         */
        /* Current window requires at least 1 space. */
!       wmh1 = (p_wmh == 0 ? 1 : p_wmh);
        needed = wmh1 + STATUS_HEIGHT;
        if (flags & WSP_ROOM)
            needed += p_wh - wmh1;
--- 892,898 ----
         * height.
         */
        /* Current window requires at least 1 space. */
!       wmh1 = (p_wmh == 0 ? 1 : p_wmh) + WINBAR_HEIGHT(curwin);
        needed = wmh1 + STATUS_HEIGHT;
        if (flags & WSP_ROOM)
            needed += p_wh - wmh1;
***************
*** 1105,1111 ****
        {
            /* height and row of new window is same as current window */
            wp->w_winrow = oldwin->w_winrow;
!           win_new_height(wp, oldwin->w_height + WINBAR_HEIGHT(oldwin));
            wp->w_status_height = oldwin->w_status_height;
        }
        frp->fr_height = curfrp->fr_height;
--- 1105,1111 ----
        {
            /* height and row of new window is same as current window */
            wp->w_winrow = oldwin->w_winrow;
!           win_new_height(wp, VISIBLE_HEIGHT(oldwin));
            wp->w_status_height = oldwin->w_status_height;
        }
        frp->fr_height = curfrp->fr_height;
***************
*** 1180,1187 ****
        }
        else            /* new window below current one */
        {
!           wp->w_winrow = oldwin->w_winrow + oldwin->w_height
!                                      + STATUS_HEIGHT + WINBAR_HEIGHT(oldwin);
            wp->w_status_height = oldwin->w_status_height;
            if (!(flags & WSP_BOT))
                oldwin->w_status_height = STATUS_HEIGHT;
--- 1180,1187 ----
        }
        else            /* new window below current one */
        {
!           wp->w_winrow = oldwin->w_winrow + VISIBLE_HEIGHT(oldwin)
!                                                              + STATUS_HEIGHT;
            wp->w_status_height = oldwin->w_status_height;
            if (!(flags & WSP_BOT))
                oldwin->w_status_height = STATUS_HEIGHT;
***************
*** 1422,1428 ****
      else
      {
        /* Each window needs at least 'winminheight' lines and a status line. */
!       maxcount = (curwin->w_height + curwin->w_status_height
                                  - (p_wh - p_wmh)) / (p_wmh + STATUS_HEIGHT);
      }
  
--- 1422,1428 ----
      else
      {
        /* Each window needs at least 'winminheight' lines and a status line. */
!       maxcount = (VISIBLE_HEIGHT(curwin) + curwin->w_status_height
                                  - (p_wh - p_wmh)) / (p_wmh + STATUS_HEIGHT);
      }
  
***************
*** 3204,3211 ****
      static void
  frame_fix_height(win_T *wp)
  {
!     wp->w_frame->fr_height = wp->w_height + wp->w_status_height
!                                                         + WINBAR_HEIGHT(wp) ;
  }
  
  /*
--- 3204,3210 ----
      static void
  frame_fix_height(win_T *wp)
  {
!     wp->w_frame->fr_height = VISIBLE_HEIGHT(wp) + wp->w_status_height;
  }
  
  /*
***************
*** 3230,3238 ****
        {
            /* window: minimal height of the window plus status line */
            m = p_wmh + topfrp->fr_win->w_status_height;
!           /* Current window is minimal one line high */
!           if (p_wmh == 0 && topfrp->fr_win == curwin && next_curwin == NULL)
!               ++m;
        }
      }
      else if (topfrp->fr_layout == FR_ROW)
--- 3229,3242 ----
        {
            /* window: minimal height of the window plus status line */
            m = p_wmh + topfrp->fr_win->w_status_height;
!           if (topfrp->fr_win == curwin && next_curwin == NULL)
!           {
!               /* Current window is minimal one line high and WinBar is
!                * visible. */
!               if (p_wmh == 0)
!                   ++m;
!               m += WINBAR_HEIGHT(curwin);
!           }
        }
      }
      else if (topfrp->fr_layout == FR_ROW)
***************
*** 4972,4977 ****
--- 4976,4982 ----
      frame_T   *frp;
      int               startcol;
      int               startrow;
+     int               h;
  
      wp = topfrp->fr_win;
      if (wp != NULL)
***************
*** 4984,4990 ****
            redraw_win_later(wp, NOT_VALID);
            wp->w_redr_status = TRUE;
        }
!       *row += wp->w_height + wp->w_status_height;
        *col += wp->w_width + wp->w_vsep_width;
      }
      else
--- 4989,4997 ----
            redraw_win_later(wp, NOT_VALID);
            wp->w_redr_status = TRUE;
        }
!       /* WinBar will not show if the window height is zero */
!       h = VISIBLE_HEIGHT(wp) + wp->w_status_height;
!       *row += h > topfrp->fr_height ? topfrp->fr_height : h;
        *col += wp->w_width + wp->w_vsep_width;
      }
      else
***************
*** 5029,5034 ****
--- 5036,5042 ----
            height = p_wmh;
        if (height == 0)
            height = 1;
+       height += WINBAR_HEIGHT(curwin);
      }
  
      frame_setheight(win->w_frame, height + win->w_status_height);
***************
*** 5126,5132 ****
            else
            {
                room_cmdline = Rows - p_ch - (lastwin->w_winrow
!                              + lastwin->w_height + lastwin->w_status_height);
                if (room_cmdline < 0)
                    room_cmdline = 0;
            }
--- 5134,5141 ----
            else
            {
                room_cmdline = Rows - p_ch - (lastwin->w_winrow
!                                               + VISIBLE_HEIGHT(lastwin)
!                                               + lastwin->w_status_height);
                if (room_cmdline < 0)
                    room_cmdline = 0;
            }
***************
*** 5415,5421 ****
        /* TODO: handle vertical splits */
        room = -p_wh;
        FOR_ALL_WINDOWS(wp)
!           room += wp->w_height - p_wmh;
        if (room >= 0)
            break;
        --p_wmh;
--- 5424,5430 ----
        /* TODO: handle vertical splits */
        room = -p_wh;
        FOR_ALL_WINDOWS(wp)
!           room += VISIBLE_HEIGHT(wp) - p_wmh;
        if (room >= 0)
            break;
        --p_wmh;
*** ../vim-8.0.1374/src/screen.c        2017-11-28 21:25:16.903156177 +0100
--- src/screen.c        2017-12-05 19:36:26.947266315 +0100
***************
*** 1154,1160 ****
      }
  
      /* Window is zero-height: nothing to draw. */
!     if (wp->w_height == 0)
      {
        wp->w_redr_type = 0;
        return;
--- 1154,1160 ----
      }
  
      /* Window is zero-height: nothing to draw. */
!     if (wp->w_height + WINBAR_HEIGHT(wp) == 0)
      {
        wp->w_redr_type = 0;
        return;
*** ../vim-8.0.1374/src/vim.h   2017-11-28 21:06:14.884880574 +0100
--- src/vim.h   2017-12-05 20:07:25.005108235 +0100
***************
*** 1478,1485 ****
--- 1478,1487 ----
  #define STATUS_HEIGHT 1       /* height of a status line under a window */
  #ifdef FEAT_MENU              /* height of a status line under a window */
  # define WINBAR_HEIGHT(wp)    (wp)->w_winbar_height
+ # define VISIBLE_HEIGHT(wp)   ((wp)->w_height + (wp)->w_winbar_height)
  #else
  # define WINBAR_HEIGHT(wp)    0
+ # define VISIBLE_HEIGHT(wp)   (wp)->w_height
  #endif
  #define QF_WINHEIGHT  10      /* default height for quickfix window */
  
*** ../vim-8.0.1374/src/version.c       2017-12-05 17:22:07.386721705 +0100
--- src/version.c       2017-12-05 17:33:15.380091715 +0100
***************
*** 773,774 ****
--- 773,776 ----
  {   /* Add new patch number below this line */
+ /**/
+     1375,
  /**/

-- 
hundred-and-one symptoms of being an internet addict:
88. Every single time you press the 'Get mail' button...it does get new mail.

 /// 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.

Raspunde prin e-mail lui