From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#2749: 23.0.91; Visual Line Mode: incorrect line wrapping in corner case Date: Fri, 10 May 2013 20:37:08 +0300 Message-ID: <83ehdebut7.fsf@gnu.org> References: <87d4c694r2.fsf@cyd.mit.edu> <87obfhhn9d.fsf@rosalinde.fritz.box> <871u9f6ij1.fsf@rosalinde.fritz.box> <83ip2qc23k.fsf@gnu.org> <87wqr66dij.fsf@rosalinde.fritz.box> Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: ger.gmane.org 1368207482 20907 80.91.229.3 (10 May 2013 17:38:02 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 10 May 2013 17:38:02 +0000 (UTC) Cc: pent@aparamon.msk.ru, 2749@debbugs.gnu.org To: Stephen Berman Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Fri May 10 19:37:58 2013 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1UarGX-0001AJ-JU for geb-bug-gnu-emacs@m.gmane.org; Fri, 10 May 2013 19:37:57 +0200 Original-Received: from localhost ([::1]:55067 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UarGX-0000kP-0I for geb-bug-gnu-emacs@m.gmane.org; Fri, 10 May 2013 13:37:57 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:46987) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UarGS-0000k8-KB for bug-gnu-emacs@gnu.org; Fri, 10 May 2013 13:37:53 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1UarGR-0001Pq-If for bug-gnu-emacs@gnu.org; Fri, 10 May 2013 13:37:52 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:59991) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1UarGR-0001Pj-Ex for bug-gnu-emacs@gnu.org; Fri, 10 May 2013 13:37:51 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1UarGb-0008ED-Vn for bug-gnu-emacs@gnu.org; Fri, 10 May 2013 13:38:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: debbugs-submit-bounces@debbugs.gnu.org Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 10 May 2013 17:38:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 2749 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 2749-submit@debbugs.gnu.org id=B2749.136820746131596 (code B ref 2749); Fri, 10 May 2013 17:38:01 +0000 Original-Received: (at 2749) by debbugs.gnu.org; 10 May 2013 17:37:41 +0000 Original-Received: from localhost ([127.0.0.1]:35867 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UarGH-0008DX-1J for submit@debbugs.gnu.org; Fri, 10 May 2013 13:37:41 -0400 Original-Received: from mtaout21.012.net.il ([80.179.55.169]:42975) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1UarGE-0008DN-HH for 2749@debbugs.gnu.org; Fri, 10 May 2013 13:37:39 -0400 Original-Received: from conversion-daemon.a-mtaout21.012.net.il by a-mtaout21.012.net.il (HyperSendmail v2007.08) id <0MML00500FBSYX00@a-mtaout21.012.net.il> for 2749@debbugs.gnu.org; Fri, 10 May 2013 20:37:26 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([87.69.4.28]) by a-mtaout21.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0MML006X2FMD1O00@a-mtaout21.012.net.il>; Fri, 10 May 2013 20:37:26 +0300 (IDT) In-reply-to: <87wqr66dij.fsf@rosalinde.fritz.box> X-012-Sender: halo1@inter.net.il X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.13 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-Received-From: 140.186.70.43 X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.bugs:74134 Archived-At: > From: Stephen Berman > Cc: monnier@iro.umontreal.ca, pent@aparamon.msk.ru, 2749@debbugs.gnu.org > Date: Fri, 10 May 2013 17:49:40 +0200 > > > Does the patch below fix the problem (and whatever original problem > > that led you to this recipe)? > > > > --- src/xdisp.c~0 2013-05-10 17:56:44.338000000 +0300 > > +++ src/xdisp.c 2013-05-10 17:57:07.197375000 +0300 > > @@ -8466,7 +8466,8 @@ > > && it->bidi_it.paragraph_dir == R2L) > > ? WINDOW_LEFT_FRINGE_WIDTH (it->w) > > : WINDOW_RIGHT_FRINGE_WIDTH (it->w)) == 0 > > - || IT_OVERFLOW_NEWLINE_INTO_FRINGE (it)) > > + || (IT_OVERFLOW_NEWLINE_INTO_FRINGE (it) > > + && it->line_wrap != WORD_WRAP)) > > { > > if (!get_next_display_element (it)) > > { > > Yes, it fixes the "confusing results" with the patch in my previous > mail. Thanks very much! You are welcome. > (I wish I understood why this problem occurred and how your patch > fixes it...) I didn't really debug it, I just applied Sherlock Holmes's principle: when you have eliminated all the other possible explanations, the one that stays is the correct one. IT_OVERFLOW_NEWLINE_INTO_FRINGE is used in a small number of places. Most of them are related to actually displaying text, which couldn't be the reason here, because no text was displayed, only the cursor. Of the 2 that are left, one was conditioned by it->line_wrap == TRUNCATE, so again couldn't be the reason. What's left was the one I fixed, and the fix just added back the condition you removed from IT_OVERFLOW_NEWLINE_INTO_FRINGE. I can give you a vague idea of why the problem occurred. When you click the mouse, Emacs needs to determine what buffer position is at that place, so it could move point there. The code which determines buffer position from pixel coordinates simulates the display, starting at the window beginning and producing glyphs for display (and discarding them) until it gets to the desired pixel coordinates. The code where I made the change is part of that display simulation. It assumed without testing that word-wrap can never be on when IT_OVERFLOW_NEWLINE_INTO_FRINGE is true, which means that you cannot click outside of text, because text goes to the very end of the window. But with the change in IT_OVERFLOW_NEWLINE_INTO_FRINGE, that assumption was no longer true. > Unless someone knows of another problem with allowing > overflow-newline-into-fringe in Visual Line mode, I would like to > request that both my patch and yours be committed to the trunk Do you use Org mode or any other modes (e.g., magit) that are heavy users of display strings? If not, then I'm not prepared to believe that the above is the only problem with this change. I'd like to see much more reports from users of those modes that this change doesn't cause any trouble, before I'd agree to installing it. Just look how much time it took until this problem popped up. Since I knew the only change was in a single macro that is used in a small number of places, fixing it was a 5-min job. But imagine that the same would happen 3 years after committing this change, with gazillions of unrelated changes in the display code since then. Thanks.