Otherwise, pressing M-g (in pterm, which curses will interpret as ESC
g, just as I'd want it to) delivers the ESC, but leaves the g in
curses's internal buffer, which we don't empty before diving back into
the select loop.
self.scr.keypad(1)
self.scr.scrollok(1)
+ self.scr.nodelay(1) # so we can use getch() via a select loop
curses.noecho()
self.scr_h, self.scr_w = self.scr.getmaxyx()
self.print_at(y, 0, text.ColouredString(' ' * self.scr_w))
def get_input(self):
+ # There might be keystrokes still in curses's buffer from a
+ # previous read from stdin, so deal with those before we go
+ # back to the select loop
+ ch = self.scr.getch()
+ if ch != curses.ERR:
+ return ch
+
rfds_in = [0]
for (sp, handler, _) in self.selfpipes:
rfds_in.append(sp.rfd)