noncanon_input.py 文件源码

python
阅读 29 收藏 0 点赞 0 评论 0

项目:FrozenBottle 作者: freieslabor 项目源码 文件源码
def getch(self):
        c = self.getbyt()
        if c is None:
            return None
        #print self.getbyt_avail()
        if self.posix:
            # for posix, keep possing input until have a full, valid escape code.
            while self.is_escape_code(c)<0:
                n = self.getbyt()
                if n is None:
                    break
                c = c+n
            if self.is_escape_code(c)<1:
                self.ungetbyt(c[1:])
                c = c[0]
        else:
            # for windows, get another byte if an extended symbol, then map.
            if c=='\xE0' or c=='\x00':
                n = self.getbyt()
                if n is not None:
                    c = c+n
            # mapping from windows-dosbox inputs to posix-terminal inputs
            if c in self._winmap:
                c = self._winmap[c]
        return c
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号