summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCalvin Morrison <mutantturkey@gmail.com>2013-07-23 14:39:54 -0400
committerCalvin Morrison <mutantturkey@gmail.com>2013-07-23 14:39:54 -0400
commit1bf082a5156667efa1adb9212fc0040ffa158230 (patch)
tree99a179c53512ca1f78fe09321775cdf3461f0fd7
parente353b1b17701e54a0d9f93e42b1956acdf253cc7 (diff)
add support for resize and enter creation of new row
-rwxr-xr-xpc.py21
1 files changed, 15 insertions, 6 deletions
diff --git a/pc.py b/pc.py
index 48d51b5..b3e64a9 100755
--- a/pc.py
+++ b/pc.py
@@ -90,7 +90,10 @@ def main(argv):
enable_array = [];
pipe_array.append("");
current_pipe = 0;
-
+ key = 0
+
+ global cols
+ global rows
global input_buffer
try:
@@ -110,7 +113,16 @@ def main(argv):
while 1:
key = screen.getch()
screen.clear()
- screen.addstr(rows - 1, 0, str(key) + " " + str(current_pipe))
+ screen.addstr(rows - 1, 0, argv[1] + " " + str(key) + " " + str(current_pipe))
+ if(key == 410):
+ cols = int(subprocess.check_output(["tput", "cols"]))
+ rows = int(subprocess.check_output(["tput", "lines"]))
+ # ENTER
+ if(key == 10):
+ pipe_array.insert(current_pipe+1, "")
+ current_pipe = current_pipe + 1
+ update(pipe_array, current_pipe)
+ continue
# UP
if(key == 259):
if(current_pipe is not 0):
@@ -132,11 +144,8 @@ def main(argv):
if(current_pipe is not 0):
del pipe_array[current_pipe]
current_pipe = current_pipe - 1
- draw_pipes(pipe_array, current_pipe)
- screen.addstr(input_buffer)
- screen.addstr("EOF")
+ update(pipe_array, current_pipe)
continue;
- # ENTER
else:
if(key < 256):
pipe_array[current_pipe]+=chr(key)