all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#64395: [PATCH] * src/xdisp.c (display_string): Don't truncate mode line in terminal
@ 2023-07-01  6:27 Gong Qijian
  2023-07-01  7:50 ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Gong Qijian @ 2023-07-01  6:27 UTC (permalink / raw)
  To: 64395; +Cc: Gong Qijian

The truncate happens when the mode line is of lenght
`(1+ (window-width))' and ends with CJK characters.

Reproduce:

$ emacs -nw -Q --eval "\
  (progn
    ;; Set modeline
    (setq mode-line-format
          '((:eval
             (truncate-string-to-width
              (concat (format-mode-line \"- Ln %l, Col %c \")
                      (apply #'concat (make-list (window-width) \"-\")))
              (1+ (window-width)) nil nil \"中文\"))))
    ;; Steps to reproduce
    (with-current-buffer \"*scratch*\"
      (erase-buffer)
      (insert \";; 1. You Can't move the cursor here, this is where the menu should be\n\"
              \";; 2. Press `C-x o' to switch to the other window\n\"
              \";; 3. Repeat step 2 several times\n\"
              \";; 4. You will see nothing in the buffer except multiple lines of modeline\n\")
      (goto-char (point-min))
      (split-window-right)))"
---
 src/xdisp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/xdisp.c b/src/xdisp.c
index 4841a0af..00d2dea0 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -27360,7 +27360,7 @@ display_string (const char *string, Lisp_Object lisp_string, Lisp_Object face_st
 	{
 	  /* Add truncation mark, but don't do it if the line is
 	     truncated at a padding space.  */
-	  if (it_charpos < it->string_nchars)
+	  if (it_charpos <= it->string_nchars)
 	    {
 	      if (!FRAME_WINDOW_P (it->f))
 		{
-- 
2.25.0






^ permalink raw reply related	[flat|nested] 12+ messages in thread

* bug#64395: [PATCH] * src/xdisp.c (display_string): Don't truncate mode line in terminal
  2023-07-01  6:27 bug#64395: [PATCH] * src/xdisp.c (display_string): Don't truncate mode line in terminal Gong Qijian
@ 2023-07-01  7:50 ` Eli Zaretskii
       [not found]   ` <CAPWNH1M1eOtjxP0M0dckXk94FYKGqQxSb8NKb4XUzddggWREMw@mail.gmail.com>
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2023-07-01  7:50 UTC (permalink / raw)
  To: Gong Qijian; +Cc: 64395

> Cc: Gong Qijian <gongqijian@gmail.com>
> From: Gong Qijian <gongqijian@gmail.com>
> Date: Sat,  1 Jul 2023 14:27:56 +0800
> 
> The truncate happens when the mode line is of lenght
> `(1+ (window-width))' and ends with CJK characters.
> 
> Reproduce:

Thanks, but please show the screenshots of the effect of the bug.  I
don't have access to terminals that can display CJK characters on the
mode line, so full reproduction of the issue is impossible for me.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#64395: [PATCH] * src/xdisp.c (display_string): Don't truncate mode line in terminal
       [not found]   ` <CAPWNH1M1eOtjxP0M0dckXk94FYKGqQxSb8NKb4XUzddggWREMw@mail.gmail.com>
@ 2023-07-01 10:42     ` Eli Zaretskii
  2023-07-01 10:45       ` qijian gong
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2023-07-01 10:42 UTC (permalink / raw)
  To: qijian gong; +Cc: 64395

[Pleased use Reply All to reply, so that the bug tracker is CC'ed.]

> From: qijian gong <gongqijian@gmail.com>
> Date: Sat, 1 Jul 2023 18:23:21 +0800
> 
> [image: emacs-modeline-bug64395.gif]
> 
> Eli Zaretskii <eliz@gnu.org> 于2023年7月1日周六 15:49写道:
> 
> > > Cc: Gong Qijian <gongqijian@gmail.com>
> > > From: Gong Qijian <gongqijian@gmail.com>
> > > Date: Sat,  1 Jul 2023 14:27:56 +0800
> > >
> > > The truncate happens when the mode line is of lenght
> > > `(1+ (window-width))' and ends with CJK characters.
> > >
> > > Reproduce:
> >
> > Thanks, but please show the screenshots of the effect of the bug.  I
> > don't have access to terminals that can display CJK characters on the
> > mode line, so full reproduction of the issue is impossible for me.
> >

Thanks, but I see no mode-line image on that screen shot.  I only see
the source of your reproduction recipe.  I asked to see the effect of
running the recipe.






^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#64395: [PATCH] * src/xdisp.c (display_string): Don't truncate mode line in terminal
  2023-07-01 10:42     ` Eli Zaretskii
@ 2023-07-01 10:45       ` qijian gong
  2023-07-01 10:50         ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: qijian gong @ 2023-07-01 10:45 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 64395


[-- Attachment #1.1: Type: text/plain, Size: 1130 bytes --]

[image: emacs-modeline-bug64395.gif]

Eli Zaretskii <eliz@gnu.org> 于2023年7月1日周六 18:41写道:

> [Pleased use Reply All to reply, so that the bug tracker is CC'ed.]
>
> > From: qijian gong <gongqijian@gmail.com>
> > Date: Sat, 1 Jul 2023 18:23:21 +0800
> >
> > [image: emacs-modeline-bug64395.gif]
> >
> > Eli Zaretskii <eliz@gnu.org> 于2023年7月1日周六 15:49写道:
> >
> > > > Cc: Gong Qijian <gongqijian@gmail.com>
> > > > From: Gong Qijian <gongqijian@gmail.com>
> > > > Date: Sat,  1 Jul 2023 14:27:56 +0800
> > > >
> > > > The truncate happens when the mode line is of lenght
> > > > `(1+ (window-width))' and ends with CJK characters.
> > > >
> > > > Reproduce:
> > >
> > > Thanks, but please show the screenshots of the effect of the bug.  I
> > > don't have access to terminals that can display CJK characters on the
> > > mode line, so full reproduction of the issue is impossible for me.
> > >
>
> Thanks, but I see no mode-line image on that screen shot.  I only see
> the source of your reproduction recipe.  I asked to see the effect of
> running the recipe.
>
>

[-- Attachment #1.2: Type: text/html, Size: 1897 bytes --]

[-- Attachment #2: emacs-modeline-bug64395.gif --]
[-- Type: image/gif, Size: 193123 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#64395: [PATCH] * src/xdisp.c (display_string): Don't truncate mode line in terminal
  2023-07-01 10:45       ` qijian gong
@ 2023-07-01 10:50         ` Eli Zaretskii
  2023-07-01 11:00           ` qijian gong
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2023-07-01 10:50 UTC (permalink / raw)
  To: qijian gong; +Cc: 64395

> From: qijian gong <gongqijian@gmail.com>
> Date: Sat, 1 Jul 2023 18:45:55 +0800
> Cc: 64395@debbugs.gnu.org
> 
> emacs-modeline-bug64395.gif

Thanks, but I still don't see the mode-line display that is produced
by your recipe.  I only see the recipe itself.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#64395: [PATCH] * src/xdisp.c (display_string): Don't truncate mode line in terminal
  2023-07-01 10:50         ` Eli Zaretskii
@ 2023-07-01 11:00           ` qijian gong
  2023-07-01 11:07             ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: qijian gong @ 2023-07-01 11:00 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 64395

[-- Attachment #1: Type: text/plain, Size: 392 bytes --]

Do you mean the keystroke logs?

Eli Zaretskii <eliz@gnu.org> 于2023年7月1日周六 18:50写道:

> > From: qijian gong <gongqijian@gmail.com>
> > Date: Sat, 1 Jul 2023 18:45:55 +0800
> > Cc: 64395@debbugs.gnu.org
> >
> > emacs-modeline-bug64395.gif
>
> Thanks, but I still don't see the mode-line display that is produced
> by your recipe.  I only see the recipe itself.
>

[-- Attachment #2: Type: text/html, Size: 822 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#64395: [PATCH] * src/xdisp.c (display_string): Don't truncate mode line in terminal
  2023-07-01 11:00           ` qijian gong
@ 2023-07-01 11:07             ` Eli Zaretskii
  2023-07-01 11:25               ` qijian gong
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2023-07-01 11:07 UTC (permalink / raw)
  To: qijian gong; +Cc: 64395

> From: qijian gong <gongqijian@gmail.com>
> Date: Sat, 1 Jul 2023 19:00:17 +0800
> Cc: 64395@debbugs.gnu.org
> 
> Do you mean the keystroke logs?

No, I mean the picture of the mode-line with truncation that is
produced by running your reproduction recipe.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#64395: [PATCH] * src/xdisp.c (display_string): Don't truncate mode line in terminal
  2023-07-01 11:07             ` Eli Zaretskii
@ 2023-07-01 11:25               ` qijian gong
  2023-07-01 12:00                 ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: qijian gong @ 2023-07-01 11:25 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: 64395

[-- Attachment #1: Type: text/plain, Size: 514 bytes --]

Sorry, I don't quite understand what you mean.

The picture I sent earlier is an animation. It shows the entire
reproduction process and the result.



Eli Zaretskii <eliz@gnu.org> 于2023年7月1日周六 19:07写道:

> > From: qijian gong <gongqijian@gmail.com>
> > Date: Sat, 1 Jul 2023 19:00:17 +0800
> > Cc: 64395@debbugs.gnu.org
> >
> > Do you mean the keystroke logs?
>
> No, I mean the picture of the mode-line with truncation that is
> produced by running your reproduction recipe.
>

[-- Attachment #2: Type: text/html, Size: 983 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#64395: [PATCH] * src/xdisp.c (display_string): Don't truncate mode line in terminal
  2023-07-01 11:25               ` qijian gong
@ 2023-07-01 12:00                 ` Eli Zaretskii
  2023-07-01 12:47                   ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2023-07-01 12:00 UTC (permalink / raw)
  To: qijian gong; +Cc: 64395

> From: qijian gong <gongqijian@gmail.com>
> Date: Sat, 1 Jul 2023 19:25:26 +0800
> Cc: 64395@debbugs.gnu.org
> 
> The picture I sent earlier is an animation. It shows the entire reproduction process and the result.

Sorry, I didn't realize that it included animation.

I think I see the issue now.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#64395: [PATCH] * src/xdisp.c (display_string): Don't truncate mode line in terminal
  2023-07-01 12:00                 ` Eli Zaretskii
@ 2023-07-01 12:47                   ` Eli Zaretskii
  2023-07-02  8:15                     ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2023-07-01 12:47 UTC (permalink / raw)
  To: gongqijian; +Cc: 64395

> Cc: 64395@debbugs.gnu.org
> Date: Sat, 01 Jul 2023 15:00:48 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> 
> > From: qijian gong <gongqijian@gmail.com>
> > Date: Sat, 1 Jul 2023 19:25:26 +0800
> > Cc: 64395@debbugs.gnu.org
> > 
> > The picture I sent earlier is an animation. It shows the entire reproduction process and the result.
> 
> Sorry, I didn't realize that it included animation.
> 
> I think I see the issue now.

OK, I've now found a way of reproducing the problem on a system to
which I have access.

Your proposed change fixes the problem, but it fixes it incorrectly:
after applying the patch, I see a truncation glyph "$" at the end of
the mode line.  This should never happen on the mode line: we don't
show truncation glyphs there.  Compare the display after applying your
patch with the mode-line displayed after evaluating the below:

 (setq mode-line-format
       (concat (format-mode-line
                "- Ln %l, Col %c ")
               (make-string 100 ?-)))

As you see, the expected display of the mode line that is truncated is
simply not to see the truncated part, without any "$" truncation
glyph at the end of the mode line.

So a slightly different change is needed to properly fix this case.
I'm working on such a proper fix.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#64395: [PATCH] * src/xdisp.c (display_string): Don't truncate mode line in terminal
  2023-07-01 12:47                   ` Eli Zaretskii
@ 2023-07-02  8:15                     ` Eli Zaretskii
  2023-07-15  7:47                       ` Eli Zaretskii
  0 siblings, 1 reply; 12+ messages in thread
From: Eli Zaretskii @ 2023-07-02  8:15 UTC (permalink / raw)
  To: gongqijian; +Cc: 64395

> Cc: 64395@debbugs.gnu.org
> Date: Sat, 01 Jul 2023 15:47:39 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> 
> Your proposed change fixes the problem, but it fixes it incorrectly:
> after applying the patch, I see a truncation glyph "$" at the end of
> the mode line.  This should never happen on the mode line: we don't
> show truncation glyphs there.  Compare the display after applying your
> patch with the mode-line displayed after evaluating the below:
> 
>  (setq mode-line-format
>        (concat (format-mode-line
>                 "- Ln %l, Col %c ")
>                (make-string 100 ?-)))
> 
> As you see, the expected display of the mode line that is truncated is
> simply not to see the truncated part, without any "$" truncation
> glyph at the end of the mode line.
> 
> So a slightly different change is needed to properly fix this case.
> I'm working on such a proper fix.

Should be fixed now on the master branch, please test.





^ permalink raw reply	[flat|nested] 12+ messages in thread

* bug#64395: [PATCH] * src/xdisp.c (display_string): Don't truncate mode line in terminal
  2023-07-02  8:15                     ` Eli Zaretskii
@ 2023-07-15  7:47                       ` Eli Zaretskii
  0 siblings, 0 replies; 12+ messages in thread
From: Eli Zaretskii @ 2023-07-15  7:47 UTC (permalink / raw)
  To: gongqijian; +Cc: 64395-done

> Cc: 64395@debbugs.gnu.org
> Date: Sun, 02 Jul 2023 11:15:20 +0300
> From: Eli Zaretskii <eliz@gnu.org>
> 
> > Cc: 64395@debbugs.gnu.org
> > Date: Sat, 01 Jul 2023 15:47:39 +0300
> > From: Eli Zaretskii <eliz@gnu.org>
> > 
> > Your proposed change fixes the problem, but it fixes it incorrectly:
> > after applying the patch, I see a truncation glyph "$" at the end of
> > the mode line.  This should never happen on the mode line: we don't
> > show truncation glyphs there.  Compare the display after applying your
> > patch with the mode-line displayed after evaluating the below:
> > 
> >  (setq mode-line-format
> >        (concat (format-mode-line
> >                 "- Ln %l, Col %c ")
> >                (make-string 100 ?-)))
> > 
> > As you see, the expected display of the mode line that is truncated is
> > simply not to see the truncated part, without any "$" truncation
> > glyph at the end of the mode line.
> > 
> > So a slightly different change is needed to properly fix this case.
> > I'm working on such a proper fix.
> 
> Should be fixed now on the master branch, please test.

No further comments within 2 weeks, so I presume the bug has indeed
been solved, and I'm therefore closing it.





^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2023-07-15  7:47 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-01  6:27 bug#64395: [PATCH] * src/xdisp.c (display_string): Don't truncate mode line in terminal Gong Qijian
2023-07-01  7:50 ` Eli Zaretskii
     [not found]   ` <CAPWNH1M1eOtjxP0M0dckXk94FYKGqQxSb8NKb4XUzddggWREMw@mail.gmail.com>
2023-07-01 10:42     ` Eli Zaretskii
2023-07-01 10:45       ` qijian gong
2023-07-01 10:50         ` Eli Zaretskii
2023-07-01 11:00           ` qijian gong
2023-07-01 11:07             ` Eli Zaretskii
2023-07-01 11:25               ` qijian gong
2023-07-01 12:00                 ` Eli Zaretskii
2023-07-01 12:47                   ` Eli Zaretskii
2023-07-02  8:15                     ` Eli Zaretskii
2023-07-15  7:47                       ` Eli Zaretskii

Code repositories for project(s) associated with this external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.