From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gong Qijian Newsgroups: gmane.emacs.bugs Subject: bug#64396: [PATCH] * src/xdisp.c (display_string): Don't truncate mode line in terminal Date: Fri, 30 Jun 2023 13:42:09 +0800 Message-ID: <20230630054209.6368-1-gongqijian@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="6153"; mail-complaints-to="usenet@ciao.gmane.io" Cc: Gong Qijian To: 64396@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Jul 01 08:31:37 2023 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1qFU8s-0001P7-BX for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 01 Jul 2023 08:31:34 +0200 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qFU8f-0003NE-8k; Sat, 01 Jul 2023 02:31:21 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qFU8R-0003MY-5i for bug-gnu-emacs@gnu.org; Sat, 01 Jul 2023 02:31:09 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1qFU8N-0007T5-1m for bug-gnu-emacs@gnu.org; Sat, 01 Jul 2023 02:31:06 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1qFU8M-00088C-TX for bug-gnu-emacs@gnu.org; Sat, 01 Jul 2023 02:31:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Gong Qijian Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 01 Jul 2023 06:31:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 64396 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.168819303231198 (code B ref -1); Sat, 01 Jul 2023 06:31:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 1 Jul 2023 06:30:32 +0000 Original-Received: from localhost ([127.0.0.1]:56254 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qFU7s-000873-F4 for submit@debbugs.gnu.org; Sat, 01 Jul 2023 02:30:32 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:34262) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1qFU7q-00086t-Vh for submit@debbugs.gnu.org; Sat, 01 Jul 2023 02:30:31 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qFU7q-0003JN-IO for bug-gnu-emacs@gnu.org; Sat, 01 Jul 2023 02:30:30 -0400 Original-Received: from [113.195.251.135] (helo=gqjs-MBP.lan) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qFU7k-0005lj-PL for bug-gnu-emacs@gnu.org; Sat, 01 Jul 2023 02:30:30 -0400 Original-Received: by gqjs-MBP.lan (Postfix, from userid 501) id 70CC8847498; Fri, 30 Jun 2023 13:42:10 +0800 (CST) X-Mailer: git-send-email 2.38.1 X-Host-Lookup-Failed: Reverse DNS lookup failed for 113.195.251.135 (failed) Received-SPF: none client-ip=113.195.251.135; envelope-from=gqj@gqjs-MBP.lan; helo=gqjs-MBP.lan X-Spam_score_int: 46 X-Spam_score: 4.6 X-Spam_bar: ++++ X-Spam_report: (4.6 / 5.0 requ) BAYES_00=-1.9, DKIM_ADSP_CUSTOM_MED=0.001, FORGED_GMAIL_RCVD=1, FREEMAIL_FORGED_FROMDOMAIN=0.249, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, NML_ADSP_CUSTOM_MED=0.9, NO_DNS_FOR_FROM=0.001, RCVD_IN_PBL=3.335, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_NONE=0.001, SPOOFED_FREEMAIL=0.001, SPOOFED_FREEMAIL_NO_RDNS=0.001, SPOOF_GMAIL_MID=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Xref: news.gmane.io gmane.emacs.bugs:264354 Archived-At: 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