From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Juri Linkov Newsgroups: gmane.emacs.bugs Subject: bug#33640: 27.0.50; Wrong column when prompt contains combining characters Date: Thu, 06 Dec 2018 01:05:24 +0200 Organization: LINKOV.NET Message-ID: <87k1knbmmj.fsf@mail.linkov.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: blaine.gmane.org 1544057739 2460 195.159.176.226 (6 Dec 2018 00:55:39 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 6 Dec 2018 00:55:39 +0000 (UTC) User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (x86_64-pc-linux-gnu) To: 33640@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Thu Dec 06 01:55:35 2018 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gUhx0-0000Xk-1w for geb-bug-gnu-emacs@m.gmane.org; Thu, 06 Dec 2018 01:55:34 +0100 Original-Received: from localhost ([::1]:38292 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUhz6-0004HL-F3 for geb-bug-gnu-emacs@m.gmane.org; Wed, 05 Dec 2018 19:57:44 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:43148) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUhyV-0003yB-CJ for bug-gnu-emacs@gnu.org; Wed, 05 Dec 2018 19:57:11 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gUhyQ-00040c-U4 for bug-gnu-emacs@gnu.org; Wed, 05 Dec 2018 19:57:07 -0500 Original-Received: from debbugs.gnu.org ([208.118.235.43]:58790) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gUhyQ-00040P-Mm for bug-gnu-emacs@gnu.org; Wed, 05 Dec 2018 19:57:02 -0500 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1gUhyQ-0004X1-IH for bug-gnu-emacs@gnu.org; Wed, 05 Dec 2018 19:57:02 -0500 X-Loop: help-debbugs@gnu.org Resent-From: Juri Linkov Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Thu, 06 Dec 2018 00:57:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: report 33640 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.154405781817401 (code B ref -1); Thu, 06 Dec 2018 00:57:02 +0000 Original-Received: (at submit) by debbugs.gnu.org; 6 Dec 2018 00:56:58 +0000 Original-Received: from localhost ([127.0.0.1]:34812 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gUhyI-0004WV-HV for submit@debbugs.gnu.org; Wed, 05 Dec 2018 19:56:58 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:33187) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1gUhyE-0004W1-6G for submit@debbugs.gnu.org; Wed, 05 Dec 2018 19:56:53 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gUhy4-0003KA-S1 for submit@debbugs.gnu.org; Wed, 05 Dec 2018 19:56:44 -0500 Original-Received: from lists.gnu.org ([2001:4830:134:3::11]:36566) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gUhy0-0003CP-Lj for submit@debbugs.gnu.org; Wed, 05 Dec 2018 19:56:37 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:42635) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gUhxw-0003eC-Jx for bug-gnu-emacs@gnu.org; Wed, 05 Dec 2018 19:56:36 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gUhxn-0002pg-QZ for bug-gnu-emacs@gnu.org; Wed, 05 Dec 2018 19:56:29 -0500 Original-Received: from ladybird.maple.relay.mailchannels.net ([23.83.214.98]:1352) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1gUhxn-0002js-20 for bug-gnu-emacs@gnu.org; Wed, 05 Dec 2018 19:56:23 -0500 X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from relay.mailchannels.net (localhost [127.0.0.1]) by relay.mailchannels.net (Postfix) with ESMTP id 46233502A12 for ; Thu, 6 Dec 2018 00:56:19 +0000 (UTC) Original-Received: from pdx1-sub0-mail-a54.g.dreamhost.com (unknown [100.96.29.126]) (Authenticated sender: dreamhost) by relay.mailchannels.net (Postfix) with ESMTPA id 0F982501E2B for ; Thu, 6 Dec 2018 00:56:19 +0000 (UTC) X-Sender-Id: dreamhost|x-authsender|jurta@jurta.org Original-Received: from pdx1-sub0-mail-a54.g.dreamhost.com (pop.dreamhost.com [64.90.62.162]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384) by 0.0.0.0:2500 (trex/5.16.2); Thu, 06 Dec 2018 00:56:19 +0000 X-MC-Relay: Neutral X-MailChannels-SenderId: dreamhost|x-authsender|jurta@jurta.org X-MailChannels-Auth-Id: dreamhost X-Whistle-Harmony: 14f680bb7e009be2_1544057779139_2897077497 X-MC-Loop-Signature: 1544057779139:367322385 X-MC-Ingress-Time: 1544057779139 Original-Received: from pdx1-sub0-mail-a54.g.dreamhost.com (localhost [127.0.0.1]) by pdx1-sub0-mail-a54.g.dreamhost.com (Postfix) with ESMTP id CC08A8007F for ; Wed, 5 Dec 2018 16:56:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=linkov.net; h=from:to :subject:date:message-id:mime-version:content-type; s= linkov.net; bh=rdKN47mUZPm+AHkQO7gBw1I7rV4=; b=XuTWyYrszsdT5reQD cLlwq9O8lRM9puAjoApGf36eatF/JWSjorpRkOBtkPdoFAwLvSSbtjm6FehoCIQQ 66ND7UrNKmZVukqeX2JuVzUomcW/bfp14yYpJPeZNwVVa4skB2FMJjTqj+GsU2bL bEysvsdXCdFZJBUukrL0vqeUaw= Original-Received: from mail.jurta.org (m91-129-103-7.cust.tele2.ee [91.129.103.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: jurta@jurta.org) by pdx1-sub0-mail-a54.g.dreamhost.com (Postfix) with ESMTPSA id 6A3C880077 for ; Wed, 5 Dec 2018 16:56:11 -0800 (PST) X-DH-BACKEND: pdx1-sub0-mail-a54 X-VR-OUT-STATUS: OK X-VR-OUT-SCORE: 0 X-VR-OUT-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedtkedrudefiedgvdekucetufdoteggodetrfdotffvucfrrhhofhhilhgvmecuggftfghnshhusghstghrihgsvgdpffftgfetoffjqffuvfenuceurghilhhouhhtmecufedttdenucenucfjughrpefhvffuohffkfgfgggtsehttdertddtredtnecuhfhrohhmpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqnecukfhppeeluddruddvledruddtfedrjeenucfrrghrrghmpehmohguvgepshhmthhppdhhvghlohepmhgrihhlrdhjuhhrthgrrdhorhhgpdhinhgvthepledurdduvdelrddutdefrdejpdhrvghtuhhrnhdqphgrthhhpefluhhrihcunfhinhhkohhvuceojhhurhhisehlihhnkhhovhdrnhgvtheqpdhmrghilhhfrhhomhepjhhurhhisehlihhnkhhovhdrnhgvthdpnhhrtghpthhtohepsghughdqghhnuhdqvghmrggtshesghhnuhdrohhrghenucevlhhushhtvghrufhiiigvpedt X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] [fuzzy] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 208.118.235.43 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.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.org gmane.emacs.bugs:153132 Archived-At: Tags: patch If the minibuffer prompt contains combining characters in such cases when for example dired-do-async-shell-command is invoked on a file whose name contains COMBINING ACUTE ACCENT, then navigating the minibuffer history with M-n and M-p puts point at incorrect positions. This is because currently next-line-or-history-element and previous-line-or-history-element subtract the point's position from the column number that takes into account character composition. This patch uses only columns in calculations. Eli, do you think this fix should be installed to the emacs-26 branch? diff --git a/lisp/simple.el b/lisp/simple.el index e1922384f2..4c6ca0619a 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -2172,7 +2172,11 @@ next-line-or-history-element (prompt-end (minibuffer-prompt-end)) (old-column (unless (and (eolp) (> (point) prompt-end)) (if (= (line-number-at-pos) 1) - (max (- (current-column) (1- prompt-end)) 0) + (max (- (current-column) + (save-excursion + (goto-char (1- prompt-end)) + (current-column))) + 0) (current-column))))) (condition-case nil (with-no-warnings @@ -2191,7 +2195,10 @@ next-line-or-history-element (goto-char (point-max)) (when old-column (if (= (line-number-at-pos) 1) - (move-to-column (+ old-column (1- (minibuffer-prompt-end)))) + (move-to-column (+ old-column + (save-excursion + (goto-char (1- (minibuffer-prompt-end))) + (current-column)))) (move-to-column old-column))))))) (defun previous-line-or-history-element (&optional arg) @@ -2206,7 +2213,11 @@ previous-line-or-history-element (prompt-end (minibuffer-prompt-end)) (old-column (unless (and (eolp) (> (point) prompt-end)) (if (= (line-number-at-pos) 1) - (max (- (current-column) (1- prompt-end)) 0) + (max (- (current-column) + (save-excursion + (goto-char (1- prompt-end)) + (current-column))) + 0) (current-column))))) (condition-case nil (with-no-warnings @@ -2225,7 +2236,10 @@ previous-line-or-history-element (goto-char (minibuffer-prompt-end)) (if old-column (if (= (line-number-at-pos) 1) - (move-to-column (+ old-column (1- (minibuffer-prompt-end)))) + (move-to-column (+ old-column + (save-excursion + (goto-char (1- (minibuffer-prompt-end))) + (current-column)))) (move-to-column old-column)) ;; Put the cursor at the end of the visual line instead of the ;; logical line, so the next `previous-line-or-history-element'