* bug#52941: 29.0.50; fido-mode: characters typed into minibuffers inserted multiple times
@ 2022-01-01 23:14 Sean Whitton
2022-01-11 0:11 ` bug#52941: 29.0.50; pgtk: " Sean Whitton
0 siblings, 1 reply; 11+ messages in thread
From: Sean Whitton @ 2022-01-01 23:14 UTC (permalink / raw)
To: 52941
Hello,
If the system is under heavy load, and/or Emacs is compiled with debug
options which substantially slow it down, and fido-mode is enabled, then
typing quickly into the minibuffer can result in typed characters
inserted more than once. Here is how I can reproduce it:
emacs -Q
M-x fido-mode RET
C-h v
and quickly try to type "font-weight-table". This is what I get in the
minibuffer:
font-weweweweweweweight-tatabe
Although I made at least one typo (I didn't type the 'l'), I definitely
did not type 'we' and 'ta' that many times.
I haven't been able to reproduce with icomplete-mode, but as the problem
does not occur consistently, I am not confident it does not occur with
icomplete-mode.
--
Sean Whitton
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#52941: 29.0.50; pgtk: characters typed into minibuffers inserted multiple times
2022-01-01 23:14 bug#52941: 29.0.50; fido-mode: characters typed into minibuffers inserted multiple times Sean Whitton
@ 2022-01-11 0:11 ` Sean Whitton
2022-01-11 9:44 ` João Távora
` (2 more replies)
0 siblings, 3 replies; 11+ messages in thread
From: Sean Whitton @ 2022-01-11 0:11 UTC (permalink / raw)
To: 52941; +Cc: Po Lu, Yuuki Harano, João Távora
Hello,
On Sat 01 Jan 2022 at 04:14PM -07, Sean Whitton wrote:
> If the system is under heavy load, and/or Emacs is compiled with debug
> options which substantially slow it down, and fido-mode is enabled, then
> typing quickly into the minibuffer can result in typed characters
> inserted more than once. Here is how I can reproduce it:
>
> emacs -Q
> M-x fido-mode RET
> C-h v
>
> and quickly try to type "font-weight-table". This is what I get in the
> minibuffer:
>
> font-weweweweweweweight-tatabe
>
> Although I made at least one typo (I didn't type the 'l'), I definitely
> did not type 'we' and 'ta' that many times.
>
> I haven't been able to reproduce with icomplete-mode, but as the problem
> does not occur consistently, I am not confident it does not occur with
> icomplete-mode.
It occurred to me to try --with-x-toolkit=lucid instead of --with-pgtk.
Sure enough, I cannot reproduce the bug. So I think the problem is
something about how pgtk receives and processes keyboard input.
In summary: I can reproduce with pgtk running as a native Wayland
application, and I cannot reproduce with the Lucid build running under
Xwayland. In both cases, swaywm. I have retitled the bug.
Thanks.
--
Sean Whitton
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#52941: 29.0.50; pgtk: characters typed into minibuffers inserted multiple times
2022-01-11 0:11 ` bug#52941: 29.0.50; pgtk: " Sean Whitton
@ 2022-01-11 9:44 ` João Távora
2022-01-11 10:21 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-15 15:08 ` Yuuki Harano
2 siblings, 0 replies; 11+ messages in thread
From: João Távora @ 2022-01-11 9:44 UTC (permalink / raw)
To: Sean Whitton; +Cc: Po Lu, Yuuki Harano, 52941
[-- Attachment #1: Type: text/plain, Size: 1637 bytes --]
Thanks, Sean, that's very good investigation and I'll admit induces
a "phew" on my part ;-)
And yes, I'm pretty sure this will happen with icomplete-mode as
well.
João
On Tue, Jan 11, 2022 at 12:11 AM Sean Whitton <spwhitton@spwhitton.name>
wrote:
> Hello,
>
> On Sat 01 Jan 2022 at 04:14PM -07, Sean Whitton wrote:
>
> > If the system is under heavy load, and/or Emacs is compiled with debug
> > options which substantially slow it down, and fido-mode is enabled, then
> > typing quickly into the minibuffer can result in typed characters
> > inserted more than once. Here is how I can reproduce it:
> >
> > emacs -Q
> > M-x fido-mode RET
> > C-h v
> >
> > and quickly try to type "font-weight-table". This is what I get in the
> > minibuffer:
> >
> > font-weweweweweweweight-tatabe
> >
> > Although I made at least one typo (I didn't type the 'l'), I definitely
> > did not type 'we' and 'ta' that many times.
> >
> > I haven't been able to reproduce with icomplete-mode, but as the problem
> > does not occur consistently, I am not confident it does not occur with
> > icomplete-mode.
>
> It occurred to me to try --with-x-toolkit=lucid instead of --with-pgtk.
> Sure enough, I cannot reproduce the bug. So I think the problem is
> something about how pgtk receives and processes keyboard input.
>
> In summary: I can reproduce with pgtk running as a native Wayland
> application, and I cannot reproduce with the Lucid build running under
> Xwayland. In both cases, swaywm. I have retitled the bug.
>
> Thanks.
>
> --
> Sean Whitton
>
--
João Távora
[-- Attachment #2: Type: text/html, Size: 2282 bytes --]
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#52941: 29.0.50; pgtk: characters typed into minibuffers inserted multiple times
2022-01-11 0:11 ` bug#52941: 29.0.50; pgtk: " Sean Whitton
2022-01-11 9:44 ` João Távora
@ 2022-01-11 10:21 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-13 16:58 ` Sean Whitton
2022-01-15 15:08 ` Yuuki Harano
2 siblings, 1 reply; 11+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-01-11 10:21 UTC (permalink / raw)
To: Sean Whitton; +Cc: Yuuki Harano, 52941, João Távora
Sean Whitton <spwhitton@spwhitton.name> writes:
> It occurred to me to try --with-x-toolkit=lucid instead of --with-pgtk.
> Sure enough, I cannot reproduce the bug. So I think the problem is
> something about how pgtk receives and processes keyboard input.
> In summary: I can reproduce with pgtk running as a native Wayland
> application, and I cannot reproduce with the Lucid build running under
> Xwayland. In both cases, swaywm. I have retitled the bug.
You forgot to test the following combinations:
--with-x-toolkit=gtk3, x-gtk-use-native-input set to nil
--with-x-toolkit=gtk3, x-gtk-use-native-input set to t
--with-pgtk, GDK_BACKEND=x11
Could you please try all three setups and see which of those the
problem exists in?
Thanks in advance.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#52941: 29.0.50; pgtk: characters typed into minibuffers inserted multiple times
2022-01-11 10:21 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-01-13 16:58 ` Sean Whitton
2022-01-14 0:39 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 11+ messages in thread
From: Sean Whitton @ 2022-01-13 16:58 UTC (permalink / raw)
To: Po Lu; +Cc: Yuuki Harano, 52941, João Távora
Hello Po,
On Tue 11 Jan 2022 at 06:21PM +08, Po Lu wrote:
> Sean Whitton <spwhitton@spwhitton.name> writes:
>
>> It occurred to me to try --with-x-toolkit=lucid instead of --with-pgtk.
>> Sure enough, I cannot reproduce the bug. So I think the problem is
>> something about how pgtk receives and processes keyboard input.
>
>> In summary: I can reproduce with pgtk running as a native Wayland
>> application, and I cannot reproduce with the Lucid build running under
>> Xwayland. In both cases, swaywm. I have retitled the bug.
>
> You forgot to test the following combinations:
>
> --with-x-toolkit=gtk3, x-gtk-use-native-input set to nil
> --with-x-toolkit=gtk3, x-gtk-use-native-input set to t
Cannot reproduce. I did try both, but I can't find any mention of
x-gtk-use-native-input in the Emacs source code -- is it possible you
meant a similarly-named variable?
> --with-pgtk, GDK_BACKEND=x11
Can reproduce, but it happens less often, i.e., you have to load up the
system further and type faster to reproduce :)
--
Sean Whitton
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#52941: 29.0.50; pgtk: characters typed into minibuffers inserted multiple times
2022-01-13 16:58 ` Sean Whitton
@ 2022-01-14 0:39 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-14 21:30 ` Sean Whitton
0 siblings, 1 reply; 11+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-01-14 0:39 UTC (permalink / raw)
To: Sean Whitton; +Cc: Yuuki Harano, 52941, João Távora
Sean Whitton <spwhitton@spwhitton.name> writes:
> Hello Po,
>
> On Tue 11 Jan 2022 at 06:21PM +08, Po Lu wrote:
>
>> Sean Whitton <spwhitton@spwhitton.name> writes:
>>
>>> It occurred to me to try --with-x-toolkit=lucid instead of --with-pgtk.
>>> Sure enough, I cannot reproduce the bug. So I think the problem is
>>> something about how pgtk receives and processes keyboard input.
>>
>>> In summary: I can reproduce with pgtk running as a native Wayland
>>> application, and I cannot reproduce with the Lucid build running under
>>> Xwayland. In both cases, swaywm. I have retitled the bug.
>>
>> You forgot to test the following combinations:
>>
>> --with-x-toolkit=gtk3, x-gtk-use-native-input set to nil
>> --with-x-toolkit=gtk3, x-gtk-use-native-input set to t
>
> Cannot reproduce. I did try both, but I can't find any mention of
> x-gtk-use-native-input in the Emacs source code -- is it possible you
> meant a similarly-named variable?
It's a relatively new feature, you should update from master and test
again.
> Can reproduce, but it happens less often, i.e., you have to load up the
> system further and type faster to reproduce :)
Thanks, I will look into this, but please also update and test native
input.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#52941: 29.0.50; pgtk: characters typed into minibuffers inserted multiple times
2022-01-14 0:39 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-01-14 21:30 ` Sean Whitton
2022-01-15 0:49 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 1 reply; 11+ messages in thread
From: Sean Whitton @ 2022-01-14 21:30 UTC (permalink / raw)
To: Po Lu; +Cc: Yuuki Harano, 52941, João Távora
Hello,
On Fri 14 Jan 2022 at 08:39AM +08, Po Lu wrote:
> Sean Whitton <spwhitton@spwhitton.name> writes:
>
>> Hello Po,
>>
>> On Tue 11 Jan 2022 at 06:21PM +08, Po Lu wrote:
>>
>>> Sean Whitton <spwhitton@spwhitton.name> writes:
>>>
>>>> It occurred to me to try --with-x-toolkit=lucid instead of --with-pgtk.
>>>> Sure enough, I cannot reproduce the bug. So I think the problem is
>>>> something about how pgtk receives and processes keyboard input.
>>>
>>>> In summary: I can reproduce with pgtk running as a native Wayland
>>>> application, and I cannot reproduce with the Lucid build running under
>>>> Xwayland. In both cases, swaywm. I have retitled the bug.
>>>
>>> You forgot to test the following combinations:
>>>
>>> --with-x-toolkit=gtk3, x-gtk-use-native-input set to nil
>>> --with-x-toolkit=gtk3, x-gtk-use-native-input set to t
>>
>> Cannot reproduce. I did try both, but I can't find any mention of
>> x-gtk-use-native-input in the Emacs source code -- is it possible you
>> meant a similarly-named variable?
>
> It's a relatively new feature, you should update from master and test
> again.
Ah, sorry. Now done. Cannot reproduce in either case.
In the latter case I had to kill fcitx5 before I could type into Emacs.
So I thought I'd also test pgtk with and without GDK_BACKEND=x11 without
fcitx5 running. I could reproduce in both cases.
--
Sean Whitton
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#52941: 29.0.50; pgtk: characters typed into minibuffers inserted multiple times
2022-01-14 21:30 ` Sean Whitton
@ 2022-01-15 0:49 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
0 siblings, 0 replies; 11+ messages in thread
From: Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2022-01-15 0:49 UTC (permalink / raw)
To: Sean Whitton; +Cc: Yuuki Harano, 52941, João Távora
Sean Whitton <spwhitton@spwhitton.name> writes:
> Ah, sorry. Now done. Cannot reproduce in either case.
>
> In the latter case I had to kill fcitx5 before I could type into Emacs.
> So I thought I'd also test pgtk with and without GDK_BACKEND=x11 without
> fcitx5 running. I could reproduce in both cases.
Thanks for testing.
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#52941: 29.0.50; pgtk: characters typed into minibuffers inserted multiple times
2022-01-11 0:11 ` bug#52941: 29.0.50; pgtk: " Sean Whitton
2022-01-11 9:44 ` João Távora
2022-01-11 10:21 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
@ 2022-01-15 15:08 ` Yuuki Harano
2022-01-15 21:10 ` Sean Whitton
2 siblings, 1 reply; 11+ messages in thread
From: Yuuki Harano @ 2022-01-15 15:08 UTC (permalink / raw)
To: Sean Whitton; +Cc: Po Lu, 52941, João Távora
[-- Attachment #1: Type: text/plain, Size: 412 bytes --]
On Tue, 11 Jan 2022 09:11:13 +0900,
Sean Whitton wrote:
> > If the system is under heavy load, and/or Emacs is compiled with debug
> > options which substantially slow it down, and fido-mode is enabled, then
> > typing quickly into the minibuffer can result in typed characters
> > inserted more than once.
Thanks for the report.
Please try the attached patch, which should solve the issue.
--
Yuuki Harano
[-- Attachment #2: events-processed-twice.diff --]
[-- Type: application/octet-stream, Size: 919 bytes --]
diff --git a/src/pgtkterm.c b/src/pgtkterm.c
index 0155ae991d..5be9af7160 100644
--- a/src/pgtkterm.c
+++ b/src/pgtkterm.c
@@ -153,10 +153,24 @@ evq_enqueue (union buffered_input_event *ev)
evq_flush (struct input_event *hold_quit)
{
struct event_queue_t *evq = &event_q;
- int i, n = evq->nr;
- for (i = 0; i < n; i++)
- kbd_buffer_store_buffered_event (&evq->q[i], hold_quit);
- evq->nr = 0;
+ int n = 0;
+
+ while (evq->nr > 0)
+ {
+ /* kbd_buffer_store_buffered_event may do longjmp, so
+ we need to shift event queue first and pass the event
+ to kbd_buffer_store_buffered_event so that events in
+ queue are not processed twice. Bug#52941 */
+ union buffered_input_event ev = evq->q[0];
+ int i;
+ for (i = 1; i < evq->nr; i++)
+ evq->q[i - 1] = evq->q[i];
+ evq->nr--;
+
+ kbd_buffer_store_buffered_event (&ev, hold_quit);
+ n++;
+ }
+
return n;
}
^ permalink raw reply related [flat|nested] 11+ messages in thread
* bug#52941: 29.0.50; pgtk: characters typed into minibuffers inserted multiple times
2022-01-15 15:08 ` Yuuki Harano
@ 2022-01-15 21:10 ` Sean Whitton
2022-01-16 8:45 ` Yuuki Harano
0 siblings, 1 reply; 11+ messages in thread
From: Sean Whitton @ 2022-01-15 21:10 UTC (permalink / raw)
To: Yuuki Harano; +Cc: Po Lu, 52941, João Távora
Hello,
On Sun 16 Jan 2022 at 12:08AM +09, Yuuki Harano wrote:
> On Tue, 11 Jan 2022 09:11:13 +0900,
> Sean Whitton wrote:
>> > If the system is under heavy load, and/or Emacs is compiled with debug
>> > options which substantially slow it down, and fido-mode is enabled, then
>> > typing quickly into the minibuffer can result in typed characters
>> > inserted more than once.
>
> Thanks for the report.
> Please try the attached patch, which should solve the issue.
Looks like it does -- thanks!
--
Sean Whitton
^ permalink raw reply [flat|nested] 11+ messages in thread
* bug#52941: 29.0.50; pgtk: characters typed into minibuffers inserted multiple times
2022-01-15 21:10 ` Sean Whitton
@ 2022-01-16 8:45 ` Yuuki Harano
0 siblings, 0 replies; 11+ messages in thread
From: Yuuki Harano @ 2022-01-16 8:45 UTC (permalink / raw)
To: Sean Whitton; +Cc: Po Lu, 52941-done, João Távora
On Sun, 16 Jan 2022 06:10:17 +0900,
Sean Whitton wrote:
> > Please try the attached patch, which should solve the issue.
>
> Looks like it does -- thanks!
Applied. Thanks for the confirmation.
--
Yuuki Harano
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2022-01-16 8:45 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-01-01 23:14 bug#52941: 29.0.50; fido-mode: characters typed into minibuffers inserted multiple times Sean Whitton
2022-01-11 0:11 ` bug#52941: 29.0.50; pgtk: " Sean Whitton
2022-01-11 9:44 ` João Távora
2022-01-11 10:21 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-13 16:58 ` Sean Whitton
2022-01-14 0:39 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-14 21:30 ` Sean Whitton
2022-01-15 0:49 ` Po Lu via Bug reports for GNU Emacs, the Swiss army knife of text editors
2022-01-15 15:08 ` Yuuki Harano
2022-01-15 21:10 ` Sean Whitton
2022-01-16 8:45 ` Yuuki Harano
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).