From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Santiago Calandrino via "Bug reports for GNU Emacs, the Swiss army knife of text editors" Newsgroups: gmane.emacs.bugs Subject: bug#57362: [PATCH] Fix string padding in gdb-mi Date: Tue, 23 Aug 2022 12:26:22 -0300 Message-ID: <878rnf560z.fsf@disroot.org> Reply-To: Santiago Calandrino Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="17414"; mail-complaints-to="usenet@ciao.gmane.io" To: 57362@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Aug 23 19:30:17 2022 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 1oQXjE-0004J4-U6 for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 23 Aug 2022 19:30:17 +0200 Original-Received: from localhost ([::1]:57600 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1oQXjD-0003lM-Pf for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 23 Aug 2022 13:30:15 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:35540) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQXj2-0003l4-2C for bug-gnu-emacs@gnu.org; Tue, 23 Aug 2022 13:30:04 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:55233) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1oQXj1-00043B-PA for bug-gnu-emacs@gnu.org; Tue, 23 Aug 2022 13:30:03 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1oQXj1-000179-K2 for bug-gnu-emacs@gnu.org; Tue, 23 Aug 2022 13:30:03 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Santiago Calandrino Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 23 Aug 2022 17:30:03 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 57362 X-GNU-PR-Package: emacs X-GNU-PR-Keywords: patch X-Debbugs-Original-To: bug-gnu-emacs@gnu.org Original-Received: via spool by submit@debbugs.gnu.org id=B.16612757724098 (code B ref -1); Tue, 23 Aug 2022 17:30:03 +0000 Original-Received: (at submit) by debbugs.gnu.org; 23 Aug 2022 17:29:32 +0000 Original-Received: from localhost ([127.0.0.1]:44980 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQXiW-000142-B8 for submit@debbugs.gnu.org; Tue, 23 Aug 2022 13:29:32 -0400 Original-Received: from lists.gnu.org ([209.51.188.17]:52894) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1oQVuL-0004Qz-9S for submit@debbugs.gnu.org; Tue, 23 Aug 2022 11:33:37 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:38700) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQVuH-0002gP-Jg for bug-gnu-emacs@gnu.org; Tue, 23 Aug 2022 11:33:37 -0400 Original-Received: from knopi.disroot.org ([178.21.23.139]:59410) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1oQVuD-0001Rg-4O for bug-gnu-emacs@gnu.org; Tue, 23 Aug 2022 11:33:32 -0400 Original-Received: from localhost (localhost [127.0.0.1]) by disroot.org (Postfix) with ESMTP id 1E0C3400A5 for ; Tue, 23 Aug 2022 17:33:23 +0200 (CEST) X-Virus-Scanned: SPAM Filter at disroot.org Original-Received: from knopi.disroot.org ([127.0.0.1]) by localhost (disroot.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id IfwyCx9Myyet for ; Tue, 23 Aug 2022 17:33:22 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=disroot.org; s=mail; t=1661268800; bh=O6ajMcUrndNnI5QqhUIvSR4e+/y0xGzK+sQMN0v9+MQ=; h=From:To:Subject:Date; b=GDIwuSaCZErJY4ZCtWqaOAMpMp3veqJiYUPrdUGPK5IjzBaoHhj6S+HNmF1LVDVV+ 7IVcL3n+PcYGYSaRApkoPdsE6PFBTqutfGbOYxdKPPfH4URG5Z3a/ndQNkoIDmV5BQ vn13yDDmoYAybCS1ENPjhhYViWmnIwIoQFsCNDRggfxnH2C7Fsn6lVs65Fo3mWiCFO xcGlEztJ+G417lauBZvrIKqF/Tbk4xqbdm/g55c13tLKIxB/xn9WpJnvfYCGKger0O a1Qq1KNc+rBqhilfXFP+QRH18+FadUPC+LuNcIm6gq+y/8RyBHi5a/8euARRijpMGa eVmZzu+fngA4Q== Received-SPF: pass client-ip=178.21.23.139; envelope-from=san@disroot.org; helo=knopi.disroot.org X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham autolearn_force=no X-Spam_action: no action X-Mailman-Approved-At: Tue, 23 Aug 2022 13:29:30 -0400 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" Xref: news.gmane.io gmane.emacs.bugs:240565 Archived-At: --=-=-= Content-Type: text/plain Hello, I recently updated my Emacs following the master branch and encountered a bug in gdb introduced in commit f6356dc88d23 which breaks some of its buffers. I've attempted to fix it with this patch. Let me know if I made any mistakes since it is my first contribution. --=-=-= Content-Type: text/x-patch Content-Disposition: inline; filename=0001-Fix-string-padding-in-gdb-mi.patch Content-Description: 0001-Fix-string-padding-in-gdb-mi.patch >From 7c80780f4ca0bad2af3d137f4ee919eb0d3e9019 Mon Sep 17 00:00:00 2001 From: Santiago Calandrino Date: Mon, 22 Aug 2022 12:01:44 -0300 Subject: [PATCH] Fix string padding in gdb-mi In commit f6356dc88d23eb405aa6d8bd9dd5f669f1bc45ee local padding function gdp-pad-string was replaced with string-pad from subr-x. The problem is that calls to string-pad use negative integers which result in errors that prevent text to be displayed on gdb information buffers. Now padding is stored as positive integers and calls to string-pad check if they should be right aligned. * lisp/progmodes/gdb-mi.el (gdb-table): Fix string padding in gdb-mi. Copyright-paperwork-exempt: yes --- lisp/progmodes/gdb-mi.el | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index c256198b3c..f2b4aa1054 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el @@ -2944,7 +2944,7 @@ gdb-mark-line (defun gdb-pad-string (string padding) (declare (obsolete string-pad "29.1")) - (string-pad string padding nil t)) + (string-pad string (abs padding) nil (natnump padding))) ;; gdb-table struct is a way to programmatically construct simple ;; tables. It help to reliably align columns of data in GDB buffers @@ -2962,8 +2962,7 @@ gdb-table-add-row calling `gdb-table-string'." (let ((rows (gdb-table-rows table)) (row-properties (gdb-table-row-properties table)) - (column-sizes (gdb-table-column-sizes table)) - (right-align (gdb-table-right-align table))) + (column-sizes (gdb-table-column-sizes table))) (when (not column-sizes) (setf (gdb-table-column-sizes table) (make-list (length row) 0))) @@ -2973,9 +2972,7 @@ gdb-table-add-row (append row-properties (list properties))) (setf (gdb-table-column-sizes table) (cl-mapcar (lambda (x s) - (let ((new-x - (max (abs x) (string-width (or s ""))))) - (if right-align new-x (- new-x)))) + (max (abs x) (string-width (or s "")))) (gdb-table-column-sizes table) row)) ;; Avoid trailing whitespace at eol @@ -2991,7 +2988,10 @@ gdb-table-string (lambda (row properties) (apply #'propertize (mapconcat #'identity - (cl-mapcar (lambda (s x) (string-pad s x nil t)) + (cl-mapcar (lambda (s x) + (string-pad + s x nil + (not (gdb-table-right-align table)))) row column-sizes) sep) properties)) -- 2.37.1 --=-=-=--