GNU bug report logs - #11063
Window-start in the middle of a line with nhexl-mode

Previous Next

Package: emacs;

Reported by: Stefan Monnier <monnier <at> iro.umontreal.ca>

Date: Thu, 22 Mar 2012 03:55:01 UTC

Severity: normal

Found in version 24.0.94

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 11063 in the body.
You can then email your comments to 11063 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#11063; Package emacs. (Thu, 22 Mar 2012 03:55:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Thu, 22 Mar 2012 03:55:01 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: bug-gnu-emacs <at> gnu.org
Subject: Window-start in the middle of a line with nhexl-mode
Date: Wed, 21 Mar 2012 23:23:05 -0400
Package: Emacs
Version: 24.0.94

% src/emacs -Q -l .../elpa/packages/nhexl-mode/nhexl-mode.el README
M-x nhexl-mode RET
<page-down>

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.


        Stefan




In GNU Emacs 24.0.94.1 (i386-unknown-linux-gnu, X toolkit, Xaw3d scroll bars)
 of 2012-03-10 on alfajor
Windowing system distributor `The X.Org Foundation', version 11.0.11104000
Configured using:
 `configure
 'CFLAGS=-Wall -Wno-pointer-sign -DUSE_LISP_UNION_TYPE -DSYNC_INPUT -DENABLE_CHECKING -DXASSERTS -DFONTSET_DEBUG -g -O1'
 '--enable-maintainer-mode' '--with-x-toolkit=lucid''

Important settings:
  value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil
  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
  value of $LANG: fr_CH.UTF-8
  value of $XMODIFIERS: nil
  locale-coding-system: utf-8-unix
  default enable-multibyte-characters: t

Major mode: InactiveMinibuffer

Minor modes in effect:
  diff-auto-refine-mode: t
  shell-dirtrack-mode: t
  electric-pair-mode: t
  electric-indent-mode: t
  url-handler-mode: t
  global-reveal-mode: t
  reveal-mode: t
  auto-insert-mode: t
  savehist-mode: t
  minibuffer-electric-default-mode: t
  mouse-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  line-number-mode: t
  transient-mark-mode: t

Recent input:
<right> <right> <right> C-s C-w C-w C-w C-w C-s <M-backspace> 
c o u n t e r C-s C-s C-M-b C-M-k 0 <down-mouse-1> 
<mouse-movement> <mouse-1> <M-backspace> d e C-s C-s 
C-s C-s C-a C-M-k C-k C-x C-s C-s C-s <down-mouse-1> 
<mouse-1> C-s C-w C-w C-w C-w C-s C-s C-a <right> <right> 
<right> <right> <right> <right> <left> M-d k i l l 
- l o c <tab> C-d ' C-e <M-backspace> <backspace> ) 
C-s C-s C-s C-s C-s C-a C-x C-s <switch-frame> <switch-frame> 
<switch-frame> <switch-frame> <switch-frame> <switch-frame> 
<switch-frame> <switch-frame> <switch-frame> <switch-frame> 
<down> <down> <down> <down> <down> <down> <down> <down> 
<down> <down> <down> <down> <left> <right> C-SPC <down> 
<down> C-w <left> <right> <down> <left> <right> <down> 
<left> <right> C-x C-s C-c C-c M-x n o r - m o d <tab> 
<return> C-c C-c M-< C-e <right> <down> <down> <down> 
<down> <down> <left> <return> ; ; SPC V e r s i o n 
: SPC 0 . 1 <right> <up> <up> <left> <right> <down> 
<left> <right> <down> <left> <right> C-x C-s <down-mouse-1> 
<mouse-movement> <mouse-1> <M-backspace> w i t h <down-mouse-1> 
<mouse-1> C-e <switch-frame> <switch-frame> <switch-frame> 
<switch-frame> <switch-frame> <switch-frame> <switch-frame> 
<switch-frame> <switch-frame> C-l C-l M-< M-> M-< M-: 
( e r a s e - b u f f e r <return> M-: M-p ( l e t 
SPC ( ( i n h - r e - o n <M-tab> SPC t ) ) SPC C-e 
) <return> s <help-echo> C-x C-c <switch-frame> <switch-frame> 
<switch-frame> <switch-frame> <switch-frame> <switch-frame> 
<switch-frame> <switch-frame> s M-x r e v - b u f <tab> 
<return> <up> <up> <up> <up> <up> <up> <up> <up> <switch-frame> 
s s <switch-frame> <switch-frame> <switch-frame> <switch-frame> 
<switch-frame> <switch-frame> <switch-frame> <switch-frame> 
C-x C-c <switch-frame> <switch-frame> <switch-frame> 
<switch-frame> <switch-frame> <switch-frame> M-x r 
e p o - e m - b u <tab> <return>

Recent messages:
Mark set [3 times]
eval: Buffer is read-only: #<buffer *Help*>
nil
Warning: interactive-p is obsolete! [6 times]
...monnier/.emacs-history locked by monnier <at> alfaj... (pid 13705): (s, q, p, ?)? 
Warning: interactive-p is obsolete!
...monnier/.emacs-history locked by monnier <at> alfaj... (pid 13705): (s, q, p, ?)? 
Warning: interactive-p is obsolete!
...monnier/.emacs-history locked by monnier <at> alfaj... (pid 13705): (s, q, p, ?)? 
Warning: interactive-p is obsolete!

Load-path shadows:
/usr/share/emacs23/site-lisp/bbdb/bbdb-w3 hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-w3
/usr/share/emacs23/site-lisp/bbdb/bbdb-migrate hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-migrate
/usr/share/emacs23/site-lisp/bbdb/bbdb-snarf hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-snarf
/usr/share/emacs23/site-lisp/bbdb/bbdb-hooks hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-hooks
/usr/share/emacs23/site-lisp/bbdb/bbdb-sc hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-sc
/usr/share/emacs23/site-lisp/bbdb/bbdb-merge hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-merge
/usr/share/emacs23/site-lisp/bbdb/bbdb-print hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-print
/usr/share/emacs23/site-lisp/bbdb/bbdb-ftp hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-ftp
/usr/share/emacs23/site-lisp/bbdb/bbdb-mhe hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-mhe
/usr/share/emacs23/site-lisp/bbdb/bbdb-gnus hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-gnus
/usr/share/emacs23/site-lisp/bbdb/bbdb-whois hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-whois
/usr/share/emacs23/site-lisp/bbdb/bbdb-gui hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-gui
/usr/share/emacs23/site-lisp/bbdb/bbdb-vm hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-vm
/usr/share/emacs23/site-lisp/bbdb/bbdb-rmail hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-rmail
/usr/share/emacs23/site-lisp/bbdb/bbdb-com hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb-com
/usr/share/emacs23/site-lisp/bbdb/bbdb hides /usr/share/emacs/site-lisp/bbdb/lisp/bbdb

Features:
(sort mail-extr emacsbug message format-spec rfc822 mml mml-sec
mm-decode mm-bodies mm-encode mail-parse rfc2231 mailabbrev mailheader
sendmail rfc2047 rfc2045 ietf-drums mail-utils dabbrev crm descr-text
winmgr-mode nhexl-mode hexl epa-file epa derived epg epg-config cl-specs
smerge-mode log-edit pcvs-util vc-sccs vc-svn vc-cvs vc-rcs vc-dir
add-log newcomment whitespace diff-mode vc-annotate vc ediff-merg
ediff-diff ediff-wind ediff-help ediff-util ediff-mult ediff-init ediff
vc-dispatcher shell pcomplete grep compile xscheme trace testcover
scheme unsafep re-builder shadow inf-lisp ielm pp comint ansi-color ring
gmm-utils ert ewoc debug elp edebug cust-print cus-edit cus-start
cus-load find-func wid-edit cal-china lunar solar cal-dst cal-bahai
cal-islam cal-hebrew holidays hol-loaddefs cal-french diary-lib
diary-loaddefs mule-util cal-move cal-menu calendar cal-loaddefs
executable copyright multi-isearch vc-bzr filecache server noutline
outline easy-mmode flyspell ispell eldoc checkdoc regexp-opt thingatpt
help-mode easymenu view prog-mode electric url-handlers url-parse
auth-source warnings eieio byte-opt bytecomp byte-compile cconv macroexp
assoc gnus-util password-cache url-vars mm-util mail-prsvr reveal
autoinsert uniquify advice help-fns advice-preload time-date savehist
minibuf-eldef disp-table cl cl-loaddefs package tabulated-list
bbdb-autoloads agda2 tooltip ediff-hook vc-hooks lisp-float-type mwheel
x-win x-dnd tool-bar dnd fontset image fringe lisp-mode register page
menu-bar rfn-eshadow timer select scroll-bar mouse jit-lock font-lock
syntax font-core frame cham georgian utf-8-lang misc-lang vietnamese
tibetan thai tai-viet lao korean japanese hebrew greek romanian slovak
czech european ethiopic indian cyrillic chinese case-table epa-hook
jka-cmpr-hook help simple abbrev minibuffer loaddefs button faces
cus-face files text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote
make-network-process dbusbind dynamic-setting font-render-setting
x-toolkit x multi-tty emacs)




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11063; Package emacs. (Sat, 24 Mar 2012 20:05:02 GMT) Full text and rfc822 format available.

Message #8 received at 11063 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 11063 <at> debbugs.gnu.org
Subject: Re: bug#11063: Window-start in the middle of a line with nhexl-mode
Date: Sat, 24 Mar 2012 21:32:12 +0200
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> 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
> <page-down>
> 
> 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.

Similar problems happen in Emacs 23.3, although there they are only
visible if you move cursor vertically with C-n until Emacs scrolls the
display.  So this is not a regression wrt Emacs 23.

I will look into this in a couple of days.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11063; Package emacs. (Sat, 31 Mar 2012 17:24:01 GMT) Full text and rfc822 format available.

Message #11 received at 11063 <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 11063 <at> debbugs.gnu.org
Subject: Re: bug#11063: Window-start in the middle of a line with nhexl-mode
Date: Sat, 31 Mar 2012 20:22:55 +0300
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> 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
> <page-down>
> 
> 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
     {





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#11063; Package emacs. (Sat, 31 Mar 2012 19:08:01 GMT) Full text and rfc822 format available.

Message #14 received at 11063 <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 11063 <at> debbugs.gnu.org
Subject: Re: bug#11063: Window-start in the middle of a line with nhexl-mode
Date: Sat, 31 Mar 2012 15:07:44 -0400
>> % src/emacs -Q -l .../elpa/packages/nhexl-mode/nhexl-mode.el README
>> M-x nhexl-mode RET
>> <page-down>
>> 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;

The fix looks good, so you might as well install it.

> after all, nhexl-mode is not part of Emacs, and quite a corner
> case at that.

Agreed.

Thank you,


        Stefan




Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 31 Mar 2012 19:34:01 GMT) Full text and rfc822 format available.

Notification sent to Stefan Monnier <monnier <at> iro.umontreal.ca>:
bug acknowledged by developer. (Sat, 31 Mar 2012 19:34:02 GMT) Full text and rfc822 format available.

Message #19 received at 11063-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stefan Monnier <monnier <at> iro.umontreal.ca>
Cc: 11063-done <at> debbugs.gnu.org
Subject: Re: bug#11063: Window-start in the middle of a line with nhexl-mode
Date: Sat, 31 Mar 2012 22:32:38 +0300
> From: Stefan Monnier <monnier <at> iro.umontreal.ca>
> Cc: 11063 <at> debbugs.gnu.org
> Date: Sat, 31 Mar 2012 15:07:44 -0400
> 
> >> % src/emacs -Q -l .../elpa/packages/nhexl-mode/nhexl-mode.el README
> >> M-x nhexl-mode RET
> >> <page-down>
> >> 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;
> 
> The fix looks good, so you might as well install it.

Done as trunk revision 107714.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sun, 29 Apr 2012 11:24:03 GMT) Full text and rfc822 format available.

This bug report was last modified 12 years and 21 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.