be

based editor
git clone git://git.kocotian.pl/be.git
Log | Files | Refs | README | LICENSE

commit 8dbf5453a710ebb912a497d2eb5a1abd88a236d7
parent 885ebd203160a99fa83952eb1af62258294d50e3
Author: kocotian <kocotian@kocotian.pl>
Date:   Mon, 19 Apr 2021 13:39:31 +0200

Refreshing on editorGetKey()

Diffstat:
Mbe.c | 14++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/be.c b/be.c @@ -109,8 +109,8 @@ static void abFree(String *ab); /*********/ static unsigned char editorGetKey(void); static void editorParseKey(unsigned char key); -static void edit(void); -static void switchmode(Mode mode); +static inline void edit(void); +static inline void switchmode(Mode mode); /*********/ static void newBuffer(Buffer *buf); static void freeBuffer(Buffer *buf); @@ -302,6 +302,7 @@ editorGetKey(void) ssize_t rb; unsigned char c; + termRefresh(); while ((rb = read(STDIN_FILENO, &c, 1)) != 1) if (rb < 0 && errno != EAGAIN) die("read:"); @@ -330,16 +331,13 @@ editorParseKey(unsigned char key) } } -static void +static inline void edit(void) { - while (editor.bufs.len - 1) { - termRefresh(); - editorParseKey(editorGetKey()); - } + while (editor.bufs.len - 1) editorParseKey(editorGetKey()); } -static void +static inline void switchmode(Mode mode) { CURBUF(editor).mode = mode;