From owner-svn-src-head@FreeBSD.ORG Sat Sep 26 15:07:11 2009 Return-Path: Delivered-To: svn-src-head@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id A3A69106566B; Sat, 26 Sep 2009 15:07:11 +0000 (UTC) (envelope-from ed@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id 5E3DC8FC15; Sat, 26 Sep 2009 15:07:11 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n8QF7BGo063061; Sat, 26 Sep 2009 15:07:11 GMT (envelope-from ed@svn.freebsd.org) Received: (from ed@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n8QF7BFi063059; Sat, 26 Sep 2009 15:07:11 GMT (envelope-from ed@svn.freebsd.org) Message-Id: <200909261507.n8QF7BFi063059@svn.freebsd.org> From: Ed Schouten Date: Sat, 26 Sep 2009 15:07:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r197521 - head/sys/teken X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Sep 2009 15:07:11 -0000 Author: ed Date: Sat Sep 26 15:07:11 2009 New Revision: 197521 URL: http://svn.freebsd.org/changeset/base/197521 Log: Properly get out of origin mode if the cursor has to move outside of it. In some cases events may occur that move the cursor outside the scrolling region while in origin mode, which is normally not possible. Events like these include: - Alignment test. - Restore cursor. Properly switch off origin mode in these cases. MFC after: 1 month Modified: head/sys/teken/teken_subr.h Modified: head/sys/teken/teken_subr.h ============================================================================== --- head/sys/teken/teken_subr.h Sat Sep 26 15:03:42 2009 (r197520) +++ head/sys/teken/teken_subr.h Sat Sep 26 15:07:11 2009 (r197521) @@ -185,11 +185,11 @@ teken_subr_alignment_test(teken_t *t) { teken_rect_t tr; + t->t_cursor.tp_row = t->t_cursor.tp_col = 0; t->t_scrollreg.ts_begin = 0; t->t_scrollreg.ts_end = t->t_winsize.tp_row; - - t->t_cursor.tp_row = t->t_cursor.tp_col = 0; - t->t_stateflags &= ~TS_WRAPPED; + t->t_originreg = t->t_scrollreg; + t->t_stateflags &= ~(TS_WRAPPED|TS_ORIGIN); teken_funcs_cursor(t); tr.tr_begin.tp_row = 0; @@ -988,6 +988,15 @@ teken_subr_restore_cursor(teken_t *t) t->t_curattr = t->t_saved_curattr; t->t_scs[t->t_curscs] = t->t_saved_curscs; t->t_stateflags &= ~TS_WRAPPED; + + /* Get out of origin mode when the cursor is moved outside. */ + if (t->t_cursor.tp_row < t->t_originreg.ts_begin || + t->t_cursor.tp_row >= t->t_originreg.ts_end) { + t->t_stateflags &= ~TS_ORIGIN; + t->t_originreg.ts_begin = 0; + t->t_originreg.ts_end = t->t_winsize.tp_row; + } + teken_funcs_cursor(t); }