Subject: bug#22544: closed (Re: bug#22544: 25.0.90; Long history items cause surprising positioning of cursor in minibuffer)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 10 Feb 2016 00:33:02 +0000

Your bug report

#22544: 25.0.90; Long history items cause surprising positioning of cursor in minibuffer

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
22544: http://debbugs.gnu.org/cgi/bugreport.cgi?bug=22544
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#22544: 25.0.90; Long history items cause surprising positioning of cursor in minibuffer
From: Juri Linkov <[email-masked]>
To: Eli Zaretskii <[email-masked]>
Cc: [email-masked]
Date: Wed, 10 Feb 2016 02:32:28 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

> LGTM, I'm fine with having these patches as the solution to the
> issue.  Please go ahead and commit.

Done.

Subject: 25.0.90; Long history items cause surprising positioning of cursor in minibuffer
From: Eli Zaretskii <[email-masked]>
To: [email-masked]
Date: Wed, 03 Feb 2016 18:32:58 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

emacs -Q

Paste the following into *scratch* and evaluate it with "C-x C-e"
after the closing parenthesis:

   (let ((default-file "~/rmail/FOO")
	 (file-name-history
	  '("~/rmail/FOOBAR"
	    "~/foo/bar/very/long/file/name/that/overflows/minibuffer/window/line/when/displayed"
	    "~/shorter/file/name")))
     (read-file-name
      (concat "Output message to mail file (default "
	      (file-name-nondirectory default-file)
	      "): ")
      (file-name-directory default-file)
      (abbreviate-file-name default-file)))

You should now see this in the minibuffer:

  Output message to mail file (default FOO): ~/rmail/!

where ! shows the cursor position.

Now press <UP> once.  The result is as expected:

  Output message to mail file (default FOO): ~/rmail/FOOBAR!

with the cursor at the end of the history item.  Press <UP> one more
time, which results in this:

  Output message to mail file (default FOO): ~/foo/bar/very/long/file/name/that/overflows/minibuffer/window/line/when/displayed!

Still as expected.  Press <UP> once more, resulting in:

  Output message to mail file (default FOO): ~/foo/ba!r/very/long/file/name/that/overflows/minibuffer/window/line/when/displayed

This is somewhat unexpected, because the column of the cursor looks
random -- it is neither the same as in previous display, nor related
to anything else I can think of.

Now press <UP> one more time, and observe this result:

  Output message to mail file (default FOO): ~/shorte!r/file/name

This is even less expected -- why isn't the cursor at the end of the
file name, even though it is short enough to display entirely on a
single screen line?

If the longish history item is removed before evaluating the above,
then the behavior is as expected -- Emacs places the cursor at the end
of each history item.

Clearly, the bug is not a catastrophe, but it's quite annoying to see
the cursor jump to these unexpected positions.

The test case is synthesized, but it faithfully emulates what happens
to me every time I use 'o' in Rmail to file a message in my archives.
The archive folders are just mbox files, so the 'o' command in Rmail
uses file-name-history, where I have long file names as well as short
ones.

In GNU Emacs 25.0.90.2 (i686-pc-mingw32)
 of 2016-01-31 built on HOME-C4E4A596F7
Windowing system distributor 'Microsoft Corp.', version 5.1.2600
Configured using:
 'configure --prefix=/d/usr --enable-checking=yes,glyphs
 --with-wide-int --with-modules 'CFLAGS=-Og -gdwarf-4 -g3''

Configured features:
XPM JPEG TIFF GIF PNG RSVG SOUND NOTIFY ACL GNUTLS LIBXML2 ZLIB
TOOLKIT_SCROLL_BARS MODULES

Important settings:
  value of $LANG: ENU
  locale-coding-system: cp1255

Major mode: RMAIL

Minor modes in effect:
  shell-dirtrack-mode: t
  diff-auto-refine-mode: t
  desktop-save-mode: t
  save-place-mode: t
  show-paren-mode: t
  display-time-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t
  temp-buffer-resize-mode: t
  buffer-read-only: t
  line-number-mode: t

Recent messages:
Showing message 2138...done
Showing message 2139...done
Added to d:/usr/eli/rmail/GIT.rmail
Showing message 2140...done
Showing message 2141...done
Showing message 2142...done
Showing message 2143...done
No following nondeleted message
command-execute: Command attempted to use minibuffer while in minibuffer
Mark set

Load-path shadows:
d:/usr/share/emacs/site-lisp/soap-inspect hides d:/usr/share/emacs/25.0.90/lisp/net/soap-inspect
d:/usr/share/emacs/site-lisp/soap-client hides d:/usr/share/emacs/25.0.90/lisp/net/soap-client

Features:
(shadow emacsbug ruby-mode smie shell character-fold misearch
multi-isearch rmailout url-util url-parse url-vars rfc2104
network-stream nsm starttls tls gnutls mail-extr smtpmail auth-source
eieio eieio-core cl-macs password-cache dabbrev mailalias sendmail
shr-color color shr dom subr-x browse-url cl-seq conf-mode arc-mode
archive-mode vc-bzr org-element org-rmail org-mhe org-irc org-info
org-gnus org-docview doc-view image-mode org-bibtex bibtex org-bbdb
org-w3m org advice org-macro org-footnote org-pcomplete pcomplete
org-list org-faces org-entities org-version ob-emacs-lisp ob ob-tangle
ob-ref ob-lob ob-table ob-exp org-src ob-keys ob-comint comint
ansi-color ring ob-core ob-eval org-compat org-macs org-loaddefs
find-func cal-menu calendar cal-loaddefs bat-mode make-mode parse-time
vc-cvs generic vc-svn texinfo jka-compr noutline outline bug-reference
flyspell add-log info vc vc-dispatcher vc-git diff-mode easy-mmode map
seq byte-opt gv bytecomp byte-compile cconv cl-extra qp rmailsum
rmailmm message dired-x dired format-spec rfc822 mml mml-sec epg
epg-config gnus-util mm-decode mm-bodies mm-encode mailabbrev
gmm-utils mailheader mail-parse rfc2231 rmail rfc2047 rfc2045
ietf-drums mm-util help-fns help-mode mail-prsvr mail-utils desktop
frameset server filecache mairix cus-edit cus-start cus-load wid-edit
saveplace midnight ispell generic-x cc-mode cc-fonts easymenu cc-guess
cc-menus cc-cmds cc-styles cc-align cc-engine cc-vars cc-defs
cl-loaddefs pcase cl-lib paren battery time time-date mule-util
tooltip eldoc electric uniquify ediff-hook vc-hooks lisp-float-type
mwheel dos-w32 ls-lisp disp-table w32-win w32-vars term/common-win
tool-bar dnd fontset image regexp-opt fringe tabulated-list newcomment
elisp-mode lisp-mode prog-mode register page menu-bar rfn-eshadow
timer select scroll-bar mouse jit-lock font-lock syntax facemenu
font-core frame cl-generic cham georgian utf-8-lang misc-lang
vietnamese tibetan thai tai-viet lao korean japanese eucjp-ms cp51932
hebrew greek romanian slovak czech european ethiopic indian cyrillic
chinese charscript case-table epa-hook jka-cmpr-hook help simple
abbrev minibuffer cl-preloaded nadvice loaddefs button faces cus-face
macroexp files text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget hashtable-print-readable backquote
w32notify w32 multi-tty make-network-process emacs)

Memory information:
((conses 16 1683542 243444)
 (symbols 56 41206 0)
 (miscs 48 3561 4743)
 (strings 16 113909 44473)
 (string-bytes 1 3147922)
 (vectors 16 41851)
 (vector-slots 8 1701426 256664)
 (floats 8 497 588)
 (intervals 40 326308 7211)
 (buffers 856 218))