From unknown Fri Jun 20 07:13:05 2025 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-Mailer: MIME-tools 5.509 (Entity 5.509) Content-Type: text/plain; charset=utf-8 From: bug#76008 <76008@debbugs.gnu.org> To: bug#76008 <76008@debbugs.gnu.org> Subject: Status: 31.0.50; visual-wrap-prefix-mode miscalculates prefix width when scaling text Reply-To: bug#76008 <76008@debbugs.gnu.org> Date: Fri, 20 Jun 2025 14:13:05 +0000 retitle 76008 31.0.50; visual-wrap-prefix-mode miscalculates prefix width w= hen scaling text reassign 76008 emacs submitter 76008 K=C3=A9vin Le Gouguec severity 76008 normal tag 76008 patch thanks From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 02 07:03:33 2025 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 ) id 1teYhJ-0007b9-Eu for submit@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 ) id 1teYhG-0007aJ-JY for submit@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 ) id 1teYh7-0003k2-Ea for bug-gnu-emacs@gnu.org; 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 ) id 1teYh5-0001VG-Qu for bug-gnu-emacs@gnu.org; Sun, 02 Feb 2025 07:03:21 -0500 Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-38c5ba0be37so156464f8f.2 for ; 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 (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?= To: bug-gnu-emacs@gnu.org Subject: 31.0.50; visual-wrap-prefix-mode miscalculates prefix width when scaling text X-Debbugs-Cc: Jim Porter Date: Sun, 02 Feb 2025 13:03:16 +0100 Message-ID: <877c681rln.fsf@gmail.com> MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=2a00:1450:4864:20::42c; envelope-from=kevin.legouguec@gmail.com; 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-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" 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 --=-=-=-- From debbugs-submit-bounces@debbugs.gnu.org Sun Feb 02 08:50:37 2025 Received: (at control) by debbugs.gnu.org; 2 Feb 2025 13:50:37 +0000 Received: from localhost ([127.0.0.1]:33597 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1teaMv-00072d-2N for submit@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 ) id 1teaMt-00072N-5r for control@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 ; 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 MIME-Version: 1.0 Date: Sun, 2 Feb 2025 05:50:28 -0800 X-Gm-Features: AWEUYZkAtbEDaJ2KxQWcfh7e5TswG_4O6gAdE05hdlDyWYmhG0vs6OPsIhg3_Y0 Message-ID: Subject: To: control@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@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: 1.0 (+) tags 76008 + patch thanks From debbugs-submit-bounces@debbugs.gnu.org Mon Feb 03 17:36:32 2025 Received: (at 76008) by debbugs.gnu.org; 3 Feb 2025 22:36:32 +0000 Received: from localhost ([127.0.0.1]:41708 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tf53Q-0004UQ-2Z for submit@debbugs.gnu.org; Mon, 03 Feb 2025 17:36:32 -0500 Received: from mail-pl1-x632.google.com ([2607:f8b0:4864:20::632]:54582) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tf53O-0004UA-CQ for 76008@debbugs.gnu.org; Mon, 03 Feb 2025 17:36:31 -0500 Received: by mail-pl1-x632.google.com with SMTP id d9443c01a7336-21670dce0a7so101936505ad.1 for <76008@debbugs.gnu.org>; Mon, 03 Feb 2025 14:36:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738622184; x=1739226984; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=oTRsqXV5ainzPKQX7gNYLIIXs7o2Nk55650DgP3dy1I=; b=nDHAZJzhS7MWlN/o1GJ9Xq4sDAmKAlCBcsdQC+Jn0HHyBR+OmYXw7LPnhPxqA6xC+g 9PtXr+dSBQNhPcPy5UMLo/3wmEeJqLtHctVRhf7kRWtWzdncRwC5ce1xLUfmXrxKG3qT Kwk0uWbR47e5/vJ/mUtkylF2g/eNLp0VVXh92qZntIKDR2YFQdLiVQJ5jq8lyW0A07tQ qthUpf5A9ulhu+WOvq7gu5w16Qm5mG1CyGzzWi0oH2a5L77L7K6SGNXPtRKNhp9CPiqS qnR9mi4MkrcK+7GxUflsf48Y6Fvacs6v/zsZ/KceDCMY7a+ik+9faI0y5HfMHFWa+9OT v1ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738622184; x=1739226984; h=content-transfer-encoding:in-reply-to:from:content-language :references:to:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=oTRsqXV5ainzPKQX7gNYLIIXs7o2Nk55650DgP3dy1I=; b=h4vtanWR+JfMDxR9KQsBNfljsncMuumY7w1IzDqzbGgfJw8B4KdUC5Q84CEShc6UYZ u0DPBcY2+KSCMY00bn7rGpt3i9qFKH8skoVbKINePWtE+bOtUSMh5308G74EM/9O0KEZ 3fV0AcF4j3V2owmUInFxjcpJMhdUMXkoe7T588n8BdmJFhE3V5qvnTez3Nsq6T+X0bde hAAqCu9TmXCL9DD0zBAYWDJGXvaId/07ennI2dIM/c3qSQQVK7xFimYSmfao4k3Qcn2G +YeUfCTW/6/8hAS02eyMPBcmiMj2WFhEpd6UXSUiAcw5qco5d8WNO0ME9h4cqutc5VLY 3GZw== X-Forwarded-Encrypted: i=1; AJvYcCXe2B6FrxkgzdsOsP6A6SpO87l9a79+7VqeqAPAWFszxob//oGSfa3EMJoJtUN1Dpt9i7EaIw==@debbugs.gnu.org X-Gm-Message-State: AOJu0YwLB4q0BKmMl4PfHkN9Qy9k9M4NQ+gKeeBzlqlPYzGZNcC/Ba9u 2zvt2Qrk0dAYIlCoIUoDXFSSKffHgnQm8BBvGNG2jGS0kkIjknKw X-Gm-Gg: ASbGncs0w6cFVw8U+E5jX36UWQ2F66amh5esGMlI7zzK7odvRJmjBhkiIZbqm0+DQIx BR3/er12WurMfDmom6Uucq4NfyUWO9W2gTZ/chkQNHkfatYErM/VFhab5T6deG6U9xyRHFwnLX/ OkWWw26vZ/fRSzPGa7EaHzPQhS/XZQ8bijd8vkKKrhbATV3H+OVTEsNch+I27VdgaI78pDLCVIS XXsoSJEfb6b3sNrETmoJ9jzc5AKUl+A91VBiAgyxUWMbplJ0MDiN6V8vehJkC/pwumLfV6YymEA yrsKQtTdWG6he1wpam7qva/bmxKU1r80S1bESjfQ3K4sIWGQ//QTdoQzFiBcEpvGKxym X-Google-Smtp-Source: AGHT+IGBBKnWG1phEJS3DddxOndGXOr0Iw5LAwWKemi90fvgJdhPkq3z26vYlVrS76Y/IHVAWJupkA== X-Received: by 2002:a17:902:f548:b0:216:2bd7:1c4a with SMTP id d9443c01a7336-21dd7d73da9mr356313075ad.26.1738622184220; Mon, 03 Feb 2025 14:36:24 -0800 (PST) Received: from [192.168.1.2] (syn-023-240-098-037.res.spectrum.com. [23.240.98.37]) by smtp.googlemail.com with ESMTPSA id d9443c01a7336-21de31ee380sm82362155ad.12.2025.02.03.14.36.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 03 Feb 2025 14:36:23 -0800 (PST) Message-ID: Date: Mon, 3 Feb 2025 14:36:23 -0800 MIME-Version: 1.0 Subject: Re: bug#76008: 31.0.50; visual-wrap-prefix-mode miscalculates prefix width when scaling text To: =?UTF-8?Q?K=c3=a9vin_Le_Gouguec?= , 76008@debbugs.gnu.org References: <877c681rln.fsf@gmail.com> Content-Language: en-US From: Jim Porter In-Reply-To: <877c681rln.fsf@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76008 X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 2/2/2025 4:03 AM, Kévin Le Gouguec wrote: > 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. I think the issue here is actually that the display spec for the "average space" was wrong. It used a plain number for the width of the specified space, which means "N times the normal character width for the buffer", but we want "N times the normal character width for the *current face*". Could you try this patch? ---------------------------------------- diff --git a/lisp/visual-wrap.el b/lisp/visual-wrap.el index 1691ba9c500..f2a186ce320 100644 --- a/lisp/visual-wrap.el +++ b/lisp/visual-wrap.el @@ -164,7 +164,7 @@ 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 . width))))) ;; 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) From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 04 01:50:20 2025 Received: (at 76008) by debbugs.gnu.org; 4 Feb 2025 06:50:21 +0000 Received: from localhost ([127.0.0.1]:42326 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tfClI-0002J1-KQ for submit@debbugs.gnu.org; Tue, 04 Feb 2025 01:50:20 -0500 Received: from mail-lj1-x22f.google.com ([2a00:1450:4864:20::22f]:41906) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tfClF-0002Il-Lx for 76008@debbugs.gnu.org; Tue, 04 Feb 2025 01:50:18 -0500 Received: by mail-lj1-x22f.google.com with SMTP id 38308e7fff4ca-307c1a12a25so1337751fa.3 for <76008@debbugs.gnu.org>; Mon, 03 Feb 2025 22:50:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738651811; x=1739256611; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:from:to:cc:subject :date:message-id:reply-to; bh=SSAPniZacmJgGpW9MEvI4WNfbtNi3tJoeDeQt6Qe3jk=; b=GkZgcbB4Z0jrYMzEc2nSXXxHsfK5NBqZx79Bo0yzhKhx48L2CZmBSm7dvGMl3jiYt3 WsFwYl4CoxhqfwiCgZdsdmNfJvsPemgATeEgrAK0eBcnwN7Mnv3K9Jdowkh/G5yEdJDr doM2tcigV8ad6/bt0XmhRVBRHpNprza0M5C8ToPIsxJxiLYUcLerHJOw6Xg3QJH2uaxv SKsDDOPiIuVujHOxmbZ4IBdbP1IvR+XIl+dYo6DPyhl40kFIBo+HxnfF3KhRfR7kwK+p lAn8xvSe20x7A7lj85CbHFt5/bEXdB54Opu/jgb+Hs2ze8rOUx3QD4/FJgsnfGOeTKel UEYQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738651811; x=1739256611; h=content-transfer-encoding:mime-version:user-agent:message-id :in-reply-to:date:references:subject:cc:to:from:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=SSAPniZacmJgGpW9MEvI4WNfbtNi3tJoeDeQt6Qe3jk=; b=Lg/Q2aB3h8RRotFZ0aHou7Fm7DAz4PGryP+Eg2GBtCZCtn+xczRSDhacECJNztX1Vp t7AtAfqhlkQLfGb/KtMR0hE1DBGXwUFifwa4DXjsRXhRXLsUxetj3Cb4/pPxm74/dLxS /gmjLMde0EWzFLSorhk7aYvKBzRJD5Jsb1/a8hiqJeaMAdwi0+4g8tSpT2a41HgQqtxA RA5MroYS7yiTpBR0iHisA5BJBFiVfmurOWlh6fOAiU7CfgPJSsaSnnaUUt89ZXgQqwgJ OA83qSBUOJ/DRQ4Fgxub3PcpllLoFbYWWYT/65u9pnFe1lGUUDgCX9u3Fn1HVbgV9ln1 sNNQ== X-Gm-Message-State: AOJu0Yw48HlttEkuw3oWX9/fiGSqbnd8zZyvRkWaL8Z7yYSzONqM80Xe hTeGAV0K+g1ZLhOVw3M8sgkL3C0KrnNwEhFjcJeivruYLDU3HtYqpczLSA== X-Gm-Gg: ASbGncvGBV2o0iHHaf1P6bSjFD2bdxTOhULiu7KYNxOSeBaB9NVtHlBgcm9c5rArIX/ fVPRzHKdZj9A0mRYFq7uJlFq69OjetkoKitlhmPL/5E/a2+T2VhGNiAUs8Js8S7I1IhZIIPsdYp AtlBRz2SAFfzkkXadpmOSw8ewKLbdzGm2CCtIlSpED14oFM3Thxbc31vc0Z5XpACrHiyta4nEAv 1rCWAKSpFsraG76DELVT2afnZ/LTvK0meekGrRbppqx0WIDK6w8JnF5QbZjaqc6mYwPYvxhKTA3 jYA2CrqpPcegtdwUq5H/HPaAnYwLJ3KQDhkDOB9dqc4YiNbJ X-Google-Smtp-Source: AGHT+IGLhJsC1N4PL00W7TeU3wq87/OwILag7Up1IF6OzJPd8ldhzeHwam7P7x5rBtHFKnHsyeuf2g== X-Received: by 2002:a05:6512:1195:b0:540:75d3:95ad with SMTP id 2adb3069b0e04-543ffa39e44mr293165e87.5.1738651810758; Mon, 03 Feb 2025 22:50:10 -0800 (PST) Received: from kevinlegouguec.net (kevinlegouguec.net. [151.80.149.237]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-543ebdf0fecsm1504508e87.41.2025.02.03.22.50.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 03 Feb 2025 22:50:09 -0800 (PST) From: =?utf-8?Q?K=C3=A9vin_Le_Gouguec?= To: Jim Porter Subject: Re: bug#76008: 31.0.50; visual-wrap-prefix-mode miscalculates prefix width when scaling text References: <877c681rln.fsf@gmail.com> Date: Tue, 04 Feb 2025 07:50:00 +0100 In-Reply-To: (Jim Porter's message of "Mon, 3 Feb 2025 14:36:23 -0800") Message-ID: <86v7tqi4pz.fsf@kevinlegouguec.net> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/28.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76008 Cc: 76008@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Jim Porter writes: > On 2/2/2025 4:03 AM, K=C3=A9vin Le Gouguec wrote: >> 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. I think the issue here is actually that the display spec for the = "average space" was wrong. It used a plain number for the width of the spec= ified space, which means "N times the normal character width for the buffer= ", but we want "N times the normal character width for the *current face*". =F0=9F=92=A1 > Could you try this patch? It does fix the reproducer, thanks! > ---------------------------------------- > > diff --git a/lisp/visual-wrap.el b/lisp/visual-wrap.el > index 1691ba9c500..f2a186ce320 100644 > --- a/lisp/visual-wrap.el > +++ b/lisp/visual-wrap.el > @@ -164,7 +164,7 @@ 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 . width))))) > ;; 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) From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 04 12:30:36 2025 Received: (at 76008-done) by debbugs.gnu.org; 4 Feb 2025 17:30:36 +0000 Received: from localhost ([127.0.0.1]:46520 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tfMku-0001gg-9V for submit@debbugs.gnu.org; Tue, 04 Feb 2025 12:30:36 -0500 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]:47541) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tfMks-0001gR-5f for 76008-done@debbugs.gnu.org; Tue, 04 Feb 2025 12:30:34 -0500 Received: by mail-pl1-x631.google.com with SMTP id d9443c01a7336-21ddab8800bso83783005ad.3 for <76008-done@debbugs.gnu.org>; Tue, 04 Feb 2025 09:30:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738690228; x=1739295028; darn=debbugs.gnu.org; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id:from:to:cc :subject:date:message-id:reply-to; bh=N+VpkmvQ9+ELAICJ16IOrs1MT0MHuuBhoQ+DruJQ5WY=; b=j5RdMEEGIMZNmBPBo0t/WMGgZe0/PutvmRKiHY6WsE8uaaETU0xgMcORSh7LTKKGh8 DgbkErIYhoS3nXBdwd84Ea5AZKDHU8P6Jswf55FTfuhtB8mHclaRavUnC7VqA7iDXSQn q0FwsrliOzaHvMkR4j407xju/HCfTjrvA+nOp0tOlfZ0uK4F2edfcmfo+lIrbqTyJQQw xTBxhtpYYlIndU+nOYn4A4/jnOVxGgpHCtFBQCvdI4Vdw2Db5Ve1RGiTlR0R+0brsCPt mNCmAl4iY852ywPgrOIjWGmxeUFECgvt3WFiUQky5CJHEG2Lygt4wLFgSlEybqnpyMoA 0Q9Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738690228; x=1739295028; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=N+VpkmvQ9+ELAICJ16IOrs1MT0MHuuBhoQ+DruJQ5WY=; b=N4phifazRjRuwF9v6Bucc+C9hYOWHlei5MtIDURVC6FgdjP5A1YBAlkbRTXjYrnB3v jWYtDL2b9987mNn4oRTpzBdEAsaPNWp1d5SFdWxFPdXNJwPP41jN2sjzB4JM++HRq8sJ PHJNErX5oLb6iNBNafxsIIlPW2LWkCeDuKac2laAXw6S5jlnPz3AvVWYR2HwqZfd4NJr dJKfm/OcYS7XL2xAyFfIrj+q2kYoiNyyRM1LfLcw5kUqCvgOivG96WhqVNNO4GqHiPXr 29EMgpUB5Li2Ug1EondF45xMsKqp1hlL0u0Rbl06Rvqde+IifNmuJALOH58K1bwF7VLD nQpg== X-Gm-Message-State: AOJu0YzkSNVV2aZem9JzMAr7u/LIQzh1TkQ8W4wp8+/QlFERoa5cgmmN z8eF0vuygtIY2ZeD1tdEKQJ0BLC7109p14o9wun3Toxve8pCzeCN X-Gm-Gg: ASbGncsWBNuWtpjEbZkvzvdW6HBgTiDCefDzfYFKs+V+B0sEYpd0my3u7RwPZ5DKcvV 7xp9hZiIifhiO855wGhZf1e3LVGD+zOL2zjsq0PZ8UiRiGg1EpMFHbEOo8y9sroHfydZK3N36sl 0wunX8JkjDHvxvuRriSvgJApJEGt4kxRk8iSI6Zh7hatkcmCA18E48isTTxHiUbhciL2bpqhPwj 1eAF6kzlZTnroTtdWM4tF4B6H2MEgbnGxtFI3g4YyFp+/nUFoH28H65UrPIt7Z89PhqIk4P4bED h3wQIbybEvjfoP3Ov8MyzLY6CI1IYdL0dyTXPnQ7Mod77zeqqcUCs2B4Aj3/JyohYHkG X-Google-Smtp-Source: AGHT+IFdw8HvNyDMHtoLqEHwvoxgGTKMarwekx3z4SNWmsG2IosU1ZArXhnGeOB04C2vTRbL7JrpfQ== X-Received: by 2002:a05:6a00:2e88:b0:725:df1a:288 with SMTP id d2e1a72fcca58-72fd0c74f49mr42178597b3a.24.1738690227865; Tue, 04 Feb 2025 09:30:27 -0800 (PST) Received: from [192.168.1.2] (syn-023-240-098-037.res.spectrum.com. [23.240.98.37]) by smtp.googlemail.com with ESMTPSA id d2e1a72fcca58-72fe631bf68sm10886006b3a.21.2025.02.04.09.30.27 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 04 Feb 2025 09:30:27 -0800 (PST) Message-ID: Date: Tue, 4 Feb 2025 09:30:29 -0800 MIME-Version: 1.0 Subject: Re: bug#76008: 31.0.50; visual-wrap-prefix-mode miscalculates prefix width when scaling text Content-Language: en-US To: =?UTF-8?Q?K=c3=a9vin_Le_Gouguec?= References: <877c681rln.fsf@gmail.com> <86v7tqi4pz.fsf@kevinlegouguec.net> From: Jim Porter In-Reply-To: <86v7tqi4pz.fsf@kevinlegouguec.net> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76008-done Cc: 76008-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) On 2/3/2025 10:50 PM, Kévin Le Gouguec wrote: > It does fix the reproducer, thanks! Thanks for checking. Merged to the master branch (with an additional bit of cleanup for shr.el) as 68424155774. Closing this now. From debbugs-submit-bounces@debbugs.gnu.org Tue Feb 04 13:43:38 2025 Received: (at 76008-done) by debbugs.gnu.org; 4 Feb 2025 18:43:38 +0000 Received: from localhost ([127.0.0.1]:46640 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tfNtZ-00053A-RT for submit@debbugs.gnu.org; Tue, 04 Feb 2025 13:43:38 -0500 Received: from mail-wm1-x32c.google.com ([2a00:1450:4864:20::32c]:40040) by debbugs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1tfNtW-00052r-K8 for 76008-done@debbugs.gnu.org; Tue, 04 Feb 2025 13:43:35 -0500 Received: by mail-wm1-x32c.google.com with SMTP id 5b1f17b1804b1-436230de7a3so7665625e9.0 for <76008-done@debbugs.gnu.org>; Tue, 04 Feb 2025 10:43:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1738694608; x=1739299408; darn=debbugs.gnu.org; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=J4wxGvkq7Hj7Tu/rOwLzBuWC6tzMz4EdiZ38s9vzCe4=; b=SNG0brlbbChTVSnDdiMQ5GX67zHgt0LdmMFv6eZ5Q94lqYkiTjyNCyWxID+3PZdCKj AAQKzNvwgjNSMMI9lKrnsElXGkJ+XUVOmj6i/gpnCXhXhlnmnE7AfpWDq2L1X9x4kAKb vgjA+zdy3SdWpqnB7KVnLR3zfcgAFKw+H2XoTmad9C3hM9Vmb8J/qjg1pnMovfjhyR0Q cnH3G6s25+biK7PeeTyN2xoWXmPTXNp2dJuW5nm9bpdOcKetsR6YdKsCLnun/ggyLpql jeTSMZkCs6C675KTsJpVh+2Yv5ztZffHNxSREARt1i93OxR/A726VQU6jFmWqCak1NHS yQug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1738694608; x=1739299408; h=content-transfer-encoding:mime-version:user-agent:message-id:date :references:in-reply-to:subject:cc:to:from:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=J4wxGvkq7Hj7Tu/rOwLzBuWC6tzMz4EdiZ38s9vzCe4=; b=gYStEyJwFI0lfhKhvQgd+bEaITNYQ+ZaKAtTHW7bdNIUstsm5mv1jfe1Z70xUgggOl +TIgRPGlA8Ywtk8XPSFSWJXEEZNAF4F7WcszhJ5YeUXtfOIRfGXFCNPISmKkHxXZAsFD R3Dq4oPmwZ4Mk1x57eVzHD4OKsQkJHJO0BFf/cvYtb4DYZTq5R6Ea8K9WBcHsMarG0p1 VZA64LNWofAV2vOR4DhLOsq615BenlMnlG59kf7LU5b+USpt1mD/O8NoCo3hGmMcFOpA q5m5GEovVpywMRMPXTpeajXtVyq3LsvCSnyDejZTg/sB+eWNU5yq3M27l3rvL96WnyKz ltqA== X-Gm-Message-State: AOJu0Yx+f67gN28WwxoVNFJP3/4KjPnE0XnJcOBKJc6aC6wds9ItffJ4 lvETkwrj1JtpaeHvYwRIhviGIHdp9GBRL/xIeZIzeNR0IwU2RCIgbHshbw== X-Gm-Gg: ASbGncu5HK3OoQE45wHhV9RQua8a7ughbaYmUyG9T0QSKjmod20iuTdKgZDALTDR8qC /xm7IgMp2cVr14Crp3rTa174iEflqqV6WtFY4DOOeGGbw+ofz0ECU2z9xGq4qCQ8kffE6fTb4ch OBrDpV+MWbYuHx5xMV1QrCz4gCO94Rnj7iMIjj9l7MRPfQy88P46Qxh+3/BEuBnx/r/icefQfJK ZO+ktTHx+B27cgyxUzBxglniOZnaHxkBP2ohaJWv9ZqNhan8KCGFtztXKvlG7yZgG0dyqyuz2GG YtqmePveuycDX48SbJI= X-Google-Smtp-Source: AGHT+IENjMk4MZAMbJbGMYogf3bH/iWA6ksIZ2OeAFSsUq6XET6ASm+nKmafaQA/AduLZ9PudwLjbw== X-Received: by 2002:a5d:5987:0:b0:38d:b3ad:ff65 with SMTP id ffacd0b85a97d-38db3ae02f4mr67939f8f.5.1738694608145; Tue, 04 Feb 2025 10:43:28 -0800 (PST) Received: from amdahl30 ([2a01:e0a:253:fe0:2ef0:5dff:fed2:7b49]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-38c5c1b57c1sm16606219f8f.75.2025.02.04.10.43.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Feb 2025 10:43:27 -0800 (PST) From: =?utf-8?Q?K=C3=A9vin_Le_Gouguec?= To: Jim Porter Subject: Re: bug#76008: 31.0.50; visual-wrap-prefix-mode miscalculates prefix width when scaling text In-Reply-To: (Jim Porter's message of "Tue, 4 Feb 2025 09:30:29 -0800") References: <877c681rln.fsf@gmail.com> <86v7tqi4pz.fsf@kevinlegouguec.net> Date: Tue, 04 Feb 2025 19:43:26 +0100 Message-ID: <87frkta6up.fsf@gmail.com> User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 76008-done Cc: 76008-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) Jim Porter writes: > On 2/3/2025 10:50 PM, K=C3=A9vin Le Gouguec wrote: >> It does fix the reproducer, thanks! > > Thanks for checking. Merged to the master branch (with an additional bit = of cleanup for shr.el) as 68424155774. Closing this now. Thank you for the quick fix! From unknown Fri Jun 20 07:13:05 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Wed, 05 Mar 2025 12:24:06 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator