(require 'cl-seq)
(require 'bindat)
(eval-when-compile (require 'pcase))
+(require 'subr-x) ; `string-pad'
(declare-function speedbar-change-initial-expansion-list
"speedbar" (new-default))
start-posn)))
(defun gdb-pad-string (string padding)
- (format (concat "%" (number-to-string padding) "s") string))
+ (declare (obsolete string-pad "29.1"))
+ (string-pad string padding nil t))
;; gdb-table struct is a way to programmatically construct simple
;; tables. It help to reliably align columns of data in GDB buffers
"Return TABLE as a string with columns separated with SEP."
(let ((column-sizes (gdb-table-column-sizes table)))
(mapconcat
- 'identity
+ #'identity
(cl-mapcar
(lambda (row properties)
- (apply 'propertize
- (mapconcat 'identity
- (cl-mapcar (lambda (s x) (gdb-pad-string s x))
- row column-sizes)
+ (apply #'propertize
+ (mapconcat #'identity
+ (cl-mapcar (lambda (s x) (string-pad s x nil t))
+ row column-sizes)
sep)
properties))
(gdb-table-rows table)
(dolist (row memory)
(insert (concat (gdb-mi--field row 'addr) ":"))
(dolist (column (gdb-mi--field row 'data))
- (insert (gdb-pad-string column
- (+ 2 (gdb-memory-column-width
- gdb-memory-unit
- gdb-memory-format)))))
+ (insert (string-pad column
+ (+ 2 (gdb-memory-column-width
+ gdb-memory-unit
+ gdb-memory-format))
+ nil t)))
(newline)))
;; Show last page instead of empty buffer when out of bounds
(when gdb-memory-last-address