A line oriented chat front end for ii.
git clone git://
Log | Files | Refs | README

commit 19b4d99293ad470c98406b94935565750339b716
parent 6e73830497114901db5f864abc76b2964283fa77
Author: Tom Schwindl <>
Date:   Thu, 29 Dec 2022 13:02:59 +0100

Refactor headers

contains common operations for the `slackline` struct not meant to be used
outside of slackline.

contains the API for slackline. The `slackline` struct may become opaque
in the future.

Mslackline.h | 6++++--
Aslackline_internals.h | 14++++++++++++++
2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/slackline.h b/slackline.h @@ -1,9 +1,8 @@ #ifndef SLACKLIINE_H #define SLACKLIINE_H -#include <stdbool.h> - enum esc_seq {ESC_NONE, ESC, ESC_BRACKET, ESC_BRACKET_NUM}; +enum mode {SL_DEFAULT, SL_EMACS, SL_VI}; struct slackline { /* buffer */ @@ -26,11 +25,14 @@ struct slackline { /* UTF-8 handling */ char ubuf[6]; /* UTF-8 buffer */ size_t ubuf_len; + + enum mode mode; }; struct slackline *sl_init(void); void sl_free(struct slackline *sl); void sl_reset(struct slackline *sl); int sl_keystroke(struct slackline *sl, int key); +void sl_mode(struct slackline *sl, enum mode mode); #endif diff --git a/slackline_internals.h b/slackline_internals.h @@ -0,0 +1,14 @@ +#ifndef SLACKLINE_INTERNALS_H +#define SLACKLINE_INTERNALS_H + +#include "slackline.h" + +enum direction {LEFT, RIGHT, HOME, END}; + +size_t sl_postobyte(struct slackline *sl, size_t pos); +char *sl_postoptr(struct slackline *sl, size_t pos); +void sl_backspace(struct slackline *sl); +void sl_move(struct slackline *sl, enum direction dir); +void sl_emacs(struct slackline *sl, int key); + +#endif