Process editor(1) input immediately.
This commit is contained in:
parent
22b59a8f6f
commit
03329cae6a
1 changed files with 12 additions and 3 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2013, 2014, 2016 Jonas 'Sortie' Termansen.
|
||||
* Copyright (c) 2013, 2014, 2016, 2024 Jonas 'Sortie' Termansen.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <poll.h>
|
||||
#include <signal.h>
|
||||
#include <stdbool.h>
|
||||
#include <stddef.h>
|
||||
|
@ -257,7 +258,7 @@ void editor_input_begin(struct editor_input* editor_input)
|
|||
}
|
||||
}
|
||||
|
||||
void editor_input_process(struct editor_input* editor_input,
|
||||
void editor_input_process_byte(struct editor_input* editor_input,
|
||||
struct editor* editor)
|
||||
{
|
||||
unsigned char uc;
|
||||
|
@ -352,6 +353,14 @@ void editor_input_process(struct editor_input* editor_input,
|
|||
}
|
||||
}
|
||||
|
||||
void editor_input_process(struct editor_input* editor_input,
|
||||
struct editor* editor)
|
||||
{
|
||||
struct pollfd pfd = { .fd = 0, .events = POLLIN };
|
||||
do editor_input_process_byte(editor_input, editor);
|
||||
while ( poll(&pfd, 1, 0) == 1 );
|
||||
}
|
||||
|
||||
void editor_input_end(struct editor_input* editor_input)
|
||||
{
|
||||
if ( getenv("TERM") && strcmp(getenv("TERM"), "sortix") != 0 )
|
||||
|
|
Loading…
Reference in a new issue