[PATCH 2 of 3] ui: prompt_key -- like prompt, but inputs only one keystroke
Kirill Smelkov
kirr at mns.spb.ru
Wed Dec 26 09:30:06 UTC 2007
Bryan,
first of all, thanks for review!
В сообщении от 26 декабря 2007 08:07 Bryan O'Sullivan написал(a):
> Kirill Smelkov wrote:
> > - def prompt(self, msg, pat=None, default="y", matchflags=0):
> > + def prompt(self, msg, pat=None, default="y", matchflags=0,
> > inputflags=0): if not self.interactive: return default
> > try:
> > - r = self._readline(msg + ' ')
> > + if inputflags & INPUT_KEYSTROKE:
> > + self.write(msg + ' ')
> > + self.flush()
> > + r = util.getch()
> > + self.write(r + '\n')
> > + else:
> > + r = self._readline(msg + ' ')
> > +
>
> It will be less work to simply write a new function instead of crufting
> this one up.
I originally wanted to do what you write, but realized that we'll need to
duplicate:
- matching code
- response recognized/ not recognized
- EOFError handling
So the new function only makes sence to me if it will have simpler interface.
I need advice here.
Kirill.
More information about the Mercurial-devel
mailing list