boon

unix terminal framework
git clone https://git.ce9e.org/boon.git

commit
9047839dd90fd1f049c25c2c903bda429f69313e
parent
11d0b6ba5936182cc7f2ecf33b1a0eb7a13f3f13
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2020-07-12 18:44
reorder functions

Diffstat

M boon.py 28 ++++++++++++++--------------

1 files changed, 14 insertions, 14 deletions


diff --git a/boon.py b/boon.py

@@ -27,16 +27,6 @@ KEY_RIGHT = CSI + 'C'
   27    27 KEY_LEFT = CSI + 'D'
   28    28 
   29    29 
   30    -1 def get_size():
   31    -1 	# curses.tigetnum('cols') does not update on resize
   32    -1 	try:
   33    -1 		raw = ioctl(sys.stdout, termios.TIOCGWINSZ, '\000' * 8)
   34    -1 		parsed = struct.unpack('hhhh', raw)
   35    -1 		return parsed[0], parsed[1]
   36    -1 	except OSError:
   37    -1 		return 0, 0
   38    -1 
   39    -1 
   40    30 def isatty():
   41    31 	return os.isatty(sys.stdout.fileno())
   42    32 
@@ -53,6 +43,20 @@ def get_cap(cap, *args):
   53    43 	return code.decode('ascii')
   54    44 
   55    45 
   -1    46 def move(y, x):
   -1    47 	sys.stdout.write(get_cap('cup', y, x))
   -1    48 
   -1    49 
   -1    50 def get_size():
   -1    51 	# curses.tigetnum('cols') does not update on resize
   -1    52 	try:
   -1    53 		raw = ioctl(sys.stdout, termios.TIOCGWINSZ, '\000' * 8)
   -1    54 		parsed = struct.unpack('hhhh', raw)
   -1    55 		return parsed[0], parsed[1]
   -1    56 	except OSError:
   -1    57 		return 0, 0
   -1    58 
   -1    59 
   56    60 @contextmanager
   57    61 def tty_restore(fd):
   58    62 	old = termios.tcgetattr(fd)
@@ -93,10 +97,6 @@ def getch(timeout=0.5):
   93    97 		return os.read(fd, 8).decode('ascii')
   94    98 
   95    99 
   96    -1 def move(y, x):
   97    -1 	sys.stdout.write(get_cap('cup', y, x))
   98    -1 
   99    -1 
  100   100 class App:
  101   101 	def __init__(self):
  102   102 		self.old_lines = []