From owner-svn-src-user@FreeBSD.ORG Thu Oct 24 21:43:47 2013 Return-Path: Delivered-To: svn-src-user@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 ESMTP id 2A9454A2; Thu, 24 Oct 2013 21:43:47 +0000 (UTC) (envelope-from ray@FreeBSD.org) 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)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 163292D1C; Thu, 24 Oct 2013 21:43:47 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id r9OLhkgQ050140; Thu, 24 Oct 2013 21:43:46 GMT (envelope-from ray@svn.freebsd.org) Received: (from ray@localhost) by svn.freebsd.org (8.14.7/8.14.5/Submit) id r9OLhkrp050139; Thu, 24 Oct 2013 21:43:46 GMT (envelope-from ray@svn.freebsd.org) Message-Id: <201310242143.r9OLhkrp050139@svn.freebsd.org> From: Aleksandr Rybalko Date: Thu, 24 Oct 2013 21:43:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-user@freebsd.org Subject: svn commit: r257074 - user/ed/newcons/sys/dev/vt X-SVN-Group: user MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-user@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "SVN commit messages for the experimental " user" src tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2013 21:43:47 -0000 Author: ray Date: Thu Oct 24 21:43:46 2013 New Revision: 257074 URL: http://svnweb.freebsd.org/changeset/base/257074 Log: o Fix scroll calculations. o Make vthistory_seek to return amount of lines to update +on_top/-on_bottom of screen. Sponsored by: The FreeBSD Foundation Modified: user/ed/newcons/sys/dev/vt/vt_buf.c Modified: user/ed/newcons/sys/dev/vt/vt_buf.c ============================================================================== --- user/ed/newcons/sys/dev/vt/vt_buf.c Thu Oct 24 21:43:18 2013 (r257073) +++ user/ed/newcons/sys/dev/vt/vt_buf.c Thu Oct 24 21:43:46 2013 (r257074) @@ -54,13 +54,13 @@ static MALLOC_DEFINE(M_VTBUF, "vtbuf", " int vthistory_seek(struct vt_buf *vb, int offset, int whence) { - int top, bottom, roffset; + int diff, top, bottom, roffset; /* No scrolling if not enabled. */ if ((vb->vb_flags & VBF_SCROLL) == 0) { if (vb->vb_roffset != vb->vb_curroffset) { vb->vb_roffset = vb->vb_curroffset; - return (1); + return (0xffff); } return (0); /* No changes */ } @@ -75,14 +75,14 @@ vthistory_seek(struct vt_buf *vb, int of roffset = vb->vb_roffset + vb->vb_history_size; switch (whence) { case VHS_SET: - roffset = offset; + roffset = offset + vb->vb_history_size; break; case VHS_CUR: roffset += offset; break; case VHS_END: /* Go to current offset. */ - roffset = vb->vb_curroffset; + roffset = vb->vb_curroffset + vb->vb_history_size; break; } @@ -92,8 +92,14 @@ vthistory_seek(struct vt_buf *vb, int of roffset %= vb->vb_history_size; if (vb->vb_roffset != roffset) { + diff = vb->vb_roffset - roffset; vb->vb_roffset = roffset; - return (1); /* Offset changed, please update sceen. */ + /* + * Offset changed, please update Nth lines on sceen. + * +N - Nth lines at top; + * -N - Nth lines at bottom. + */ + return (diff); } return (0); /* No changes */ }