CE edit handle tab key
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m11s
All checks were successful
Build documentation / build-and-deploy (push) Successful in 2m11s
This commit is contained in:
@@ -23,6 +23,8 @@
|
||||
|
||||
#define STATUS_LINE_STYLE ANSIQ_GR_SEQ (ANSIQ_BG_RGB (240, 191, 88) ANSIQ_FG_BLACK)
|
||||
|
||||
#define TAB_INSERT " "
|
||||
|
||||
struct edit_line {
|
||||
struct list_node_link lines_link;
|
||||
struct gapbuffer gb;
|
||||
@@ -229,6 +231,13 @@ void edit_start (const char* file_path, const char* text) {
|
||||
gapbuffer_backspace (&editor.current_line->gb);
|
||||
}
|
||||
break;
|
||||
case '\t':
|
||||
gapbuffer_move (&editor.current_line->gb, editor.cursor.col);
|
||||
for (size_t i = 0; i < sizeof (TAB_INSERT) - 1; i++)
|
||||
gapbuffer_insert (&wrealloc, NULL, &editor.current_line->gb, TAB_INSERT[i]);
|
||||
|
||||
editor.cursor.col += sizeof (TAB_INSERT) - 1;
|
||||
break;
|
||||
case '\n': {
|
||||
gapbuffer_move (&editor.current_line->gb, editor.cursor.col);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user