all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* bug#73882: 31.0.50; global-visual-wrap-prefix-mode misaligns org tables
@ 2024-10-19  9:52 Arthur Elsenaar
  2024-10-19 23:14 ` Jim Porter
  0 siblings, 1 reply; 3+ messages in thread
From: Arthur Elsenaar @ 2024-10-19  9:52 UTC (permalink / raw)
  To: 73882


[-- Attachment #1.1.1: Type: text/plain, Size: 5378 bytes --]

With emacs -q, an org file is loaded with this content:

:PROPERTIES:
:ID:       20241018T232141
:END:
#+title: test
#+date: [2024-10-18 Fri 23:22]
#+filetags: project

* Test 123

| head  | 1 | 2 | 3 | 4 |
|-------+---+---+---+---|
| apple |   |   |   |   |
| orange |   |   |   |   |
| pear  |   |   |   |   |
| banana |   |   |   |   |

Table cells are misaligned.
When one hits <tab> within a cell, the cells align. However when
global-visual-wrap-prefix-mode is enabled, the cells get
misaligned. It appears a character in the first column gets attributes
added that makes the character span more than one space.

In GNU Emacs 31.0.50 (build 1, x86_64-pc-linux-gnu, GTK+ Version
 3.24.33, cairo version 1.16.0) of 2024-10-04 built on lae
Repository revision: 1094c3f91477e622e064fa52de7fd0f361e54d9b
Repository branch: master
System Description: Pop!_OS 22.04 LTS

Configured using:
 'configure --with-cairo --with-file-notification=inotify --with-gnutls
 --with-harfbuzz --with-mailutils --with-native-compilation --with-pgtk
 --with-tree-sitter=ifavailable --with-rsvg --with-xwidgets=no
 --with-x=yes --with-x-toolkit=yes --with-xinput2'

Configured features:
CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GSETTINGS HARFBUZZ JPEG LCMS2
LIBSELINUX LIBXML2 MODULES NATIVE_COMP NOTIFY INOTIFY PDUMPER PGTK PNG
RSVG SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS TREE_SITTER
XIM GTK3 ZLIB

Important settings:
  value of $LC_MONETARY: en_GB.UTF-8
  value of $LC_NUMERIC: en_GB.UTF-8
  value of $LC_TIME: en_GB.UTF-8
  value of $LANG: en_GB.UTF-8
  locale-coding-system: utf-8-unix

Major mode: Org

Minor modes in effect:
  global-visual-wrap-prefix-mode: t
  visual-wrap-prefix-mode: t
  tooltip-mode: t
  global-eldoc-mode: t
  show-paren-mode: t
  electric-indent-mode: t
  mouse-wheel-mode: t
  tool-bar-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
  font-lock-mode: t
  blink-cursor-mode: t
  minibuffer-regexp-mode: t
  line-number-mode: t
  indent-tabs-mode: t
  transient-mark-mode: t
  auto-composition-mode: t
  auto-encryption-mode: t
  auto-compression-mode: t

Load-path shadows:
None found.

Features:
(shadow sort mail-extr emacsbug visual-wrap oc-basic cl-extra help-mode
org-element org-persist org-id org-refile org-element-ast inline
avl-tree generator ol-eww eww xdg url-queue mm-url ol-rmail ol-mhe
ol-irc ol-info ol-gnus nnselect gnus-art mm-uu mml2015 mm-view mml-smime
smime gnutls dig gnus-sum shr pixel-fill kinsoku url-file svg dom
gnus-group gnus-undo gnus-start gnus-dbus dbus compile comp-run
comp-common xml gnus-cloud nnimap nnmail browse-url url url-proxy
url-privacy url-expand url-methods url-history url-cookie
generate-lisp-file url-domsuf url-util url-parse auth-source cl-seq
eieio eieio-core cl-macs json map url-vars mail-source utf7 nnoo
parse-time gnus-spec gnus-int gnus-range message sendmail mailcap
yank-media puny rfc822 mml mml-sec password-cache epa derived epg
rfc6068 epg-config mm-decode mm-bodies mm-encode mail-parse rfc2231
rfc2047 rfc2045 ietf-drums mailabbrev gmm-utils mailheader gnus-win gnus
nnheader gnus-util text-property-search mail-utils range mm-util
mail-prsvr wid-edit ol-docview doc-view byte-opt gv bytecomp
byte-compile filenotify jka-compr image-mode exif dired dired-loaddefs
ol-bibtex bibtex iso8601 ol-bbdb ol-w3m ol-doi org-link-doi org ob
ob-tangle ob-ref ob-lob ob-table ob-exp org-macro org-src sh-script smie
treesit executable ob-comint org-pcomplete pcomplete comint ansi-osc
ansi-color ring org-list org-footnote org-faces org-entities time-date
subr-x noutline outline icons org-version ob-emacs-lisp ob-core ob-eval
org-cycle org-table ol rx org-fold org-fold-core org-keys oc
org-loaddefs thingatpt find-func cal-menu calendar cal-loaddefs
org-compat org-macs format-spec cl-loaddefs cl-lib rmc iso-transl
tooltip cconv eldoc paren electric uniquify ediff-hook vc-hooks
lisp-float-type elisp-mode mwheel term/pgtk-win pgtk-win term/common-win
touch-screen pgtk-dnd tool-bar dnd fontset image regexp-opt fringe
tabulated-list replace newcomment text-mode lisp-mode prog-mode register
page tab-bar menu-bar rfn-eshadow isearch easymenu timer select
scroll-bar mouse jit-lock font-lock syntax font-core term/tty-colors
frame minibuffer nadvice seq simple cl-generic indonesian philippine
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite emoji-zwj charscript
charprop case-table epa-hook jka-cmpr-hook help abbrev obarray oclosure
cl-preloaded button loaddefs theme-loaddefs faces cus-face macroexp
files window text-properties overlay sha1 md5 base64 format env
code-pages mule custom widget keymap hashtable-print-readable backquote
threads dbusbind inotify dynamic-setting system-font-setting
font-render-setting cairo gtk pgtk lcms2 multi-tty move-toolbar
make-network-process native-compile emacs)

Memory information:
((conses 16 369829 25100) (symbols 48 21220 0)
 (strings 32 114566 3265) (string-bytes 1 3516689) (vectors 16 61904)
 (vector-slots 8 640205 12633) (floats 8 594 2) (intervals 56 1144 16)
 (buffers 992 17))

[-- Attachment #1.1.2.1: Type: text/html, Size: 8463 bytes --]

[-- Attachment #1.2: publickey - arthur@artelse.com - 0x17DAB272.asc --]
[-- Type: application/pgp-keys, Size: 1718 bytes --]

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 509 bytes --]

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

* bug#73882: 31.0.50; global-visual-wrap-prefix-mode misaligns org tables
  2024-10-19  9:52 bug#73882: 31.0.50; global-visual-wrap-prefix-mode misaligns org tables Arthur Elsenaar
@ 2024-10-19 23:14 ` Jim Porter
  2024-10-20  4:31   ` Jim Porter
  0 siblings, 1 reply; 3+ messages in thread
From: Jim Porter @ 2024-10-19 23:14 UTC (permalink / raw)
  To: Arthur Elsenaar, 73882

[-- Attachment #1: Type: text/plain, Size: 587 bytes --]

On 10/19/2024 2:52 AM, Arthur Elsenaar wrote:
> | head  | 1 | 2 | 3 | 4 |
> |-------+---+---+---+---|
> | apple |   |   |   |   |
> | orange |   |   |   |   |
> | pear  |   |   |   |   |
> | banana |   |   |   |   |
> 
> Table cells are misaligned.
> When one hits <tab> within a cell, the cells align. However when
> global-visual-wrap-prefix-mode is enabled, the cells get
> misaligned. It appears a character in the first column gets attributes
> added that makes the character span more than one space.

Thanks for noticing. This patch should do the trick, I think.

[-- Attachment #2: 0001-Fix-min-width-calculation-in-visual-wrap-prefix-mode.patch --]
[-- Type: text/plain, Size: 1515 bytes --]

From 727abc3fbb8d43de78a9acf47aa4fb3a97bbb21a Mon Sep 17 00:00:00 2001
From: Jim Porter <jporterbugs@gmail.com>
Date: Sat, 19 Oct 2024 16:12:43 -0700
Subject: [PATCH] Fix 'min-width' calculation in 'visual-wrap-prefix-mode'

* lisp/visual-wrap.el (visual-wrap--content-prefix): Remove 'min-width'
before computing the pixel width to avoid miscalculation (bug#73882).
---
 lisp/visual-wrap.el | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/lisp/visual-wrap.el b/lisp/visual-wrap.el
index 76276c0f474..fa128d287a4 100644
--- a/lisp/visual-wrap.el
+++ b/lisp/visual-wrap.el
@@ -165,9 +165,12 @@ visual-wrap--content-prefix
     ;; first-line prefix.
     (let ((avg-space (propertize (buffer-substring position (1+ position))
                                  'display '(space :width 1))))
-        (max (string-width prefix)
-             (ceiling (string-pixel-width prefix (current-buffer))
-                      (string-pixel-width avg-space (current-buffer))))))))
+      ;; 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))
+                    (string-pixel-width avg-space (current-buffer))))))))
 
 (defun visual-wrap-fill-context-prefix (beg end)
   "Compute visual wrap prefix from text between BEG and END.
-- 
2.25.1


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

* bug#73882: 31.0.50; global-visual-wrap-prefix-mode misaligns org tables
  2024-10-19 23:14 ` Jim Porter
@ 2024-10-20  4:31   ` Jim Porter
  0 siblings, 0 replies; 3+ messages in thread
From: Jim Porter @ 2024-10-20  4:31 UTC (permalink / raw)
  To: Arthur Elsenaar, 73882-done

On 10/19/2024 4:14 PM, Jim Porter wrote:
> Thanks for noticing. This patch should do the trick, I think.

Confirmed offline that this patch fixes things. Since it's pretty 
simple, I've now merged it as 81a5beb8af0, though of course if anyone 
sees further issues with visual-wrap-prefix-mode, just let me know.





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

end of thread, other threads:[~2024-10-20  4:31 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-10-19  9:52 bug#73882: 31.0.50; global-visual-wrap-prefix-mode misaligns org tables Arthur Elsenaar
2024-10-19 23:14 ` Jim Porter
2024-10-20  4:31   ` Jim Porter

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.