From 4f238c72acbc15eaee7ed7cd19c3aeac19a55a7b Mon Sep 17 00:00:00 2001 From: Gustaf Waldemarson Date: Tue, 29 Nov 2022 23:40:23 +0100 Subject: [PATCH] gdb-mi.el: Swap type and name column in locals. Additionally, truncate the column lengths and add the full length as a help-text (tooltip). --- lisp/progmodes/gdb-mi.el | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index e8d8f9104e4..197d133f0ee 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el @@ -4355,6 +4355,19 @@ gdb-locals-value-limit :group 'gud :version "29.1") +(defcustom gdb-locals-max-type-length 20 + "Maximum number of character to display in the local variables type column." + :type 'integer + :group 'gud + :version "30.0") + +(defcustom gdb-locals-max-name-length 20 + "Maximum number of character to display in the local variables name column." + :type 'integer + :group 'gud + :version "30.0") + + (defvar gdb-locals-values-table (make-hash-table :test #'equal) "Mapping of local variable names to a string with their value.") @@ -4431,11 +4444,16 @@ gdb-locals-handler-custom help-echo "mouse-2: edit value" local-map ,gdb-edit-locals-map-1) value)) + (setf (gdb-table-right-align table) t) (gdb-table-add-row table (list - (propertize type 'font-lock-face font-lock-type-face) - (propertize name 'font-lock-face font-lock-variable-name-face) + (propertize (string-truncate-left name gdb-locals-max-name-length) + 'font-lock-face font-lock-variable-name-face + 'help-echo name) + (propertize (string-truncate-left type gdb-locals-max-type-length) + 'font-lock-face font-lock-type-face + 'help-echo type) value) `(gdb-local-variable ,local)))) (insert (gdb-table-string table " ")) -- 2.34.1