From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: awrhygty@outlook.com Newsgroups: gmane.emacs.bugs Subject: bug#67925: 29.1; delete-rectangle fails on multi-column characters Date: Thu, 21 Dec 2023 23:26:05 +0900 Message-ID: References: <83il4tge2z.fsf@gnu.org> <831qbggd50.fsf@gnu.org> Mime-Version: 1.0 Content-Type: text/plain Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="20204"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Cc: 67925@debbugs.gnu.org To: Eli Zaretskii Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Thu Dec 21 15:27:34 2023 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 1rGK1N-00055N-Kc for geb-bug-gnu-emacs@m.gmane-mx.org; Thu, 21 Dec 2023 15:27:34 +0100 Original-Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rGK0t-0003nt-FR; Thu, 21 Dec 2023 09:27:03 -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 1rGK0q-0003nf-NU for bug-gnu-emacs@gnu.org; Thu, 21 Dec 2023 09:27:00 -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 1rGK0p-0006E3-7z for bug-gnu-emacs@gnu.org; Thu, 21 Dec 2023 09:27:00 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1rGK0s-0004Ak-Gu for bug-gnu-emacs@gnu.org; Thu, 21 Dec 2023 09:27:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: awrhygty@outlook.com Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 21 Dec 2023 14:27:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 67925 X-GNU-PR-Package: emacs Original-Received: via spool by 67925-submit@debbugs.gnu.org id=B67925.170316878315988 (code B ref 67925); Thu, 21 Dec 2023 14:27:02 +0000 Original-Received: (at 67925) by debbugs.gnu.org; 21 Dec 2023 14:26:23 +0000 Original-Received: from localhost ([127.0.0.1]:42711 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGK0E-00049o-Je for submit@debbugs.gnu.org; Thu, 21 Dec 2023 09:26:23 -0500 Original-Received: from mail-psaapc01olkn2076.outbound.protection.outlook.com ([40.92.52.76]:55265 helo=APC01-PSA-obe.outbound.protection.outlook.com) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1rGK0B-00049X-6J for 67925@debbugs.gnu.org; Thu, 21 Dec 2023 09:26:20 -0500 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QR+fPM55USWTi8VUhjA9leVJzjREjs+WtYbOz9N6TPJIR+ouxrLaZdkLFCj4JdAxQP4f2dRMluSgPMHuV2bMOB67nuNZ2xTFJNXRW/6CJr5fTDLlW6ONu7wtJZtQssBSJRVR+mYuNGMLUJzgk8AR4LeSjz5g17I7dY8sjPHpwIVGjd2pCdnQGIAkfwxZ/Z3Y6Yk7/zr86l+reZ6xErxi1OiH+W5DYHP5kLDBHKt25Zbo2+td7e0k/Cg4CmxeRTpkNsiSgK2xmC2Dsj3AUQ/QFjuMAxogYPgRzzwEraOUhQWcO5/NaKVd2suU2r5+7PuTsaZYBV5rZ52eWlOQYmsIRA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=xgTBHcNw1erAuyDRM8DQ15aAHidkfzXIH9+iC1SX2Jc=; b=kyqZgIXKTV4c0txw93Owd7yOeytnQspCOxG/b3sITlDg5+9v7MgDGa9OccED/sc2coBWI9yIcpj3OreILbZcqhMjO6t5kQNp8F+G2XD36SNpd7TaJqC8E92/67r/QdBYwAdaE4CcLImFzqQUEpmVHghXRA+ruQfwvHQ+x0g/+v5rplRGRIH8gyhOkMv9CmcnSqpQD2CxMWtzi0zcETCi7Q6+QU3tWwjdYuLkLSyxdLPW3o/UHK96yaXpfXRdJqoDlmP8qS17RNsTbFi9i4qmE6ReawIa2aIJvnAkc40DTJczg2tUWDLzBOpxfMCWHxIJJhu/xT4ZteflT7Puqhx0Uw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=xgTBHcNw1erAuyDRM8DQ15aAHidkfzXIH9+iC1SX2Jc=; b=s1pSBeA6c/t34TfsRmk6gI8g8GOlWI/GaBewZSmnXn517l3ADy1j8xxv44Rr8lESPc8pMTKAze4Utol2XEctaZXU2iEowDK4xUgf1mezvEgT+qke8fD5roTp2Vn0d+z/OTNLRCHLR+PgUUk5vKgyDq2hMCqghWtdXJPk63yF7ns9HYnPx0ZVdMrsxnv6YCOlQyKEPLBds2e3xVzVyD52sDHqkK5iAtQvmX5Tk8QoibvAhCTLRHdc0ZQ9FEEZ5dHDGzgpa/x/29atHLLMxbVfCCoc5M5feWUmqMR7rgYJ4uJMXZASHgszOxVi4DY0uVTIwTTp6fruer49pAywGd+rMg== Original-Received: from TYZPR01MB3920.apcprd01.prod.exchangelabs.com (2603:1096:400:30::11) by KL1PR01MB4671.apcprd01.prod.exchangelabs.com (2603:1096:820:c7::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7113.20; Thu, 21 Dec 2023 14:26:07 +0000 Original-Received: from TYZPR01MB3920.apcprd01.prod.exchangelabs.com ([fe80::72b8:7298:fbc2:f8e7]) by TYZPR01MB3920.apcprd01.prod.exchangelabs.com ([fe80::72b8:7298:fbc2:f8e7%5]) with mapi id 15.20.7113.019; Thu, 21 Dec 2023 14:26:07 +0000 In-Reply-To: <831qbggd50.fsf@gnu.org> (Eli Zaretskii's message of "Thu, 21 Dec 2023 03:42:50 -0500") X-TMN: [cw3hVtXraEmff8C9JeTPhqeraivUMzv7eUxqVV5+5ew=] X-ClientProxiedBy: TYCP286CA0014.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:26c::8) To TYZPR01MB3920.apcprd01.prod.exchangelabs.com (2603:1096:400:30::11) X-Microsoft-Original-Message-ID: <864jgb7htu.fsf@outlook.com> X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYZPR01MB3920:EE_|KL1PR01MB4671:EE_ X-MS-Office365-Filtering-Correlation-Id: 60751082-d20c-4b4d-5890-08dc0230c483 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 2CMlaTODweN7gZl8Ryek2g5TrBgNgesnGJ9hnjpOTEBhqs6ESg+kL6gOQeFI6qkKw7BkOxMzdJ2cCICzk9HkTq6JXEcV14babJ57myXgrJy1Q/4UwJOAsxtJucFMlGKodT4pkfI4Z4dNdEx+lgbk0teoRgXjkle7+fLYHgBESvUuFrjjaAIFQC3uZSJN+qAHf+DERn0uWDqvP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KHw2Zd93c+p8IThyHHgmsxDgguY20KeLyiB33CMuNu2zHtSSbR20rqb52LECgzWlsUAqqL6Ax7n+84RPtRiTnqlXXvHFooKsjQ2Uzo0iPYSp mCweDXvBydgfAQL792BUlmnAzT7aRg3DN2h1m31DxHdkVshjC9CQ2VF7RXNioc4CS1evNXey8pyWBzFpfXr/8Z30qnEaipiKZG X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 60751082-d20c-4b4d-5890-08dc0230c483 X-MS-Exchange-CrossTenant-AuthSource: TYZPR01MB3920.apcprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Dec 2023 14:26:06.6957 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: KL1PR01MB4671 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:276632 Archived-At: Eli Zaretskii writes: >> From: awrhygty@outlook.com >> Cc: 67925@debbugs.gnu.org >> Date: Thu, 21 Dec 2023 16:30:39 +0900 >> >> Eli Zaretskii writes: >> >> > Thanks. Does the patch below give good results? >> > >> > diff --git a/lisp/rect.el b/lisp/rect.el >> > index 8dc188b..9049e32 100644 >> > --- a/lisp/rect.el >> > +++ b/lisp/rect.el >> > @@ -212,7 +212,10 @@ rectangle-dimensions >> > (cons width height)))) >> > >> > (defun delete-rectangle-line (startcol endcol fill) >> > - (when (= (move-to-column startcol (if fill t 'coerce)) startcol) >> > + ;; We use >= here, not =, for characters that use more than one >> > + ;; column on display, when STARTCOL is in the middle of such a >> > + ;; character. >> > + (when (>= (move-to-column startcol (if fill t 'coerce)) startcol) >> > (delete-region (point) >> > (progn (move-to-column endcol 'coerce) >> > (point))))) >> >> This patch gives similar result of kill-rectangle. >> In the example above, I want all '4' characters moved to same column. > > How can that be done, when the first character takes 2 or more > columns? Deleting the first character is IMO wrong, since the other > lines leave the first character intact. Adding SPC to other lines is > also wrong, since delete-rectangle is not supposed to _add_ columns. I think wide characters may be replaced with SPC like TAB. >> And TAB characters crossing the end column are not edited correctly >> with delete-rectangle if indent-tabs-mode is on. >> >> 012345678 >> 8(TAB at head) >> 012345678 >> >> The text above is edited to the text below. >> 45678 >> 8(TAB at head) >> 45678 >> >> If indent-tabs-mode is off, the result is the text below. >> 45678 >> 8(four SPCs) >> 45678 > > This is a separate issue with the original code. It also happens with > kill-rectangle, btw. We could fix it by temporarily binding > indent-tabs-mode to nil inside these commands -- would that be > acceptable? The result will be that the killed rectangle includes > spaces, not the leading TAB. I prefer that the killed rectangle has same column for each line. If TAB is included when yanking, the current column affects the width of the yanked string for each line.