aboutsummaryrefslogtreecommitdiffstats
path: root/lisp
diff options
context:
space:
mode:
authorSantiago Calandrino2022-08-24 13:54:28 +0200
committerLars Ingebrigtsen2022-08-24 13:55:28 +0200
commit044e11641bc0bfaf0d735bd57f04333f9616cfc7 (patch)
tree89110b8e09ca9e58f18a929e5e406711924645d3 /lisp
parentb400d7335b0d859b3823bcabc15e3a401fe7e2d0 (diff)
downloademacs-044e11641bc0bfaf0d735bd57f04333f9616cfc7.tar.gz
emacs-044e11641bc0bfaf0d735bd57f04333f9616cfc7.zip
Fix string padding in gdb-mi
* lisp/progmodes/gdb-mi.el (gdb-table): Fix string padding in gdb-mi (bug#57362). (gdb-pad-string): Unobsolete. (gdb-table-string): Re-fix string padding. Copyright-paperwork-exempt: yes
Diffstat (limited to 'lisp')
-rw-r--r--lisp/progmodes/gdb-mi.el15
1 files changed, 7 insertions, 8 deletions
diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el
index c256198b3c1..bab80719dbd 100644
--- a/lisp/progmodes/gdb-mi.el
+++ b/lisp/progmodes/gdb-mi.el
@@ -2943,8 +2943,7 @@ Return position where LINE begins."
2943 start-posn))) 2943 start-posn)))
2944 2944
2945(defun gdb-pad-string (string padding) 2945(defun gdb-pad-string (string padding)
2946 (declare (obsolete string-pad "29.1")) 2946 (string-pad string (abs padding) nil (natnump padding)))
2947 (string-pad string padding nil t))
2948 2947
2949;; gdb-table struct is a way to programmatically construct simple 2948;; gdb-table struct is a way to programmatically construct simple
2950;; tables. It help to reliably align columns of data in GDB buffers 2949;; tables. It help to reliably align columns of data in GDB buffers
@@ -2962,8 +2961,7 @@ When non-nil, PROPERTIES will be added to the whole row when
2962calling `gdb-table-string'." 2961calling `gdb-table-string'."
2963 (let ((rows (gdb-table-rows table)) 2962 (let ((rows (gdb-table-rows table))
2964 (row-properties (gdb-table-row-properties table)) 2963 (row-properties (gdb-table-row-properties table))
2965 (column-sizes (gdb-table-column-sizes table)) 2964 (column-sizes (gdb-table-column-sizes table)))
2966 (right-align (gdb-table-right-align table)))
2967 (when (not column-sizes) 2965 (when (not column-sizes)
2968 (setf (gdb-table-column-sizes table) 2966 (setf (gdb-table-column-sizes table)
2969 (make-list (length row) 0))) 2967 (make-list (length row) 0)))
@@ -2973,9 +2971,7 @@ calling `gdb-table-string'."
2973 (append row-properties (list properties))) 2971 (append row-properties (list properties)))
2974 (setf (gdb-table-column-sizes table) 2972 (setf (gdb-table-column-sizes table)
2975 (cl-mapcar (lambda (x s) 2973 (cl-mapcar (lambda (x s)
2976 (let ((new-x 2974 (max (abs x) (string-width (or s ""))))
2977 (max (abs x) (string-width (or s "")))))
2978 (if right-align new-x (- new-x))))
2979 (gdb-table-column-sizes table) 2975 (gdb-table-column-sizes table)
2980 row)) 2976 row))
2981 ;; Avoid trailing whitespace at eol 2977 ;; Avoid trailing whitespace at eol
@@ -2991,7 +2987,10 @@ calling `gdb-table-string'."
2991 (lambda (row properties) 2987 (lambda (row properties)
2992 (apply #'propertize 2988 (apply #'propertize
2993 (mapconcat #'identity 2989 (mapconcat #'identity
2994 (cl-mapcar (lambda (s x) (string-pad s x nil t)) 2990 (cl-mapcar (lambda (s x)
2991 (string-pad
2992 s x nil
2993 (not (gdb-table-right-align table))))
2995 row column-sizes) 2994 row column-sizes)
2996 sep) 2995 sep)
2997 properties)) 2996 properties))