From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: [PATCH] trivial patch, jumping cursor in term Date: Fri, 25 Sep 2009 10:29:54 -0400 Message-ID: References: <86d45hhia4.fsf@kanis.fr> <868wg4demq.fsf@kanis.fr> <200909241711.n8OHBIKh010274@godzilla.ics.uci.edu> <86fxabcsi5.fsf@kanis.fr> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1253889136 27261 80.91.229.12 (25 Sep 2009 14:32:16 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 25 Sep 2009 14:32:16 +0000 (UTC) Cc: Dan Nicolaescu , emacs-devel@gnu.org To: Ivan Kanis Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Sep 25 16:32:05 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1MrBoF-00008t-GJ for ged-emacs-devel@m.gmane.org; Fri, 25 Sep 2009 16:30:07 +0200 Original-Received: from localhost ([127.0.0.1]:52874 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MrBoE-0004ZZ-UK for ged-emacs-devel@m.gmane.org; Fri, 25 Sep 2009 10:30:06 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1MrBo9-0004Yz-Qr for emacs-devel@gnu.org; Fri, 25 Sep 2009 10:30:01 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1MrBo4-0004WW-5h for emacs-devel@gnu.org; Fri, 25 Sep 2009 10:30:00 -0400 Original-Received: from [199.232.76.173] (port=36341 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1MrBo3-0004WH-VX for emacs-devel@gnu.org; Fri, 25 Sep 2009 10:29:55 -0400 Original-Received: from ironport2-out.teksavvy.com ([206.248.154.181]:24508 helo=ironport2-out.pppoe.ca) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1MrBo3-00025F-HX for emacs-devel@gnu.org; Fri, 25 Sep 2009 10:29:55 -0400 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Ap0FANJwvEpFpYq6/2dsb2JhbACBUdVwhB4Fh30 X-IronPort-AV: E=Sophos;i="4.44,451,1249272000"; d="scan'208";a="46596111" Original-Received: from 69-165-138-186.dsl.teksavvy.com (HELO pastel.home) ([69.165.138.186]) by ironport2-out.pppoe.ca with ESMTP; 25 Sep 2009 10:29:55 -0400 Original-Received: by pastel.home (Postfix, from userid 20848) id 936C180B1; Fri, 25 Sep 2009 10:29:54 -0400 (EDT) In-Reply-To: <86fxabcsi5.fsf@kanis.fr> (Ivan Kanis's message of "Fri, 25 Sep 2009 10:56:18 +0200") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.50 (gnu/linux) X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:115615 Archived-At: >> Hmm... it should have *exactly* the same effect as your patch. > Does it work for you? It didn't seem to work for me... It worked as well (or as poorly, depending on the test) as yours (if you look at the code, you'll see my patch really does exactly the same thing as yours, tho slightly differently). I tested the patch below, and it doesn't seem to fix the bug at all in my case (using: M-x term RET RET C-c C-j C-x 2 RET). :-( Stefan --- term.el.~1.122.~ 2009-09-24 22:47:06.000000000 -0400 +++ term.el 2009-09-25 10:25:33.000000000 -0400 @@ -3369,10 +3369,11 @@ ((eq char ?r) (term-set-scroll-region (1- term-terminal-previous-parameter) - (1- term-terminal-parameter))) + (1- term-terminal-parameter) + t)) (t))) -(defun term-set-scroll-region (top bottom) +(defun term-set-scroll-region (top bottom &optional esc-bracket-r) "Set scrolling region. TOP is the top-most line (inclusive) of the new scrolling region, while BOTTOM is the line following the new scrolling region (e.g. exclusive). @@ -3390,7 +3391,8 @@ (not (and (= term-scroll-start 0) (= term-scroll-end term-height))))) (term-move-columns (- (term-current-column))) - (term-goto 0 0)) + (if esc-bracket-r + (term-goto 0 0))) ;; (defun term-switch-to-alternate-sub-buffer (set) ;; ;; If asked to switch to (from) the alternate sub-buffer, and already (not) @@ -3721,7 +3723,7 @@ (let ((start-column (term-horizontal-column))) (when (and check-for-scroll (or term-scroll-with-delete term-pager-count)) (setq down (term-handle-scroll down))) - (unless (and (= term-current-row 0) (< down 0)) + (unless (and term-current-row (= term-current-row 0) (< down 0)) (term-adjust-current-row-cache down) (when (or (/= (point) (point-max)) (< down 0)) (setq down (- down (term-vertical-motion down)))))