about summary refs log tree commit diff
path: root/chat.h
diff options
context:
space:
mode:
authorJune McEnroe <june@causal.agency>2020-09-01 20:35:17 -0400
committerJune McEnroe <june@causal.agency>2020-09-01 20:36:50 -0400
commitded2b6afb602719a52c3b4934cec5327dc8d3d1a (patch)
tree6d4bda91296aebd66bdd53351a4854a5921fd648 /chat.h
parentMove styleParse out of ui (diff)
downloadcatgirl-ded2b6afb602719a52c3b4934cec5327dc8d3d1a.tar.gz
catgirl-ded2b6afb602719a52c3b4934cec5327dc8d3d1a.zip
Factor buffer out of ui
In preparation for doing line wrapping outside of ncurses.
Diffstat (limited to 'chat.h')
-rw-r--r--chat.h17
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,