~arivigo/sline

e70ce36f53845b8a78a1b43a7a28393b43066068 — Ariadna Vigo 6 months ago 4f6e122
Ignoring tabs in input

Tabs are currently ignored by sline in input to avoid the screen and
buffer to get out of sync due to variable tab widths. There doesn't
seem to be any benefit in trying to handle tabs, as sline doesn't
support multi-line editing, where tab-indentation might be of help.
By definining a specific VT_TAB symbol for the internal VT-100 driver,
everything is set in place for implementing some type of user-definable
tab-completion in a future version of sline.
1 files changed, 3 insertions(+), 0 deletions(-)

M sline.c
M sline.c => sline.c +3 -0
@@ 23,6 23,7 @@ enum {
	VT_DLT,
	VT_EOF,
	VT_RET,
	VT_TAB, /* Tab is ignored by now. */
	VT_UP,
	VT_DWN,
	VT_LFT,


@@ 214,6 215,8 @@ term_key(char *utf8)
		return VT_EOF;
	} else if (key == '\x0a') {
		return VT_RET;
	} else if (key == '\t') {
		return VT_TAB;
	} else if ((nbytes = utf8_nbytes(&key)) > 1) {
		utf8[0] = key;
		read(STDIN_FILENO, utf8 + 1, nbytes - 1);