boon

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

commit
e7921dd2b14ad5ad7c01581f2c28118be1bf3a4b
parent
50a4c218124e64f13a71d3321c2daae0e0d63f52
Author
Tobias Bengfort <tobias.bengfort@posteo.de>
Date
2020-07-11 15:34
restore move_cursor function

Diffstat

M boon.py 8 ++++++--

1 files changed, 6 insertions, 2 deletions


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

@@ -98,6 +98,10 @@ def getch():
   98    98 # 	return OSC + '2;' + title + BEL
   99    99 
  100   100 
   -1   101 def cursor_move(x, y):
   -1   102 	sys.stdout.write(get_cap('cup', y, x))
   -1   103 
   -1   104 
  101   105 class App:
  102   106 	def __init__(self):
  103   107 		self.old_lines = []
@@ -108,12 +112,12 @@ class App:
  108   112 		for i, line in enumerate(lines):
  109   113 			if len(self.old_lines) > i and line == self.old_lines[i]:
  110   114 				continue
  111    -1 			sys.stdout.write(get_cap('cup', i, 0))
   -1   115 			cursor_move(0, i)
  112   116 			sys.stdout.write(get_cap('el'))
  113   117 			sys.stdout.write(line)
  114   118 
  115   119 		# clear rest of screen
  116    -1 		sys.stdout.write(get_cap('cup', len(lines), 0))
   -1   120 		cursor_move(0, len(lines))
  117   121 		sys.stdout.write(get_cap('ed'))
  118   122 		sys.stdout.flush()
  119   123