From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#74701: 31.0.50; vtable: cannot drag to resize columns when :use-header-line is nil Date: Sat, 21 Dec 2024 11:10:28 +0200 Message-ID: <86jzbt8kqj.fsf@gnu.org> References: <87jzcew69e.fsf@gmail.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="4231"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 74701@debbugs.gnu.org To: Visuwesh , adam@alphapapa.net Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Sat Dec 21 10:11:14 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 1tOvVy-0000wv-DF for geb-bug-gnu-emacs@m.gmane-mx.org; Sat, 21 Dec 2024 10:11:14 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1tOvVo-0004rd-59; Sat, 21 Dec 2024 04:11:04 -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 1tOvVm-0004rT-Pa for bug-gnu-emacs@gnu.org; Sat, 21 Dec 2024 04:11:02 -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 1tOvVm-0001ch-9A for bug-gnu-emacs@gnu.org; Sat, 21 Dec 2024 04:11:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=debbugs.gnu.org; s=debbugs-gnu-org; h=References:In-Reply-To:From:Date:To:Subject; bh=domLtGIBa1sj+F+eY0H6QNlKBjsaK3dL9cpoPmjWHac=; b=m4NKYVAKGhrn/xJ8EAVy10CCDKHgUSg4UohRFrJykdXaLqbzEWhkVrsOVRk4qTr9rI9xJyyCGCHbuMY9vIAHr7jZYddjqmyLO4bZ0zISskT6yKxNVvm8FxiYU58h9lWkUd2Ry7gAdvOY9cRGWIcDUoipLPydfJZXugjMYW6tHEuvnqr6K1PJtTx1mdmbE5XXRnrz3XVKW70dau1gGGLFp0I/gNIb/p7V+wb/4KyediVKMniMYX9yRwd5HmCWdAi1jGnuX9pDjFFrAt9ArDW6N7kKZG712pX1sI4AV23tnwk746xEXTr0aE3DcIIQa12NuYwz/sG1ZgYXT1hPfg+1gw==; Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1tOvVm-0006QI-3y for bug-gnu-emacs@gnu.org; Sat, 21 Dec 2024 04:11:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 21 Dec 2024 09:11:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 74701 X-GNU-PR-Package: emacs Original-Received: via spool by 74701-submit@debbugs.gnu.org id=B74701.173477224324649 (code B ref 74701); Sat, 21 Dec 2024 09:11:02 +0000 Original-Received: (at 74701) by debbugs.gnu.org; 21 Dec 2024 09:10:43 +0000 Original-Received: from localhost ([127.0.0.1]:45227 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tOvVS-0006PV-B9 for submit@debbugs.gnu.org; Sat, 21 Dec 2024 04:10:42 -0500 Original-Received: from eggs.gnu.org ([209.51.188.92]:58140) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1tOvVO-0006PD-67 for 74701@debbugs.gnu.org; Sat, 21 Dec 2024 04:10:40 -0500 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1tOvVI-0001ZG-Gs; Sat, 21 Dec 2024 04:10:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=domLtGIBa1sj+F+eY0H6QNlKBjsaK3dL9cpoPmjWHac=; b=AQWrxbAE/MMu b1QPBBHwc5k3ajlTjUjWys3jKw8S1it5pL6qKHbY+lQpiJcWh2fJ71ParB8Vxr4oDyZ3wHgLWshG0 aB9jv3iVTTT6qep4PbNkg5lG4YqoCYWvhurCzf750gPkGsmur34mKo0BFd3V4kyJqcjLyTeL8/Rzk AXu0AtxTHfOmRlbuh77i8ohIhSpm24J+MGF3FIF6UUuxZFJdZBijN+dSbDjmk3izH8X8M72qACZ90 60NjtPrN6+0sudRbBAeO7iHWnYZLUk/h+TmXfeu0Dorpi32kbOoe6h14FNL2Lv8pdLABGTNt5rKoK D6coF4JQvppxEGJkvuWW7Q==; In-Reply-To: <87jzcew69e.fsf@gmail.com> (message from Visuwesh on Thu, 05 Dec 2024 20:01:41 +0530) 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:297502 Archived-At: Adam, any comments? > Cc: Adam Porter > From: Visuwesh > 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 > - " " #'vtable--drag-resize-column > - " " #'ignore)) > - (dmap (define-keymap > - " " > - (lambda (e) > - (interactive "e") > - (vtable--drag-resize-column e t)) > - " " #'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 > + " " #'vtable--drag-resize-column > + " " #'ignore > + "" #'vtable--drag-resize-column > + "" #'ignore)) > + (dmap (define-keymap > + :parent vtable-header-line-map > + " " rev-resize-fun > + " " #'ignore > + "" rev-resize-fun > + "" #'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