From owner-svn-src-all@FreeBSD.ORG  Thu May  8 13:46:36 2014
Return-Path: <owner-svn-src-all@FreeBSD.ORG>
Delivered-To: svn-src-all@freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))
 (No client certificate requested)
 by hub.freebsd.org (Postfix) with ESMTPS id E1C3CD37;
 Thu,  8 May 2014 13:46:36 +0000 (UTC)
Received: from svn.freebsd.org (svn.freebsd.org
 [IPv6:2001:1900:2254:2068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id CF9EC14C;
 Thu,  8 May 2014 13:46:36 +0000 (UTC)
Received: from svn.freebsd.org ([127.0.1.70])
 by svn.freebsd.org (8.14.8/8.14.8) with ESMTP id s48Dkaeh025719;
 Thu, 8 May 2014 13:46:36 GMT (envelope-from ray@svn.freebsd.org)
Received: (from ray@localhost)
 by svn.freebsd.org (8.14.8/8.14.8/Submit) id s48DkaGF025715;
 Thu, 8 May 2014 13:46:36 GMT (envelope-from ray@svn.freebsd.org)
Message-Id: <201405081346.s48DkaGF025715@svn.freebsd.org>
From: Aleksandr Rybalko <ray@FreeBSD.org>
Date: Thu, 8 May 2014 13:46:36 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-all@freebsd.org,
 svn-src-head@freebsd.org
Subject: svn commit: r265681 - head/sys/dev/vt
X-SVN-Group: head
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-all@freebsd.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: "SVN commit messages for the entire src tree \(except for &quot;
 user&quot; and &quot; projects&quot; \)" <svn-src-all.freebsd.org>
List-Unsubscribe: <http://lists.freebsd.org/mailman/options/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-all/>
List-Post: <mailto:svn-src-all@freebsd.org>
List-Help: <mailto:svn-src-all-request@freebsd.org?subject=help>
List-Subscribe: <http://lists.freebsd.org/mailman/listinfo/svn-src-all>,
 <mailto:svn-src-all-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 08 May 2014 13:46:37 -0000

Author: ray
Date: Thu May  8 13:46:36 2014
New Revision: 265681
URL: http://svnweb.freebsd.org/changeset/base/265681

Log:
  Fix scrollback.
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/dev/vt/vt_buf.c
  head/sys/dev/vt/vt_core.c

Modified: head/sys/dev/vt/vt_buf.c
==============================================================================
--- head/sys/dev/vt/vt_buf.c	Thu May  8 13:38:29 2014	(r265680)
+++ head/sys/dev/vt/vt_buf.c	Thu May  8 13:46:36 2014	(r265681)
@@ -448,8 +448,9 @@ vtbuf_grow(struct vt_buf *vb, const term
 
 	history_size = MAX(history_size, p->tp_row);
 
-	if (history_size > vb->vb_history_size || p->tp_col >
-	    vb->vb_scr_size.tp_col) {
+	/* If new screen/history size bigger or buffer is VBF_STATIC. */
+	if ((history_size > vb->vb_history_size) || (p->tp_col >
+	    vb->vb_scr_size.tp_col) || (vb->vb_flags & VBF_STATIC)) {
 		/* Allocate new buffer. */
 		bufsize = history_size * p->tp_col * sizeof(term_char_t);
 		new = malloc(bufsize, M_VTBUF, M_WAITOK | M_ZERO);

Modified: head/sys/dev/vt/vt_core.c
==============================================================================
--- head/sys/dev/vt/vt_core.c	Thu May  8 13:38:29 2014	(r265680)
+++ head/sys/dev/vt/vt_core.c	Thu May  8 13:46:36 2014	(r265681)
@@ -2016,6 +2016,10 @@ vt_upgrade(struct vt_device *vd)
 	/* Start timer when everything ready. */
 	callout_reset(&vd->vd_timer, hz / VT_TIMERFREQ, vt_timer, vd);
 	VT_UNLOCK(vd);
+
+	/* Refill settings with new sizes. */
+	vt_resize(vd);
+
 }
 
 static void
@@ -2090,9 +2094,6 @@ vt_allocate(struct vt_driver *drv, void 
 
 	vt_upgrade(vd);
 
-	/* Refill settings with new sizes. */
-	vt_resize(vd);
-
 #ifdef DEV_SPLASH
 	if (vd->vd_flags & VDF_SPLASH)
 		vtterm_splash(vd);