diff options
| -rw-r--r-- | dumbsh.c | 13 |
1 files changed, 5 insertions, 8 deletions
| @@ -39,15 +39,10 @@ GLOBALS( | |||
| 39 | static void updateLine() | 39 | static 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 | ||
