unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Sean Whitton <spwhitton@spwhitton.name>
To: Eli Zaretskii <eliz@gnu.org>
Cc: joaotavora@gmail.com, 72826@debbugs.gnu.org, juri@linkov.net
Subject: bug#72826: 30.0.90; icomplete-in-buffer becomes unusably slow in large Eshell
Date: Fri, 04 Oct 2024 17:02:25 +0800	[thread overview]
Message-ID: <871q0w44wu.fsf@melete.silentflame.com> (raw)
In-Reply-To: <86y134xuqx.fsf@gnu.org> (Eli Zaretskii's message of "Fri, 04 Oct 2024 09:11:34 +0300")

Hello,

On Fri 04 Oct 2024 at 09:11am +03, Eli Zaretskii wrote:

> Can you explain why taking a substring of the buffer text is TRT in
> this case and how it makes such a big difference without omitting text
> whose width should be measured?  IOW, are you saying the current code
> produces too large width? if so, how can the layout of completion
> candidates be correct?

Here is my thinking:

I think that the current code was not written with icomplete-in-region
in mind, which makes sense, because icomplete-in-region was added later.

The current code simply calculates the width taken up by the minibuffer
prompt and (minibuffer-contents), and starts the candidates to the right
of those.  Ignoring icomplete-in-region, (buffer-string) is exactly what
we want, because there is nothing else in the minibuffer.

So, how can we perform an equivalent calculation that will work in the
case that we might not be in a minibuffer?  Well, the characters between
(icomplete--field-beg) and (icomplete--field-end) are the equivalent of
(minibuffer-contents).  Then going back to (pos-bol) before
(icomplete--field-beg) is the equivalent of including the width of the
minibuffer prompt.

Cases where the old code and new code are different are when the
minibuffer prompt contains line breaks.  The new code effectively
ignores all parts of the minibuffer prompt except its last line.  I
think that's correct, and the old code could have calculated an overly
large width if previous lines of the minibuffer prompt were longer than
the final line.

One case I am not sure about is when the existing input takes up more
than one line.  I believe the old and new code will always do the same
thing, but I'm not sure it's correct.

-- 
Sean Whitton





  reply	other threads:[~2024-10-04  9:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-27  7:26 bug#72826: 30.0.90; icomplete-in-buffer becomes unusably slow in large Eshell Sean Whitton
2024-08-27 12:43 ` Eli Zaretskii
2024-10-03 14:28   ` Sean Whitton
2024-10-03 15:16     ` Eli Zaretskii
2024-10-04  0:20       ` Sean Whitton
2024-10-04  6:11         ` Eli Zaretskii
2024-10-04  9:02           ` Sean Whitton [this message]
2024-10-04 10:53             ` Eli Zaretskii
2024-10-04 11:02               ` Sean Whitton
2024-10-04 11:52                 ` Eli Zaretskii
2024-10-04 14:09                   ` Sean Whitton
2024-10-04 14:33                     ` Eli Zaretskii
2024-10-05  0:21                       ` Sean Whitton
2024-10-05  7:16                         ` Eli Zaretskii
2024-10-05  7:44                           ` Sean Whitton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=871q0w44wu.fsf@melete.silentflame.com \
    --to=spwhitton@spwhitton.name \
    --cc=72826@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=joaotavora@gmail.com \
    --cc=juri@linkov.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).