diff options
| author | Eugene Triguba <eugenetriguba@gmail.com> | 2025-06-29 20:48:41 -0400 |
|---|---|---|
| committer | Eugene Triguba <eugenetriguba@gmail.com> | 2025-06-29 20:48:41 -0400 |
| commit | 129a10d1ee57a047ae9a3084e175de1e7daf6ffe (patch) | |
| tree | 079c753b5a9e4856c121a1a2eb59dc6ceba9396f /include | |
| parent | Ignore .cache (diff) | |
| download | cli-129a10d1ee57a047ae9a3084e175de1e7daf6ffe.zip | |
Fix justify behavior
Diffstat (limited to '')
| -rw-r--r-- | include/linebuffer.h (renamed from src/linebuffer.h) | 15 | ||||
| -rw-r--r-- | include/strlcat.h (renamed from src/strlcat.h) | 0 | ||||
| -rw-r--r-- | include/word.h (renamed from src/word.h) | 0 |
3 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. diff --git a/src/strlcat.h b/include/strlcat.h index 0470b83..0470b83 100644 --- a/src/strlcat.h +++ b/include/strlcat.h diff --git a/src/word.h b/include/word.h index b5d94b5..b5d94b5 100644 --- a/src/word.h +++ b/include/word.h |