From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Gerd =?UTF-8?Q?M=C3=B6llmann?= Newsgroups: gmane.emacs.bugs Subject: bug#74854: [PATCH] Improve menu separator display on ttys slightly Date: Fri, 13 Dec 2024 16:09:30 +0100 Message-ID: Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="24528"; mail-complaints-to="usenet@ciao.gmane.io" To: 74854@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Fri Dec 13 16:10:30 2024 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 1tM7JF-0006BT-R4 for geb-bug-gnu-emacs@m.gmane-mx.org; Fri, 13 Dec 2024 16:10:30 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tM7Iw-0003Rq-RU; Fri, 13 Dec 2024 10:10:12 -0500 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 1tM7Ir-0003LI-Bm for bug-gnu-emacs@gnu.org; Fri, 13 Dec 2024 10:10:06 -0500 Original-Received: from debbugs.gnu.org ([2001:470:142:5::43]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tM7Ir-0003Vt-2o for bug-gnu-emacs@gnu.org; Fri, 13 Dec 2024 10:10:05 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=MIME-Version:Date:From:To:Subject; bh=/xCASuGOExJNkdF3XOd9ZhyXz8+Af7SBZqSi0k9/GgM=; b=QRkc8qOZAnA+j/ZsDl4hUyf8s01M/dWiYhhZEq+vMZQPlsnPfzSintxIM2x649rR2hekgyDY+uOQIR1XfC0Z4TSoIWcs+7KRdOIdE5ZSzeQX4MfQkmvjjJGG6IvY8iP5XLwxBMGkllmkM28UCNu8YHW81naouEr2i25F0PklrsovC/ThMVWO/JfCGQ5WqZ/kfqT64+fXvQfESfI2htyHDgVpVKsM+HMzrcO/4XxHJKA4SKijbIszpEbOV+AZfGLfkWf4l2WnSKBm1ZuhpmC9BqrB8Akz51kzc+bANKvSxujjIBPHVZSyhqKGSxjv51bstjwVHPLp26E5OFo2EqOG/A==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tM7Iq-0003SO-HS for bug-gnu-emacs@gnu.org; Fri, 13 Dec 2024 10:10:04 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Gerd =?UTF-8?Q?M=C3=B6llmann?= Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Fri, 13 Dec 2024 15:10:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 74854 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.173410259413246 (code B ref -1); Fri, 13 Dec 2024 15:10:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 13 Dec 2024 15:09:54 +0000 Original-Received: from localhost ([127.0.0.1]:43747 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tM7Id-0003RY-UH for submit@debbugs.gnu.org; Fri, 13 Dec 2024 10:09:53 -0500 Original-Received: from lists.gnu.org ([209.51.188.17]:59512) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tM7IY-0003RG-9f for submit@debbugs.gnu.org; Fri, 13 Dec 2024 10:09:50 -0500 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 1tM7IR-0003CI-01 for bug-gnu-emacs@gnu.org; Fri, 13 Dec 2024 10:09:40 -0500 Original-Received: from mail-lf1-x12b.google.com ([2a00:1450:4864:20::12b]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1tM7IO-00038l-0O for bug-gnu-emacs@gnu.org; Fri, 13 Dec 2024 10:09:37 -0500 Original-Received: by mail-lf1-x12b.google.com with SMTP id 2adb3069b0e04-53df6322ea7so2594878e87.0 for ; Fri, 13 Dec 2024 07:09:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1734102573; x=1734707373; darn=gnu.org; h=mime-version:message-id:date:subject:to:from:from:to:cc:subject :date:message-id:reply-to; bh=/xCASuGOExJNkdF3XOd9ZhyXz8+Af7SBZqSi0k9/GgM=; b=LoOAItcC6dpGcXxdQDcUSqNkzFAjULuLRHC4CBJbLWfsXY7X4O2kislEK8+Eoyau98 VhcsjhXN2mhjhz9EXUaSX3YONQg0u36Fe/WRJ/aM8XEtugZvNkdVpmsEyTbx6NU8oOaL Q8LUdjGYurWTv2uVinSozYhCcmFPWQSNp9kkJJbOeMo05Ha7nY/pxHpGKjStMtloWYvr qQ6ZuYLTRAxCHJJpbckg+C2TsXe7gYvGNZXN74Lf0CSgfrqFDLFEUieaw2xIuCBxH9aH AWnNskDBq3H6wOCQCHtq8UlrVAT8SNApXTvbU+4htWwXiZAi0TlVsTnP6wrHRB5fjeB8 SQ+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734102573; x=1734707373; h=mime-version:message-id:date:subject:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=/xCASuGOExJNkdF3XOd9ZhyXz8+Af7SBZqSi0k9/GgM=; b=SmbI1j9PkTCu0FD8wQNvpPCBIH7YCdU3CPgJPbP6iWoHx9Byx51L0Qhf/dBDdc/5Vn vsMOJHwcKfx2ZottbMAg7YWUJ3gm/mSDbMw/g9c7ps/hvyx5I7pZ2BPH56Il8ILEckbE I5jyjM4TBa+ebFCegeiYwstm5DFzGfmPVd6ovl20OA1wBfhlVW+3bYdkkEdcH7IChDyB fJIPazK0ohVlaINS1de6/TXjM3WLqnAE+uCUK8kPMZ9Z3FIf+ndSl5HdrWqUBx9yhd3c DSlqCzeD4pqVMYFYU0pb/VuX8E4AQt0rKacR1Mk2qeXD6nRa+lItLiiGwxJ+QzQDmD8A Wi/Q== X-Gm-Message-State: AOJu0Ywl3lsEXnym9u1pn/+xCwbK0N7Pt3rMKU0X1rrugSH+XMOMlh7r kxdrgXjQjqF4I047F2GIUpQy12ZzSC9xo51h7lbeqDmwLO37i1uc1Kjj2A== X-Gm-Gg: ASbGncsSYu9hELuhzPlNXuleEqHSyO0pZgCmWTSMmwgHCpSEffVSYJSEqXf+x32vz+8 YLMV8+VOfeOXTBhsHUpSQLPIonVVBb6kozpFKaDlqjklL2q7PQWGmERj9XYG/iGMF5LIC7g0/Vy pUlJQeNk7T5+4I65/kzd7fYVoxeyRtFY7ul+W9S+uUMzAuP/6jC+KVSijIZYb1ToxFx+gNd3BrC 7Rd4/oDpmKyxb1UkQTBKU6Ifrt4aoKcKjIyNNDJyqyjyLf8j86YRgfGYfJBq+Wa298lYAwRjrZ1 9UHls7BduRth/oAIJ0eY6duT+NlW3Du+bE9QNVz0sbdSkYFTgYZszmQuT4FQ X-Google-Smtp-Source: AGHT+IHsu02rqsENB1AmGet1QEUf3JH4ah01cl/HaUPs6AtaBPSMUN+/IKaafTLhJPonEBT3JqSyMA== X-Received: by 2002:a05:6512:3b95:b0:540:1e74:5a15 with SMTP id 2adb3069b0e04-54099b69db0mr997565e87.54.1734102572263; Fri, 13 Dec 2024 07:09:32 -0800 (PST) Original-Received: from pro2 (p200300e0b7097800193cd38c2c718030.dip0.t-ipconnect.de. [2003:e0:b709:7800:193c:d38c:2c71:8030]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-aa6883f65c3sm711482666b.157.2024.12.13.07.09.31 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 Dec 2024 07:09:31 -0800 (PST) Received-SPF: pass client-ip=2a00:1450:4864:20::12b; envelope-from=gerd.moellmann@gmail.com; helo=mail-lf1-x12b.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham 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:296978 Archived-At: --=-=-= Content-Type: text/plain Tags: patch Improvements: 1. Separators are displayed as lines over the whole menu, not only as "--". 2. Support for 3 types of separators: --space -> line of spaces, --double-line -> line of '=', others -> line of '-' In GNU Emacs 31.0.50 (build 15, aarch64-apple-darwin24.2.0) of 2024-12-13 built on pro2 Repository revision: 7bf7e339a4ae5b253623ee62b71ba50786339490 Repository branch: cl-packages System Description: macOS 15.2 Configured using: 'configure --without-ns --cache-file /var/folders/1d/k_6t25f94sl83szqbf8gpkrh0000gn/T//config.cache.cl-packages --with-native-compilation --with-mps=yes CC=clang 'CFLAGS=-Wgnu-imaginary-constant -Wunused-result -g -fno-omit-frame-pointer -F /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks -Wno-ignored-attributes -Wno-flag-enum -Wno-missing-method-return-type -Wno-variadic-macros -Wno-strict-prototypes -Wno-availability -Wno-nullability-completeness' --prefix=/Users/gerd/.local' --=-=-= Content-Type: text/patch Content-Disposition: attachment; filename=0001-Improve-menu-separator-display-on-ttys-slightly.patch >From 18e01b73e72b8aa36bd995d29317e9834c53f868 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gerd=20M=C3=B6llmann?= Date: Fri, 13 Dec 2024 15:54:21 +0100 Subject: [PATCH] Improve menu separator display on ttys slightly * src/xdisp.c (display_tty_menu_separator): New function displaying separators with '-', '=', or ' '. (display_tty_menu_item): Use it. --- src/xdisp.c | 44 +++++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/src/xdisp.c b/src/xdisp.c index 1bfc4bb1797..e9f9fcc16f6 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -27249,6 +27249,34 @@ deep_copy_glyph_row (struct frame *f, struct glyph_row *to, struct glyph_row *fr fill_up_frame_row_with_spaces (f, to, to_used); } +/* Produce glyphs for a menu separator on a tty. + + FIXME: This is only a "good enough for now" implementation of + menu separators as described in the Elisp info manual. We + should probably ignore menu separators when computing the width + of a menu. Secondly, we could draw actual horizontal lines of + different styles on ttys, maybe optionally using Unicode + characters via display table entries. Patches very welcome. */ + +static void +display_tty_menu_separator (struct it *it, const char *label, int width) +{ + static char sep[200]; + char c; + if (strcmp (label, "--space") == 0) + c = ' '; + else if (strcmp (label, "--double-line") == 0) + c = '='; + else + c = '-'; + memset (sep, c, sizeof sep); + sep[sizeof sep - 1] = 0; + display_string (sep, Qnil, Qnil, 0, 0, it, width - 1, width - 1, + FRAME_COLS (it->f) - 1, -1); + display_string (" ", Qnil, Qnil, 0, 0, it, 1, 0, + FRAME_COLS (it->f) - 1, -1); +} + /* Display one menu item on a TTY, by overwriting the glyphs in the frame F's desired glyph matrix with glyphs produced from the menu item text. Called from term.c to display TTY drop-down menus one @@ -27323,6 +27351,7 @@ display_tty_menu_item (const char *item_text, int width, int face_id, /* Pad with a space on the left. */ display_string (" ", Qnil, Qnil, 0, 0, &it, 1, 0, FRAME_COLS (f) - 1, -1); width--; + /* Display the menu item, pad with spaces to WIDTH. */ if (submenu) { @@ -27333,20 +27362,13 @@ display_tty_menu_item (const char *item_text, int width, int face_id, display_string (" >", Qnil, Qnil, 0, 0, &it, width, 0, FRAME_COLS (f) - 1, -1); } - else if (menu_separator_name_p (item_text)) + else if (menu_separator_name_p (item_text)) { - /* FIXME: This is only a "good enough for now" implementation of - menu separators as described in the Elisp info manual. We - should probably ignore menu separators when computing the width - of a menu. Secondly, we could draw actual horizontal lines of - different styles on ttys, maybe optionally using Unicode - characters via display table entries. Patches very welcome. */ - display_string ("--", Qnil, Qnil, 0, 0, &it, width, 0, - FRAME_COLS (f) - 1, -1); + display_tty_menu_separator (&it, item_text, width); } else - display_string (item_text, Qnil, Qnil, 0, 0, &it, - width, 0, FRAME_COLS (f) - 1, -1); + display_string (item_text, Qnil, Qnil, 0, 0, &it, width, 0, + FRAME_COLS (f) - 1, -1); row->used[TEXT_AREA] = max (saved_used, row->used[TEXT_AREA]); row->truncated_on_right_p = saved_truncated; -- 2.47.1 --=-=-=--