Package: emacs;
Reported by: Visuwesh <visuweshm <at> gmail.com>
Date: Thu, 5 Dec 2024 14:33:01 UTC
Severity: normal
Found in version 31.0.50
Message #11 received at 74701 <at> debbugs.gnu.org (full text, mbox):
From: Eli Zaretskii <eliz <at> gnu.org> To: adam <at> alphapapa.net Cc: 74701 <at> debbugs.gnu.org, visuweshm <at> gmail.com Subject: Re: bug#74701: 31.0.50; vtable: cannot drag to resize columns when :use-header-line is nil Date: Sat, 28 Dec 2024 12:53:35 +0200
Ping! > Cc: 74701 <at> debbugs.gnu.org > Date: Sat, 21 Dec 2024 11:10:28 +0200 > From: Eli Zaretskii <eliz <at> gnu.org> > > Adam, any comments? > > > Cc: Adam Porter <adam <at> alphapapa.net> > > From: Visuwesh <visuweshm <at> gmail.com> > > Date: Thu, 05 Dec 2024 20:01:41 +0530 > > > > When creating a vtable with :use-header-line nil (see below), dragging > > the column or the divider to resize the column is impossible because > > > > 1. the function vtable--insert-header-line does not create the keymap > > so that non-header-line mouse bindings actually resize the column > > 2. after inserting the header-line, vtable-insert completely > > overwrites the keymap text-property which wipes out the keymap > > setup by vtable--insert-header-line > > > > To reproduce, > > > > 1. emacs -Q > > 2. Evaluate the following sexp > > > > (with-current-buffer (get-buffer-create "asd") > > (erase-buffer) > > (require 'vtable) > > (make-vtable > > :use-header-line nil > > :columns '("One" "Two") > > :objects '((1 2) (3 4) (5 6))) > > (pop-to-buffer (current-buffer))) > > 3. Try to resize the column "Two" ("T" is shown here) by clicking on > > "T" and dragging the pointer. > > 4. Witness no column resize. > > 5. Now, change :use-header-line to t and try to resize again. > > 6. Witness column resize. > > > > The patch below fixes the issue on my end > > > > > > diff --git a/lisp/emacs-lisp/vtable.el b/lisp/emacs-lisp/vtable.el > > index c4f14d7b4b2..6f04eca3da8 100644 > > --- a/lisp/emacs-lisp/vtable.el > > +++ b/lisp/emacs-lisp/vtable.el > > @@ -544,7 +544,7 @@ vtable-insert > > ;; them). > > (vtable--insert-header-line table widths spacer) > > (add-text-properties start (point) > > - (list 'keymap vtable-header-line-map > > + (list ;;'keymap vtable-header-line-map > > 'rear-nonsticky t > > 'vtable table)) > > (setq start (point)))) > > @@ -706,24 +706,34 @@ vtable--indicator > > > > (defun vtable--insert-header-line (table widths spacer) > > ;; Insert the header directly into the buffer. > > - (let ((start (point)) > > - (divider (vtable-divider table)) > > - (cmap (define-keymap > > - "<header-line> <drag-mouse-1>" #'vtable--drag-resize-column > > - "<header-line> <down-mouse-1>" #'ignore)) > > - (dmap (define-keymap > > - "<header-line> <drag-mouse-1>" > > - (lambda (e) > > - (interactive "e") > > - (vtable--drag-resize-column e t)) > > - "<header-line> <down-mouse-1>" #'ignore))) > > + (let* ((start (point)) > > + (divider (vtable-divider table)) > > + (rev-resize-fun (lambda (e) > > + (interactive "e") > > + (vtable--drag-resize-column e t))) > > + (cmap (define-keymap > > + :parent vtable-header-line-map > > + "<header-line> <drag-mouse-1>" #'vtable--drag-resize-column > > + "<header-line> <down-mouse-1>" #'ignore > > + "<drag-mouse-1>" #'vtable--drag-resize-column > > + "<down-mouse-1>" #'ignore)) > > + (dmap (define-keymap > > + :parent vtable-header-line-map > > + "<header-line> <drag-mouse-1>" rev-resize-fun > > + "<header-line> <down-mouse-1>" #'ignore > > + "<drag-mouse-1>" rev-resize-fun > > + "<down-mouse-1>" #'ignore))) > > (seq-do-indexed > > (lambda (column index) > > (let* ((name (propertize > > (vtable-column-name column) > > 'face (list 'header-line (vtable-face table)) > > 'mouse-face 'header-line-highlight > > - 'keymap cmap)) > > + ;; Reverse resizing is more intuitive for the first > > + ;; column. > > + 'keymap (if (= index 0) > > + dmap > > + cmap))) > > (start (point)) > > (indicator (vtable--indicator table index)) > > (indicator-width (string-pixel-width indicator)) > > > > > > I also took the liberty to make one other change: > > > > I use DMAP instead of CMAP for the first column. Without this > > change, dragging the first column does nothing. With this change, > > dragging the first column to the left will increase its size. I > > think this behaviour is more intuitive than doing nothing. > > > > In GNU Emacs 31.0.50 (build 25, x86_64-pc-linux-gnu, X toolkit, cairo > > version 1.18.2, Xaw scroll bars) of 2024-11-10 built on astatine > > Repository revision: 1704fa4fb4164a15c7e258b922dbba190811d92d > > Repository branch: master > > Windowing system distributor 'The X.Org Foundation', version 11.0.12101014 > > System Description: Debian GNU/Linux trixie/sid > > > > Configured using: > > 'configure --with-sound=alsa --with-x-toolkit=lucid --without-xaw3d > > --without-gconf --without-libsystemd --with-cairo CFLAGS=-g3' > > Configured features: > > ACL CAIRO DBUS FREETYPE GIF GLIB GMP GNUTLS GPM GSETTINGS HARFBUZZ JPEG > > LCMS2 LIBOTF LIBSELINUX LIBXML2 MODULES NOTIFY INOTIFY PDUMPER PNG RSVG > > SECCOMP SOUND SQLITE3 THREADS TIFF TOOLKIT_SCROLL_BARS WEBP X11 XDBE XIM > > XINPUT2 XPM LUCID ZLIB > > Important settings: > > value of $LC_MONETARY: ta_IN.UTF-8 > > value of $LC_NUMERIC: ta_IN.UTF-8 > > value of $LANG: en_GB.UTF-8 > > locale-coding-system: utf-8-unix > > > >
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.