diff options
author | C. McEnroe | 2020-09-01 20:35:17 -0400 |
---|---|---|
committer | C. McEnroe | 2020-09-01 20:36:50 -0400 |
commit | ded2b6afb602719a52c3b4934cec5327dc8d3d1a (patch) | |
tree | 6d4bda91296aebd66bdd53351a4854a5921fd648 /chat.h | |
parent | a98fd70aacc34045d9e1ea8e2d3562a4357fdd16 (diff) |
Factor buffer out of ui
In preparation for doing line wrapping outside of ncurses.
Diffstat (limited to 'chat.h')
-rw-r--r-- | chat.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/chat.h b/chat.h index 3668bcd..d53c7fe 100644 --- a/chat.h +++ b/chat.h @@ -276,6 +276,23 @@ void uiFormat( void uiLoad(const char *name); int uiSave(const char *name); +enum { BufferCap = 1024 }; +struct Buffer; +struct Line { + enum Heat heat; + time_t time; + char *str; +}; +struct Buffer *bufferAlloc(void); +void bufferFree(struct Buffer *buffer); +const struct Line *bufferSoft(const struct Buffer *buffer, size_t i); +const struct Line *bufferHard(const struct Buffer *buffer, size_t i); +void bufferPush( + struct Buffer *buffer, int cols, + enum Heat heat, time_t time, const char *str +); +void bufferReflow(struct Buffer *buffer, int cols); + enum Edit { EditHead, EditTail, |