unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
* bug#64396: [PATCH] * src/xdisp.c (display_string): Don't truncate mode line in terminal
@ 2023-06-30  5:42 Gong Qijian
  2023-07-01  7:48 ` Eli Zaretskii
  0 siblings, 1 reply; 2+ messages in thread
From: Gong Qijian @ 2023-06-30  5:42 UTC (permalink / raw)
  To: 64396; +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] 2+ messages in thread

* bug#64396: [PATCH] * src/xdisp.c (display_string): Don't truncate mode line in terminal
  2023-06-30  5:42 bug#64396: [PATCH] * src/xdisp.c (display_string): Don't truncate mode line in terminal Gong Qijian
@ 2023-07-01  7:48 ` Eli Zaretskii
  0 siblings, 0 replies; 2+ messages in thread
From: Eli Zaretskii @ 2023-07-01  7:48 UTC (permalink / raw)
  To: Gong Qijian; +Cc: 64396

merge 64396 64395
thanks

> Cc: Gong Qijian <gongqijian@gmail.com>
> From: Gong Qijian <gongqijian@gmail.com>
> 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:

This is an exact duplicate of bug#64395.





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

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

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-30  5:42 bug#64396: [PATCH] * src/xdisp.c (display_string): Don't truncate mode line in terminal Gong Qijian
2023-07-01  7:48 ` Eli Zaretskii

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).