From: Gong Qijian <gongqijian@gmail.com>
To: 64395@debbugs.gnu.org
Cc: Gong Qijian <gongqijian@gmail.com>
Subject: bug#64395: [PATCH] * src/xdisp.c (display_string): Don't truncate mode line in terminal
Date: Sat, 1 Jul 2023 14:27:56 +0800 [thread overview]
Message-ID: <20230701062756.78266-1-gongqijian@gmail.com> (raw)
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
next reply other threads:[~2023-07-01 6:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-07-01 6:27 Gong Qijian [this message]
2023-07-01 7:50 ` bug#64395: [PATCH] * src/xdisp.c (display_string): Don't truncate mode line in terminal 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
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20230701062756.78266-1-gongqijian@gmail.com \
--to=gongqijian@gmail.com \
--cc=64395@debbugs.gnu.org \
/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 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.