From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED.blaine.gmane.org!not-for-mail From: Carlos Pita Newsgroups: gmane.emacs.bugs Subject: bug#37782: Emacs 27 client adding [I] to the beginning of the buffer Date: Sat, 19 Oct 2019 00:20:05 -0300 Message-ID: References: <831rvbdcjq.fsf@gnu.org> <83d0evbjb1.fsf@gnu.org> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="000000000000ffcbe805953aed63" Injection-Info: blaine.gmane.org; posting-host="blaine.gmane.org:195.159.176.226"; logging-data="93979"; mail-complaints-to="usenet@blaine.gmane.org" Cc: 37782@debbugs.gnu.org Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane.org@gnu.org Sat Oct 19 05:21:11 2019 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([209.51.188.17]) by blaine.gmane.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1iLfIl-000OKi-4Z for geb-bug-gnu-emacs@m.gmane.org; Sat, 19 Oct 2019 05:21:11 +0200 Original-Received: from localhost ([::1]:47938 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLfIk-00071a-0c for geb-bug-gnu-emacs@m.gmane.org; Fri, 18 Oct 2019 23:21:10 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:48836) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1iLfId-00071U-Tp for bug-gnu-emacs@gnu.org; Fri, 18 Oct 2019 23:21:04 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1iLfIc-0006FU-Qb for bug-gnu-emacs@gnu.org; Fri, 18 Oct 2019 23:21:03 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:42951) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1iLfIc-0006FN-Mi for bug-gnu-emacs@gnu.org; Fri, 18 Oct 2019 23:21:02 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1iLfIc-0007I3-Gd for bug-gnu-emacs@gnu.org; Fri, 18 Oct 2019 23:21:02 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Carlos Pita Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Sat, 19 Oct 2019 03:21:02 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 37782 X-GNU-PR-Package: emacs Original-Received: via spool by 37782-submit@debbugs.gnu.org id=B37782.157145522627949 (code B ref 37782); Sat, 19 Oct 2019 03:21:02 +0000 Original-Received: (at 37782) by debbugs.gnu.org; 19 Oct 2019 03:20:26 +0000 Original-Received: from localhost ([127.0.0.1]:51772 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iLfI1-0007Gj-QZ for submit@debbugs.gnu.org; Fri, 18 Oct 2019 23:20:26 -0400 Original-Received: from mail-yw1-f68.google.com ([209.85.161.68]:43530) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1iLfHz-0007GU-5b for 37782@debbugs.gnu.org; Fri, 18 Oct 2019 23:20:23 -0400 Original-Received: by mail-yw1-f68.google.com with SMTP id q7so2890837ywe.10 for <37782@debbugs.gnu.org>; Fri, 18 Oct 2019 20:20:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:cc; bh=B2eXCeV4yH2GTz7P6GCdgm8RhBBA5fgkI/LVmQHBWZ8=; b=blXgnMGFpQMDntRdilOwWIjnVo4ekVoY/5pnf3GssJAono/SAABIeJhRyWhujN/Xjw bkbiJBF0dxDsDlawoVIM7gZsTKSAkE1t+VAsB9XUb4Tpx2Ih4uYreYogG+NJj6Eu78vT Tdi//iypv0ZaV3sdMgFR8YOHCL215LB4ggItzkENcVZTP+hu42dWAMRPQ+yZDqS1Y5Y3 YEjox3YFUIWp1FdR37xMyishGwV7VDP4MJ/a6UUxPy446hKCbY1gButVGms5iIvjIYcQ 7hcfhAURV1nT59dSR0NZdm8Y3aVksRv4QlBHjWWYvmzLUbTf2G0/8NJVIQOC03snWjxJ SaMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:cc; bh=B2eXCeV4yH2GTz7P6GCdgm8RhBBA5fgkI/LVmQHBWZ8=; b=agr28xQruRRggBbFXsIoFSAxPvnbLlNyx9QlvQi6JBvv2VXASB53WED1O3ZSKkCIGC NgQLSCuPuldJLUt15KhgO8dfQtubKkX6oEnf+PojeyOITRnT0C5VMSj7eAHvGh9NAe5R A8EeH7pabEMIki+8gujTob0QswpAtYhEtvTIZFu0XJLlbzKM+Dz4SppoAwJqVSHoq3vh b7EPLX5fPWzYRJzxzUNNBE1qq8z04AfzeKkKB6MzCD62qfrlvUHYytI0thLDmezUdmR6 5Yg2MjYJue1z4alx89NFzXjQurv/K7jCcRaGv6OsCmauUL+ZT0U8O+UXvDasbbM7USkh mVVw== X-Gm-Message-State: APjAAAXnJU6AKXxv6ocxPAQL6K9bTWAWp+IWqnWOHYABA9SVKEP+CdYQ 8pR2c4n7eHftakK3iL0i8bznm/RwsArKqCyWFqvOL6ctSZA= X-Google-Smtp-Source: APXvYqzv18dBEwew78kOSC5NonRa02PU7XhQVUWVz/mgeGOZn9kTgDZ0zB1XRX/zGBqZBI81FSHtFcOyyy+OroQGp+o= X-Received: by 2002:a81:4947:: with SMTP id w68mr4437816ywa.80.1571455217150; Fri, 18 Oct 2019 20:20:17 -0700 (PDT) In-Reply-To: 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: 209.51.188.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:169694 Archived-At: --000000000000ffcbe805953aed63 Content-Type: text/plain; charset="UTF-8" After hours and hours (and hours) of life sucking debugging I found out the offending code (in read_key_sequence): if ((FIXNUMP (key) && XFIXNUM (key) == -2) /* wrong_kboard_jmpbuf */ /* When switching to a new tty (with a new keyboard), read_char returns the new buffer, rather than -2 (Bug#5095). This is because `terminal-init-xterm' calls read-char, which eats the wrong_kboard_jmpbuf return. Any better way to fix this? -- cyd */ || (interrupted_kboard != current_kboard)) { .... mock_input = 0; goto replay_entire_sequence; } The problem with the fix for #5095 is that it's dropping the current event, which is a valid char event and not -2. Thus, the first esc char sent by the terminal after turning on focus tracking is lost and we get `[`, `I` events separately inserted into the buffer afterwards. Attached is a patch that replays key as mock input when it's not -2. Can I ask for some of my hidpi fringe or colorized comint/python history patches to be merged in exchange ;) ? Best regards -- Carlos --000000000000ffcbe805953aed63 Content-Type: text/x-patch; charset="US-ASCII"; name="0001-Replay-key-if-kboard-is-interrupted-while-initializi.patch" Content-Disposition: attachment; filename="0001-Replay-key-if-kboard-is-interrupted-while-initializi.patch" Content-Transfer-Encoding: base64 Content-ID: X-Attachment-Id: f_k1wzt38l0 RnJvbSAwZTk4YmRmNWFhNDg1YzJiNDE2NGM5NjI3ZWMzNGI3YjU0ODkyMzUyIE1vbiBTZXAgMTcg MDA6MDA6MDAgMjAwMQpGcm9tOiBtZW1lcGxleCA8Y2FybG9zam9zZXBpdGFAZ21haWwuY29tPgpE YXRlOiBTYXQsIDE5IE9jdCAyMDE5IDAwOjEzOjE1I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isgICAg ICAgICAgICAgICAgICAgICAgIG5lZWQgdG8gcmVwbGF5IHRoZSBpbnRlcnJ1cHRpbmcga2V5LiAg U2VlCisgICAgICAgICAgICAgICAgICAgICAgIEJ1ZyM1MDk1IGFuZCBCdWcjMzc3ODIuICAqLwor ICAgICAgICAgICAgICAgICAgICBtb2NrX2lucHV0ID0gMTsKKyAgICAgICAgICAgICAgICAgICAg a2V5YnVmWzBdID0ga2V5OworICAgICAgICAgICAgICAgICAgfQogCQlnb3RvIHJlcGxheV9lbnRp cmVfc2VxdWVuY2U7CiAJICAgICAgfQogCSAgfQotLSAKMi4yMC4xCgo= --000000000000ffcbe805953aed63--