X-Loop: help-debbugs@HIDDEN Subject: bug#76008: 31.0.50; visual-wrap-prefix-mode miscalculates prefix width when scaling text Resent-From: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec <kevin.legouguec@HIDDEN> Original-Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> Resent-CC: jporterbugs@HIDDEN, bug-gnu-emacs@HIDDEN Resent-Date: Sun, 02 Feb 2025 12:04:02 +0000 Resent-Message-ID: <handler.76008.B.173849781429215 <at> debbugs.gnu.org> Resent-Sender: help-debbugs@HIDDEN X-GNU-PR-Message: report 76008 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: To: 76008 <at> debbugs.gnu.org Cc: Jim Porter <jporterbugs@HIDDEN> X-Debbugs-Original-To: bug-gnu-emacs@HIDDEN X-Debbugs-Original-Xcc: Jim Porter <jporterbugs@HIDDEN> Received: via spool by submit <at> debbugs.gnu.org id=B.173849781429215 (code B ref -1); Sun, 02 Feb 2025 12:04:02 +0000 Received: (at submit) by debbugs.gnu.org; 2 Feb 2025 12:03:34 +0000 Received: from localhost ([127.0.0.1]:33412 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1teYhJ-0007b9-Eu for submit <at> debbugs.gnu.org; Sun, 02 Feb 2025 07:03:33 -0500 Received: from lists.gnu.org ([2001:470:142::17]:57104) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.84_2) (envelope-from <kevin.legouguec@HIDDEN>) id 1teYhG-0007aJ-JY for submit <at> debbugs.gnu.org; Sun, 02 Feb 2025 07:03:31 -0500 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 <kevin.legouguec@HIDDEN>) id 1teYh7-0003k2-Ea for bug-gnu-emacs@HIDDEN; Sun, 02 Feb 2025 07:03:22 -0500 Received: from mail-wr1-x42c.google.com ([2a00:1450:4864:20::42c]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from <kevin.legouguec@HIDDEN>) id 1teYh5-0001VG-Qu for bug-gnu-emacs@HIDDEN; Sun, 02 Feb 2025 07:03:21 -0500 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-38c5ba0be37so156464f8f.2 for <bug-gnu-emacs@HIDDEN>; Sun, 02 Feb 2025 04:03:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738497798; x=1739102598; darn=gnu.org; h=mime-version:message-id:date:subject:to:from:from:to:cc:subject :date:message-id:reply-to; bh=lLiicG7x9auAn0Iqe51Rw3QnrgS5XU6PWEGErCN5JxI=; b=QvAVlX8sUq4cEN29VR+T9kMXbkfp+Ijy4I+1bfo4bdrGgFarrdq9exFZSKf7FMzf+W pwh3WyPJHIx/ejKp8GQEC7laEtjuWjNrguSqN+Kg/bXflnwTSSAyWpS1xMaFp1TMaOAH E2Plv5MXgDLohOdNJBK5T1rpCcFnDvG73TVpPoqtYDHx8ybzl1SYTM+TpINjCLWCeAFY SP6TtoWu1j7xU2HqOjIzh4Bt2tSuny3B9PvFG60VqEuDIyg6/hBpWt64R+l5FQQ9iYds 0zhhXJHviXUPsKWsTvqi9errctv5UITcj8Ge4+JAuozcXtVQ+fVNBUnzpqZU5/eQ8qo6 yJTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738497798; x=1739102598; h=mime-version:message-id:date:subject:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=lLiicG7x9auAn0Iqe51Rw3QnrgS5XU6PWEGErCN5JxI=; b=UDnRVvaUYwvaKI+GoTP8P+H3df51nQP90Y2Ht1I5XstAGloVJtAFuGqr7LisvOAT14 wOEdNrAMYNxFSLTK3owLVcf/DllG28xyyhqBV+NV6aK1qWLm4GcHr6mys35dV4RUJ06g rvqVxyPKWYndI7wbAgWB5HujUjFu6ED51Ddr2/4Jt4Fzq03nVFJp7xcwOeY/JuoRZtPC 1BCVTvL4DdfmOnQuU6dDln0+YDUVbp4sXlU/4y4uFLsaHM/Gl5DcbggI41D9F0JRMDqc ZJtMI+0Tyrrw6CycBFCVhdGq5RjH7LW8zsNmLOytxm8A2YuQmae5QDA+vpABLSaFmo1C 0A2Q== X-Gm-Message-State: AOJu0YzTqEoDjFfbC/TKkbH2pAnX5k1phFTNeHW3sCBvwuKN0ZMjhpAz 6LHJa624eEapXvvdRAB02FQ13k9NCKADayAHz0JEr7iFSl3ZW/9/4p/alA== X-Gm-Gg: ASbGncsy+tnTo7VeU0532atzCefre/Z2gYSzUlSdWCsxvM5kQjpUi52hpxHmMGqrakD LMatNo0jVZn4LBOp8JnwG7epCEdwtk4Sw3Yz1vSxHPfC/RrBsr/ZxHBbE+NH/9WmTP3En7UGdAY KbC6JBgbnZW/YDBK0cf9SjjlsX7QKDLm+H9qewledfG+a/hO07TZ5XWNVo33hpI/KRMDbMALYIH clrKGWxaAi6pJbOgJn2UozXQOPpB3DSNnzfANUEi7n/Xb/v9cUDLKHGANbeCKqsI19r0jgwoSRp Oz3WC3HBQ8ETJoFqT5U= X-Google-Smtp-Source: AGHT+IFqGLbAyJDJ0Mv6aeVHJpO/Z/e8uFG8Z5faCOMDeP+zwuQDiSw3G+bTFg6Id6pJB5FXAOOy+Q== X-Received: by 2002:a05:6000:1544:b0:38d:9e86:2b24 with SMTP id ffacd0b85a97d-38d9e862bb7mr134687f8f.8.1738497797998; Sun, 02 Feb 2025 04:03:17 -0800 (PST) Received: from amdahl30 ([2a01:e0a:253:fe0:2ef0:5dff:fed2:7b49]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-438d7558ba2sm141240265e9.0.2025.02.02.04.03.17 for <bug-gnu-emacs@HIDDEN> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 02 Feb 2025 04:03:17 -0800 (PST) From: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec <kevin.legouguec@HIDDEN> Date: Sun, 02 Feb 2025 13:03:16 +0100 Message-ID: <877c681rln.fsf@HIDDEN> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=kevin.legouguec@HIDDEN; helo=mail-wr1-x42c.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-Spam-Score: 1.0 (+) X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: -0.0 (/) --=-=-= Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Heya! Steps to reproduce from emacs -Q: C-x C-f repro.rst C-x C-+ + [+=E2=80=A6] ; until e.g. "+6" - words M-x visual-wrap-prefix-mode Expectation: no visual change. Observation: the "- " prefix is propertized with=E2=80=A6 There are text properties here: display (min-width ((6 . width))) face rst-block fontified t wrap-prefix (space :align-to (6 . width)) =E2=80=A6 which makes the text look like this: - words I believe the cause lies in visual-wrap--content-prefix; empirically the attached patch shows good results on this reproducer, but I landed on it more by trial-and-error than by rational analysis, so it may be incorrect or suboptimal (e.g. there may be better text-scale or string-width APIs to use). Thanks for your time (& for the love & care visual-wrap has been receiving lately). --=-=-= Content-Type: text/x-patch Content-Disposition: attachment diff --git a/lisp/visual-wrap.el b/lisp/visual-wrap.el index 1691ba9c500..12404127190 100644 --- a/lisp/visual-wrap.el +++ b/lisp/visual-wrap.el @@ -33,6 +33,8 @@ ;;; Code: +(require 'face-remap) + (defcustom visual-wrap-extra-indent 0 "Number of extra spaces to indent in `visual-wrap-prefix-mode'. @@ -164,12 +166,16 @@ visual-wrap--content-prefix ;; units of the font's average-width) large enough to fit the ;; first-line prefix. (let ((avg-space (propertize (buffer-substring position (1+ position)) - 'display '(space :width 1)))) + 'display '(space :width 1))) + (scale (if text-scale-mode + (expt text-scale-mode-step text-scale-mode-amount) + 1))) ;; Remove any `min-width' display specs since we'll replace with ;; our own later in `visual-wrap--apply-to-line' (bug#73882). (add-display-text-property 0 (length prefix) 'min-width nil prefix) (max (string-width prefix) - (ceiling (string-pixel-width prefix (current-buffer)) + (ceiling (/ (string-pixel-width prefix (current-buffer)) + scale) (string-pixel-width avg-space (current-buffer)))))))) (defun visual-wrap-fill-context-prefix (beg end) --=-=-= Content-Type: text/plain Configured using: 'configure --prefix=/home/peniblec/apps/.emacs.2025-01-18 --with-cairo --with-native-compilation=no --with-sqlite3 --with-xinput2' Configured features: ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG LCMS2 LIBOTF LIBSELINUX LIBSYSTEMD LIBXML2 M17N_FLT MODULES NOTIFY INOTIFY PDUMPER PNG RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER WEBP X11 XDBE XIM XINPUT2 XPM GTK3 ZLIB Important settings: value of $LC_TIME: en_GB.UTF-8 value of $LANG: en_US.UTF-8 locale-coding-system: utf-8-unix --=-=-=--
Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.505 (Entity 5.505) Content-Type: text/plain; charset=utf-8 X-Loop: help-debbugs@HIDDEN From: help-debbugs@HIDDEN (GNU bug Tracking System) To: =?UTF-8?Q?K=C3=A9vin?= Le Gouguec <kevin.legouguec@HIDDEN> Subject: bug#76008: Acknowledgement (31.0.50; visual-wrap-prefix-mode miscalculates prefix width when scaling text) Message-ID: <handler.76008.B.173849781429215.ack <at> debbugs.gnu.org> References: <877c681rln.fsf@HIDDEN> X-Gnu-PR-Message: ack 76008 X-Gnu-PR-Package: emacs Reply-To: 76008 <at> debbugs.gnu.org Date: Sun, 02 Feb 2025 12:04:02 +0000 Thank you for filing a new bug report with debbugs.gnu.org. This is an automatically generated reply to let you know your message has been received. Your message is being forwarded to the package maintainers and other interested parties for their attention; they will reply in due course. As you requested using X-Debbugs-CC, your message was also forwarded to Jim Porter <jporterbugs@HIDDEN> (after having been given a bug report number, if it did not have one). Your message has been sent to the package maintainer(s): bug-gnu-emacs@HIDDEN If you wish to submit further information on this problem, please send it to 76008 <at> debbugs.gnu.org. Please do not send mail to help-debbugs@HIDDEN unless you wish to report a problem with the Bug-tracking system. --=20 76008: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=3D76008 GNU Bug Tracking System Contact help-debbugs@HIDDEN with problems
Received: (at control) by debbugs.gnu.org; 2 Feb 2025 13:50:37 +0000 From debbugs-submit-bounces <at> debbugs.gnu.org Sun Feb 02 08:50:37 2025 Received: from localhost ([127.0.0.1]:33597 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>) id 1teaMv-00072d-2N for submit <at> debbugs.gnu.org; Sun, 02 Feb 2025 08:50:37 -0500 Received: from mail-ed1-x52d.google.com ([2a00:1450:4864:20::52d]:49235) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from <stefankangas@HIDDEN>) id 1teaMt-00072N-5r for control <at> debbugs.gnu.org; Sun, 02 Feb 2025 08:50:35 -0500 Received: by mail-ed1-x52d.google.com with SMTP id 4fb4d7f45d1cf-5d982de9547so6787069a12.2 for <control <at> debbugs.gnu.org>; Sun, 02 Feb 2025 05:50:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738504229; x=1739109029; darn=debbugs.gnu.org; h=to:subject:message-id:date:mime-version:from:from:to:cc:subject :date:message-id:reply-to; bh=XHRSdyV63LOeizxFL60mPGH1V5mFbyC3ViPjwHUinj8=; b=JVhZMFXzsmGzU23mN0f+DuBVQ9V6fNP7uGAUm5SUaOHWJwapuvbTKGiBb7BvScqoc4 3gnkOgmZPIBF0PSBLPonPs6FAmTYOwuSUwWW6rDt2KLoOh5D3guWCMcmLYqKRyqHxm7s dqpRj8buBiFC6dY+JWZbkL5NU0qNjYmQTK1noEmElCuhmg+jQysXQiXFlGAxW3KtVE5R XvBJ5qy7h1KBFJORwpC3i8Go9K1dL5k78CQZ6PYXGE0HmD0216aakcwe8BD2eCXUfiTp PeDbzT86GKAT7Y1S/hZ23H84A11CJDk9CkYq5FpnkoLRodTQJMQXtk8KambqANVa5ypj YF8w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738504229; x=1739109029; h=to:subject:message-id:date:mime-version:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=XHRSdyV63LOeizxFL60mPGH1V5mFbyC3ViPjwHUinj8=; b=wcMB3rQT1w0B6N2EIrsU87jHooUnHhbsFbuH4ZubYHyttjPfZZjA0zIuL+nKDJ4pEt lM7Ly5CwYkiP/vll3ZR9K1Csz8w2yfcgFElcp1LywM6UOnUM0fMu313H7kYblqJTaubD 3lj5w73JIavzmifS0r7RKVD3xm8OIDx4/quS7799O2YjcspvUPvW5v+OySJTU+BanBGf uXksO/n1KUYxPjz2fTMIK3hWicO+7lyYOjMb1M6n9AWZBd29WSjIXkxn4x/v3d8nkyGU 09apKAPaU4mhquG9DXfvpvO1ItGFKrr+1PWU4LLWfsRW0ioFf7fP2I47FMtwfIdd3d4M C9lQ== X-Gm-Message-State: AOJu0YwklaIkW5OUhGrfyyiHXyZ2gf+z7xTkC86M4OuGuqbSu0cnZUjm 2HY7BV5lRnpSStGjvXs8PaHbJQnH2E38KL7ULFziFUSWOtoHiVAvTBsVyKXraTlL9uyvZPfFiOS ktj8pXyBIszpRjYdFyJXoo9E7ik03rajpVs0= X-Gm-Gg: ASbGnct3PKpeNaWLET8IsIOn8/7dn7ls5bQ8TUqFAABtbVityfYCKgDYEQsxV5zQH9L U9HXslE7EeKz7MEEB0pvKeuLdMlRFLdlMsW19feUo06E79MIljDBvihsf5mc1siXN/HIbESYRdw == X-Google-Smtp-Source: AGHT+IER1bkh0rhhNRX+mDE7OtEAGVEZ52zoCejcCMVmTGv3RU/VuFFOtqpr4cR8s1jb6cHLIrLo0gcLCIsZew1z3kU= X-Received: by 2002:a05:6402:2481:b0:5dc:8b8b:3517 with SMTP id 4fb4d7f45d1cf-5dc8b8b38b1mr8987815a12.17.1738504229051; Sun, 02 Feb 2025 05:50:29 -0800 (PST) Received: from 753933720722 named unknown by gmailapi.google.com with HTTPREST; Sun, 2 Feb 2025 05:50:28 -0800 From: Stefan Kangas <stefankangas@HIDDEN> MIME-Version: 1.0 Date: Sun, 2 Feb 2025 05:50:28 -0800 X-Gm-Features: AWEUYZkAtbEDaJ2KxQWcfh7e5TswG_4O6gAdE05hdlDyWYmhG0vs6OPsIhg3_Y0 Message-ID: <CADwFkmnDGR=vb4CVzjg74UO57LjZHepBM7vcROVLoveNbz1q-g@HIDDEN> Subject: To: control <at> debbugs.gnu.org Content-Type: text/plain; charset="UTF-8" X-Spam-Score: 2.0 (++) X-Spam-Report: Spam detection software, running on the system "debbugs.gnu.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: tags 76008 + patch thanks Content analysis details: (2.0 points, 10.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:52d listed in] [list.dnswl.org] 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (stefankangas[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines 2.0 BLANK_SUBJECT Subject is present but empty X-Debbugs-Envelope-To: control X-BeenThere: debbugs-submit <at> debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: <debbugs-submit.debbugs.gnu.org> List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe> List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/> List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org> List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help> List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe> Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org> X-Spam-Score: 1.0 (+) tags 76008 + patch thanks
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997 nCipher Corporation Ltd,
1994-97 Ian Jackson.