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: visual-line-mode Date: Fri, 11 Jul 2008 17:10:05 -0400 Message-ID: <87d4lknn4i.fsf@stupidchicken.com> References: <87zlp4raab.fsf@catnip.gol.com> <87d4lzehq2.fsf@stupidchicken.com> <87skuqbwr8.fsf@stupidchicken.com> <85E9BC5B-7337-4CD4-A783-6B2FAEBAEBCA@gmail.com> <87tzf6c5il.fsf@stupidchicken.com> <87abgxx0ju.fsf@stupidchicken.com> <4D997CA8-A2ED-4E12-9F91-76E98AE95210@gmail.com> <87prpsjhre.fsf@stupidchicken.com> <375C0006-2B47-4B1F-9EB2-ED47941C2DB3@gmail.com> <87od56tp4o.fsf@stupidchicken.com> <71C2D50C-1680-4ADD-A7E3-7B7A1146B85D@gmail.com> <87ej61n19h.fsf@stupidchicken.com> <87vdzdr6f6.fsf@catnip.gol.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1215810608 26310 80.91.229.12 (11 Jul 2008 21:10:08 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 11 Jul 2008 21:10:08 +0000 (UTC) Cc: David Reitter , Emacs-Devel devel , "Lennart Borgman \(gmail\)" , Miles Bader To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jul 11 23:10:55 2008 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 1KHPtC-0004JS-Hx for ged-emacs-devel@m.gmane.org; Fri, 11 Jul 2008 23:10:50 +0200 Original-Received: from localhost ([127.0.0.1]:51623 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KHPsK-0002mm-Pe for ged-emacs-devel@m.gmane.org; Fri, 11 Jul 2008 17:09:56 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1KHPsG-0002mP-1m for emacs-devel@gnu.org; Fri, 11 Jul 2008 17:09:52 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1KHPsE-0002lZ-1z for emacs-devel@gnu.org; Fri, 11 Jul 2008 17:09:51 -0400 Original-Received: from [199.232.76.173] (port=51075 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1KHPsD-0002lV-SJ for emacs-devel@gnu.org; Fri, 11 Jul 2008 17:09:49 -0400 Original-Received: from cyd.mit.edu ([18.115.2.24]:38653 helo=cyd) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1KHPs9-0007Ci-L6; Fri, 11 Jul 2008 17:09:45 -0400 Original-Received: by cyd (Postfix, from userid 1000) id DB8BD57E2E5; Fri, 11 Jul 2008 17:10:05 -0400 (EDT) In-Reply-To: (Stefan Monnier's message of "Thu, 10 Jul 2008 16:23:07 -0400") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/23.0.60 (gnu/linux) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 3) 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:100593 Archived-At: Stefan Monnier writes: > PS: My patch is just a proof of concept. It has a few bugs. One of > them can be seen when you set truncate-lines, in which case it doesn't > preserve columns correctly (basically, its temporary-goal-column ends > up being computed from the beginning of the displayed part of the line, > so as long as hscroll is not changed, it works OK but as soon as > hscroll is modified, the result is incorrect). Does the following patch give good results/make sense? *** trunk/src/indent.c.~1.209.~ 2008-06-29 09:56:50.000000000 -0400 --- trunk/src/indent.c 2008-07-11 17:08:33.000000000 -0400 *************** *** 2058,2067 **** --- 2058,2070 ---- int it_start; int oselective; int it_overshoot_expected; + int first_x; SET_TEXT_POS (pt, PT, PT_BYTE); start_display (&it, w, pt); + first_x = it.first_visible_x; + /* Scan from the start of the line containing PT. If we don't do this, we start moving with IT->current_x == 0, while PT is really at some x > 0. The effect is, in continuation lines, that *************** *** 2119,2128 **** move_it_by_lines (&it, XINT (lines), 0); if (!NILP (lcols)) ! move_it_in_display_line ! (&it, ZV, ! (int)(cols * FRAME_COLUMN_WIDTH (XFRAME (w->frame)) + 0.5), ! MOVE_TO_X); SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); } --- 2122,2135 ---- move_it_by_lines (&it, XINT (lines), 0); if (!NILP (lcols)) ! { ! move_it_in_display_line (&it, ZV, first_x, MOVE_TO_X); ! it.current_x = 0; ! move_it_in_display_line ! (&it, ZV, ! (int)(cols * FRAME_COLUMN_WIDTH (XFRAME (w->frame)) + 0.5), ! MOVE_TO_X); ! } SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); }