|
@@ -75,6 +75,7 @@ tinyrl_t *tinyrl_new(FILE *istream, FILE *ostream,
|
|
tinyrl->echo_char = '\0';
|
|
tinyrl->echo_char = '\0';
|
|
tinyrl->echo_enabled = BOOL_TRUE;
|
|
tinyrl->echo_enabled = BOOL_TRUE;
|
|
tinyrl->utf8 = BOOL_TRUE;
|
|
tinyrl->utf8 = BOOL_TRUE;
|
|
|
|
+ tinyrl->busy = BOOL_FALSE;
|
|
|
|
|
|
// VT100 terminal
|
|
// VT100 terminal
|
|
tinyrl->term = vt100_new(istream, ostream);
|
|
tinyrl->term = vt100_new(istream, ostream);
|
|
@@ -224,6 +225,26 @@ void tinyrl_set_utf8(tinyrl_t *tinyrl, bool_t utf8)
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+bool_t tinyrl_busy(const tinyrl_t *tinyrl)
|
|
|
|
+{
|
|
|
|
+ assert(tinyrl);
|
|
|
|
+ if (!tinyrl)
|
|
|
|
+ return BOOL_FALSE;
|
|
|
|
+
|
|
|
|
+ return tinyrl->busy;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+void tinyrl_set_busy(tinyrl_t *tinyrl, bool_t busy)
|
|
|
|
+{
|
|
|
|
+ assert(tinyrl);
|
|
|
|
+ if (!tinyrl)
|
|
|
|
+ return;
|
|
|
|
+
|
|
|
|
+ tinyrl->busy = busy;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+
|
|
const char *tinyrl_prompt(const tinyrl_t *tinyrl)
|
|
const char *tinyrl_prompt(const tinyrl_t *tinyrl)
|
|
{
|
|
{
|
|
assert(tinyrl);
|
|
assert(tinyrl);
|
|
@@ -373,10 +394,16 @@ int tinyrl_read(tinyrl_t *tinyrl)
|
|
|
|
|
|
assert(tinyrl);
|
|
assert(tinyrl);
|
|
|
|
|
|
|
|
+ // Some commands can't be processed immediately by handlers and need some
|
|
|
|
+ // network exchange for example. In this case we will not execute
|
|
|
|
+ // redisplay() after char processing because command is not really
|
|
|
|
+ // finished. Drop busy flag here because engine ready to get new input.
|
|
|
|
+ tinyrl_set_busy(tinyrl, BOOL_FALSE);
|
|
|
|
+
|
|
while ((rc = vt100_getchar(tinyrl->term, &key)) > 0) {
|
|
while ((rc = vt100_getchar(tinyrl->term, &key)) > 0) {
|
|
count++;
|
|
count++;
|
|
process_char(tinyrl, key);
|
|
process_char(tinyrl, key);
|
|
- if (!tinyrl->utf8_cont) {
|
|
|
|
|
|
+ if (!tinyrl->utf8_cont && !tinyrl_busy(tinyrl)) {
|
|
tinyrl_redisplay(tinyrl);
|
|
tinyrl_redisplay(tinyrl);
|
|
// printf("%s\n", tinyrl->line.str);
|
|
// printf("%s\n", tinyrl->line.str);
|
|
}
|
|
}
|