Skip to content

Commit d4f4fc6

Browse files
Fix bug with UnixMainLoop and idle
When running in WSL Ubuntu, I was unable to process input. The issue was that when there's an idle function registered with the main loop, UnixMainLoop doesn't ever call poll. Without the poll call, pollmap doesn't get updated and the input callback doesn't get called. Change this so that it calls poll every loop iteration, even if there's an idle function.
1 parent 3adfa22 commit d4f4fc6

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

Terminal.Gui/ConsoleDrivers/CursesDriver/UnixMainLoop.cs

+3-4
Original file line numberDiff line numberDiff line change
@@ -176,16 +176,15 @@ bool IMainLoopDriver.EventsPending (bool wait)
176176
{
177177
UpdatePollMap ();
178178

179-
if (CheckTimers (wait, out var pollTimeout)) {
180-
return true;
181-
}
179+
bool checkTimersResult = CheckTimers (wait, out var pollTimeout);
182180

183181
var n = poll (pollmap, (uint)pollmap.Length, pollTimeout);
184182

185183
if (n == KEY_RESIZE) {
186184
winChanged = true;
187185
}
188-
return n >= KEY_RESIZE || CheckTimers (wait, out pollTimeout);
186+
187+
return checkTimersResult || n >= KEY_RESIZE;
189188
}
190189

191190
bool CheckTimers (bool wait, out int pollTimeout)

0 commit comments

Comments
 (0)