aboutsummaryrefslogtreecommitdiffstats
path: root/src/linebuffer.h
diff options
context:
space:
mode:
authorEugene Triguba <eugenetriguba@gmail.com>2025-06-29 20:48:41 -0400
committerEugene Triguba <eugenetriguba@gmail.com>2025-06-29 20:48:41 -0400
commit129a10d1ee57a047ae9a3084e175de1e7daf6ffe (patch)
tree079c753b5a9e4856c121a1a2eb59dc6ceba9396f /src/linebuffer.h
parentIgnore .cache (diff)
downloadcli-129a10d1ee57a047ae9a3084e175de1e7daf6ffe.zip
Fix justify behavior
Diffstat (limited to '')
-rw-r--r--include/linebuffer.h (renamed from src/linebuffer.h)15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/linebuffer.h b/include/linebuffer.h
index 173bad3..a3d9e4c 100644
--- a/src/linebuffer.h
+++ b/include/linebuffer.h
@@ -2,6 +2,7 @@
#define LINEBUFFER_H
#include <stddef.h>
+#include <stdbool.h>
#include <stdio.h>
typedef struct {
@@ -40,8 +41,20 @@ void linebuffer_clear(LineBuffer *lb);
*
* @param lb The line buffer to append to.
* @param word The word to append.
+ *
+ * @retursns true if the word was appended; false if it could not fit.
+ */
+bool linebuffer_append_word(LineBuffer *lb, const char *word);
+
+/**
+ * @brief Check if a word can fit in the current line buffer.
+ *
+ * @param lb The line buffer to check.
+ * @param word The word to check.
+ *
+ * @returns true if the word can fit; false otherwise.
*/
-void linebuffer_append_word(LineBuffer *lb, const char *word);
+bool linebuffer_can_fit(LineBuffer *lb, const char *word);
/**
* @brief Check how many characters can be added.