From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: [david.reitter@gmail.com: vertical-motion fails when tab in line] Date: Tue, 13 Jun 2006 11:04:57 -0400 Message-ID: <87bqsxrt9i.fsf@stupidchicken.com> References: NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1150212450 26166 80.91.229.2 (13 Jun 2006 15:27:30 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Tue, 13 Jun 2006 15:27:30 +0000 (UTC) Cc: David Reitter , emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jun 13 17:27:29 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1FqAnM-0005sF-UB for ged-emacs-devel@m.gmane.org; Tue, 13 Jun 2006 17:27:09 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FqAnM-0007de-Cx for ged-emacs-devel@m.gmane.org; Tue, 13 Jun 2006 11:27:08 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1FqAn9-0007b4-7H for emacs-devel@gnu.org; Tue, 13 Jun 2006 11:26:55 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1FqAn8-0007au-Ug for emacs-devel@gnu.org; Tue, 13 Jun 2006 11:26:54 -0400 Original-Received: from [18.72.1.2] (helo=south-station-annex.mit.edu) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1FqAw6-0007Ps-RE; Tue, 13 Jun 2006 11:36:11 -0400 Original-Received: from central-city-carrier-station.mit.edu (CENTRAL-CITY-CARRIER-STATION.MIT.EDU [18.7.7.72]) by south-station-annex.mit.edu (8.13.6/8.9.2) with ESMTP id k5DFQplr021152; Tue, 13 Jun 2006 11:26:51 -0400 (EDT) Original-Received: from outgoing-legacy.mit.edu (OUTGOING-LEGACY.MIT.EDU [18.7.22.104]) by central-city-carrier-station.mit.edu (8.13.6/8.9.2) with ESMTP id k5DF53Zn029047; Tue, 13 Jun 2006 11:05:04 -0400 (EDT) Original-Received: from cyd (SYDNEYPACIFIC-SIX-SIXTY-SEVEN.MIT.EDU [18.95.7.156]) ) by outgoing-legacy.mit.edu (8.13.6/8.12.4) with ESMTP id k5DF4vRc010139; Tue, 13 Jun 2006 11:04:57 -0400 (EDT) Original-Received: from cyd by cyd with local (Exim 3.36 #1 (Debian)) id 1FqARt-0002g1-00; Tue, 13 Jun 2006 11:04:57 -0400 Original-To: rms@gnu.org In-Reply-To: (Richard Stallman's message of "Sun, 11 Jun 2006 12:16:29 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-Spam-Score: 1.47 X-Scanned-By: MIMEDefang 2.42 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:55860 Archived-At: > There's a bug in `vertical-motion' which will cause it to move the > point not to the beginning of the next (visual) line when called > with argument 1, but just a few characters to the right in the > current line. This occurs iff there is a Tab in the line. > > To reproduce, take a scratch buffer, enter a few lines of text wich > will be wrapped and contain one (or more?) tabs. Place cursor near > the end of a wrapped line, but not too far towards the end, and call > M-: (vertical-motion 1). The problem here is that in Fvertical_motion line 2092, after we call reseat_at_previous_visible_line_start (&it), the value of it.continuation_lines_width is not reset to zero. This screws up the calculation of tab stops if it.continuation_lines_width is non-zero and there are tabs present in the continued line. One solution is to reset it->continuation lines_width to zero in reseat_at_previous_visible_line_start (and probably reseat_at_next_visible_line_start too.) This seems like the proper fix, but I'd like to get some confirmation from people more familiar with redisplay: *** emacs/src/xdisp.c.~1.1102.~ 2006-06-12 23:38:55.000000000 -0400 --- emacs/src/xdisp.c 2006-06-13 11:01:42.000000000 -0400 *************** *** 5119,5124 **** --- 5119,5125 ---- struct it *it; { back_to_previous_visible_line_start (it); + it->continuation_lines_width = 0; reseat (it, it->current.pos, 1); CHECK_IT (it); } A more limited fix is to simply set it.continuation_lines_width to zero in Fvertical_motion, which should solve the particular problem reported: *** emacs/src/indent.c.~1.183.~ 2006-06-12 23:38:55.000000000 -0400 --- emacs/src/indent.c 2006-06-13 10:50:01.000000000 -0400 *************** *** 2089,2095 **** start_on_image_or_stretch_p = (it.method == GET_FROM_IMAGE || it.method == GET_FROM_STRETCH); reseat_at_previous_visible_line_start (&it); ! it.current_x = it.hpos = 0; /* Temporarily disable selective display so we don't move too far */ oselective = it.selective; it.selective = 0; --- 2089,2095 ---- start_on_image_or_stretch_p = (it.method == GET_FROM_IMAGE || it.method == GET_FROM_STRETCH); reseat_at_previous_visible_line_start (&it); ! it.current_x = it.hpos = it.continuation_lines_width = 0; /* Temporarily disable selective display so we don't move too far */ oselective = it.selective; it.selective = 0;