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#11063: Window-start in the middle of a line with nhexl-mode Date: Sat, 31 Mar 2012 20:22:55 +0300 Message-ID: <83limgk7m8.fsf@gnu.org> References: Reply-To: Eli Zaretskii NNTP-Posting-Host: plane.gmane.org X-Trace: dough.gmane.org 1333214644 29279 80.91.229.3 (31 Mar 2012 17:24:04 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Sat, 31 Mar 2012 17:24:04 +0000 (UTC) Cc: 11063@debbugs.gnu.org To: Stefan Monnier Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Mar 31 19:24:02 2012 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 1SE21y-0005V6-Gf for geb-bug-gnu-emacs@m.gmane.org; Sat, 31 Mar 2012 19:24:02 +0200 Original-Received: from localhost ([::1]:48703 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SE21x-0002IY-OC for geb-bug-gnu-emacs@m.gmane.org; Sat, 31 Mar 2012 13:24:01 -0400 Original-Received: from eggs.gnu.org ([208.118.235.92]:38620) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SE21v-0002I1-4Z for bug-gnu-emacs@gnu.org; Sat, 31 Mar 2012 13:24:00 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1SE21t-0001Cd-6E for bug-gnu-emacs@gnu.org; Sat, 31 Mar 2012 13:23:58 -0400 Original-Received: from debbugs.gnu.org ([140.186.70.43]:36575) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1SE21t-0001CY-2W for bug-gnu-emacs@gnu.org; Sat, 31 Mar 2012 13:23:57 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.72) (envelope-from ) id 1SE21x-00012v-RQ for bug-gnu-emacs@gnu.org; Sat, 31 Mar 2012 13:24:01 -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: Sat, 31 Mar 2012 17:24:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 11063 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: Original-Received: via spool by 11063-submit@debbugs.gnu.org id=B11063.13332145863943 (code B ref 11063); Sat, 31 Mar 2012 17:24:01 +0000 Original-Received: (at 11063) by debbugs.gnu.org; 31 Mar 2012 17:23:06 +0000 Original-Received: from localhost ([127.0.0.1]:33113 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SE213-00011Y-DZ for submit@debbugs.gnu.org; Sat, 31 Mar 2012 13:23:05 -0400 Original-Received: from mtaout22.012.net.il ([80.179.55.172]:58038) by debbugs.gnu.org with esmtp (Exim 4.72) (envelope-from ) id 1SE20z-000117-GI for 11063@debbugs.gnu.org; Sat, 31 Mar 2012 13:23:03 -0400 Original-Received: from conversion-daemon.a-mtaout22.012.net.il by a-mtaout22.012.net.il (HyperSendmail v2007.08) id <0M1R00F00ETNB900@a-mtaout22.012.net.il> for 11063@debbugs.gnu.org; Sat, 31 Mar 2012 20:22:52 +0300 (IDT) Original-Received: from HOME-C4E4A596F7 ([84.228.100.223]) by a-mtaout22.012.net.il (HyperSendmail v2007.08) with ESMTPA id <0M1R00D3XEY3UE62@a-mtaout22.012.net.il>; Sat, 31 Mar 2012 20:22:52 +0300 (IDT) In-reply-to: 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 (newer, 2) 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:58389 Archived-At: > From: Stefan Monnier > Date: Wed, 21 Mar 2012 23:23:05 -0400 > > % src/emacs -Q -l .../elpa/packages/nhexl-mode/nhexl-mode.el README > M-x nhexl-mode RET > > > You'll see at the top of the screen that the window-start is in the > middle of one of the (display) lines, even though none of the display > lines are particularly long. The following one-liner fixes this. Whether to install this now is up to you; after all, nhexl-mode is not part of Emacs, and quite a corner case at that. OTOH, the current code is obviously wrong. Note that there are still display problems after this change: except when you are at BOB, the first screen line below the liner is almost always empty (buffer contents is displayed starting from the second line). Also, there seem to be a miscalculation of the line width when some character is displayed using a display table, e.g. where there are ^L characters in README. All these were there before the patch, and I didn't investigate further what causes them. === modified file 'src/xdisp.c' --- a/src/xdisp.c 2012-03-31 17:18:00 +0000 +++ b/src/xdisp.c 2012-03-31 17:18:26 +0000 @@ -8973,7 +8973,20 @@ { move_it_to (it, -1, -1, -1, it->vpos + dvpos, MOVE_TO_VPOS); if (!IT_POS_VALID_AFTER_MOVE_P (it)) - move_it_to (it, IT_CHARPOS (*it) + 1, -1, -1, -1, MOVE_TO_POS); + { + /* Only move to the next buffer position if we ended up in a + string from display property, not in an overlay string + (before-string or after-string). That is because the + latter don't conceal the underlying buffer position, so + we can ask to move the iterator to the exact position we + are interested in. Note that, even if we are already at + IT_CHARPOS (*it), the call below is not a no-op, as it + will detect that we are at the end of the string, pop the + iterator, and compute it->current_x and it->hpos + correctly. */ + move_it_to (it, IT_CHARPOS (*it) + it->string_from_display_prop_p, + -1, -1, -1, MOVE_TO_POS); + } } else {