GNU bug report logs - #64395
[PATCH] * src/xdisp.c (display_string): Don't truncate mode line in terminal

Previous Next

Package: emacs;

Reported by: Gong Qijian <gongqijian <at> gmail.com>

Date: Sat, 1 Jul 2023 06:31:01 UTC

Severity: normal

Tags: patch

Merged with 64396

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

Bug is archived. No further changes may be made.

Full log


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

From: Gong Qijian <gongqijian <at> gmail.com>
To: bug-gnu-emacs <at> gnu.org
Cc: Gong Qijian <gongqijian <at> gmail.com>
Subject: [PATCH] * src/xdisp.c (display_string): Don't truncate mode line in
 terminal
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:

$ 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





This bug report was last modified 2 years and 25 days ago.

Previous Next


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