MCPcopy Create free account
hub / github.com/RetiredWizard/PyDOS / get_input

Method get_input

pye.py:234–266  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

232 self.message += "{} Bytes Memory available".format(gc.mem_free())
233 self.changed = '' if self.hash == self.hash_buffer() else '*'
234 def get_input(self):
235 while True:
236 in_buffer = self.io_device.rd()
237 if in_buffer[0] == '\x1b':
238 while True:
239 in_buffer += self.io_device.rd()
240 c = in_buffer[-1]
241 if c == '~' or (c.isalpha() and len(in_buffer) > 2):
242 break
243 if len(in_buffer) == 2 and c.isalpha() and c != 'O':
244 in_buffer = chr(ord(in_buffer[1]) & 0x1f)
245 break
246 if len(in_buffer) >= self.key_max:
247 break
248 if in_buffer == '\x1b\x1b':
249 in_buffer = '\x1b'
250 break
251 if in_buffer in Editor.KEYMAP:
252 c = Editor.KEYMAP[in_buffer]
253 if c != KEY_MOUSE:
254 return c, None
255 else:
256 mouse_fct = ord(self.io_device.rd_raw())
257 mouse_x = ord(self.io_device.rd_raw()) - 33
258 mouse_y = ord(self.io_device.rd_raw()) - 33
259 if mouse_fct == 0x61:
260 return KEY_SCRLDN, 3
261 elif mouse_fct == 0x60:
262 return KEY_SCRLUP, 3
263 else:
264 return KEY_MOUSE, [mouse_x, mouse_y, mouse_fct]
265 elif ord(in_buffer[0]) >= 32:
266 return KEY_NONE, in_buffer
267 def display_window(self):
268 self.cur_line = min(self.total_lines - 1, max(self.cur_line, 0))
269 self.vcol = max(0, min(self.col, len(self.content[self.cur_line])))

Callers 3

line_editMethod · 0.95
handle_edit_keysMethod · 0.95
edit_loopMethod · 0.95

Calls 2

rdMethod · 0.45
rd_rawMethod · 0.45

Tested by

no test coverage detected