emacs-bug-tracker
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#64396: closed ([PATCH] * src/xdisp.c (display_string): Don't truncat


From: GNU bug Tracking System
Subject: bug#64396: closed ([PATCH] * src/xdisp.c (display_string): Don't truncate mode line in terminal)
Date: Sat, 15 Jul 2023 07:48:02 +0000

Your message dated Sat, 15 Jul 2023 10:47:58 +0300
with message-id <831qh9ehu9.fsf@gnu.org>
and subject line Re: bug#64395: [PATCH] * src/xdisp.c (display_string): Don't 
truncate mode line in terminal
has caused the debbugs.gnu.org bug report #64395,
regarding [PATCH] * src/xdisp.c (display_string): Don't truncate mode line in 
terminal
to be marked as done.

(If you believe you have received this mail in error, please contact
help-debbugs@gnu.org.)


-- 
64395: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=64395
GNU Bug Tracking System
Contact help-debbugs@gnu.org with problems
--- Begin Message --- Subject: [PATCH] * src/xdisp.c (display_string): Don't truncate mode line in terminal Date: Fri, 30 Jun 2023 13:42:09 +0800
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




--- End Message ---
--- Begin Message --- Subject: Re: bug#64395: [PATCH] * src/xdisp.c (display_string): Don't truncate mode line in terminal Date: Sat, 15 Jul 2023 10:47:58 +0300
> 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.


--- End Message ---

reply via email to

[Prev in Thread] Current Thread [Next in Thread]