aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorDavid Walter Seikel2014-02-01 16:30:17 +1000
committerDavid Walter Seikel2014-02-01 16:30:17 +1000
commit17795ec40072435ffa55c59825ea5fe219d0b1d0 (patch)
treeccd29d3241ab1e4818365cdb87e8c0b5cf066014
parentRejig the joe commands a little. Now we have a quit. (diff)
downloadboxes-17795ec40072435ffa55c59825ea5fe219d0b1d0.zip
boxes-17795ec40072435ffa55c59825ea5fe219d0b1d0.tar.gz
boxes-17795ec40072435ffa55c59825ea5fe219d0b1d0.tar.bz2
boxes-17795ec40072435ffa55c59825ea5fe219d0b1d0.tar.xz
Fixed dumbsh end of screen handling.
-rw-r--r--dumbsh.c13
1 files changed, 5 insertions, 8 deletions
diff --git a/dumbsh.c b/dumbsh.c
index 5f2c63e..a36e265 100644
--- a/dumbsh.c
+++ b/dumbsh.c
@@ -39,15 +39,10 @@ GLOBALS(
39static void updateLine() 39static void updateLine()
40{ 40{
41 if (0 > TT.x) TT.x = 0; 41 if (0 > TT.x) TT.x = 0;
42 if (strlen(toybuf) <= TT.x) TT.x = strlen(toybuf);
43 if (TT.w < TT.x) TT.x = TT.w;
44 if (0 > TT.y) TT.y = 0; 42 if (0 > TT.y) TT.y = 0;
45 if (TT.h < TT.y) 43 if (TT.w < TT.x) TT.x = TT.w;
46 { 44 if (TT.h < TT.y) TT.y = TT.h;
47 printf("\x1B[%d;0H\n", TT.y + 1); 45 if (strlen(toybuf) < TT.x) TT.x = strlen(toybuf);
48 fflush(stdout);
49 TT.y = TT.h;
50 }
51 printf("\x1B[%d;0H%-*s\x1B[%d;%dH", 46 printf("\x1B[%d;0H%-*s\x1B[%d;%dH",
52 TT.y + 1, TT.w, toybuf, TT.y + 1, TT.x + 1); 47 TT.y + 1, TT.w, toybuf, TT.y + 1, TT.x + 1);
53 fflush(stdout); 48 fflush(stdout);
@@ -115,6 +110,8 @@ static void doCommand()
115 toybuf[0] = 0; 110 toybuf[0] = 0;
116 TT.x = 0; 111 TT.x = 0;
117 TT.y++; 112 TT.y++;
113 printf("\n");
114 fflush(stdout);
118 updateLine(); 115 updateLine();
119} 116}
120 117