[shell] Redraw prompt on ^L
This commit is contained in:
parent
63f57855bf
commit
65e6b0e800
@ -162,6 +162,7 @@ int kgets_collected = 0;
|
|||||||
int kgets_want = 0;
|
int kgets_want = 0;
|
||||||
int kgets_newline = 0;
|
int kgets_newline = 0;
|
||||||
int kgets_cancel = 0;
|
int kgets_cancel = 0;
|
||||||
|
kgets_redraw_t kgets_redraw_func = NULL;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
kwrite(
|
kwrite(
|
||||||
@ -192,6 +193,9 @@ kgets_handler(
|
|||||||
return;
|
return;
|
||||||
} else if (ch == '\x0c') {
|
} else if (ch == '\x0c') {
|
||||||
kprintf("\033[J");
|
kprintf("\033[J");
|
||||||
|
if (kgets_redraw_func) {
|
||||||
|
kgets_redraw_func();
|
||||||
|
}
|
||||||
kprintf(kgets_buffer);
|
kprintf(kgets_buffer);
|
||||||
return;
|
return;
|
||||||
} else if (ch == '\n') {
|
} else if (ch == '\n') {
|
||||||
@ -234,6 +238,7 @@ kgets(
|
|||||||
buffer[kgets_collected] = '\0';
|
buffer[kgets_collected] = '\0';
|
||||||
/* Disable the buffer */
|
/* Disable the buffer */
|
||||||
keyboard_buffer_handler = NULL;
|
keyboard_buffer_handler = NULL;
|
||||||
|
kgets_redraw_func = NULL;
|
||||||
/* Return the string */
|
/* Return the string */
|
||||||
return kgets_collected;
|
return kgets_collected;
|
||||||
}
|
}
|
||||||
|
@ -328,6 +328,7 @@ start_shell() {
|
|||||||
char buffer[1024];
|
char buffer[1024];
|
||||||
int size;
|
int size;
|
||||||
/* Read commands */
|
/* Read commands */
|
||||||
|
kgets_redraw_func = redraw_shell;
|
||||||
size = kgets((char *)&buffer, 1023);
|
size = kgets((char *)&buffer, 1023);
|
||||||
if (size < 1) {
|
if (size < 1) {
|
||||||
continue;
|
continue;
|
||||||
|
@ -125,6 +125,8 @@ extern void mouse_install();
|
|||||||
extern void kprintf(const char *fmt, ...);
|
extern void kprintf(const char *fmt, ...);
|
||||||
extern int sprintf(char *buf, const char *fmt, ...);
|
extern int sprintf(char *buf, const char *fmt, ...);
|
||||||
extern int kgets(char *buf, int size);
|
extern int kgets(char *buf, int size);
|
||||||
|
typedef void (*kgets_redraw_t)();
|
||||||
|
extern kgets_redraw_t kgets_redraw_func;
|
||||||
|
|
||||||
/* Memory Management */
|
/* Memory Management */
|
||||||
extern uintptr_t placement_pointer;
|
extern uintptr_t placement_pointer;
|
||||||
|
Loading…
Reference in New Issue
Block a user