CE edit status line
This commit is contained in:
12
ce/edit.c
12
ce/edit.c
@@ -77,9 +77,10 @@ static void update_vert_scroll (size_t screen_rows) {
|
|||||||
editor.row_offset = editor.cursor.line - (screen_rows - 1) + 1;
|
editor.row_offset = editor.cursor.line - (screen_rows - 1) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void edit_start (const char* text) {
|
void edit_start (const char* file_path, const char* text) {
|
||||||
prepare_lines (text);
|
prepare_lines (text);
|
||||||
struct arena temp_arena;
|
struct arena temp_arena;
|
||||||
|
memset (&temp_arena, 0, sizeof (temp_arena));
|
||||||
size_t cols, rows;
|
size_t cols, rows;
|
||||||
|
|
||||||
terminal_dimensions (&cols, &rows);
|
terminal_dimensions (&cols, &rows);
|
||||||
@@ -145,6 +146,15 @@ void edit_start (const char* text) {
|
|||||||
current_idx++;
|
current_idx++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
w = snprintf (bbptr, bb_remaining, ANSIQ_DYN_CUR_SET ANSIQ_SCR_CLR_LINE, (int)rows, 1);
|
||||||
|
bbptr += w;
|
||||||
|
bb_remaining -= w;
|
||||||
|
|
||||||
|
w = snprintf (bbptr, bb_remaining, "Editing %s; line %zu col %zu", file_path,
|
||||||
|
editor.cursor.line, editor.cursor.col);
|
||||||
|
bbptr += w;
|
||||||
|
bb_remaining -= w;
|
||||||
|
|
||||||
w = snprintf (bbptr, bb_remaining, ANSIQ_DYN_CUR_SET ANSIQ_CUR_VISIBLE,
|
w = snprintf (bbptr, bb_remaining, ANSIQ_DYN_CUR_SET ANSIQ_CUR_VISIBLE,
|
||||||
(int)(editor.cursor.line - editor.row_offset) + 1,
|
(int)(editor.cursor.line - editor.row_offset) + 1,
|
||||||
(int)(editor.cursor.col - editor.col_offset) + 1);
|
(int)(editor.cursor.col - editor.col_offset) + 1);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#ifndef _EDIT_H
|
#ifndef _EDIT_H
|
||||||
#define _EDIT_H
|
#define _EDIT_H
|
||||||
|
|
||||||
void edit_start (const char* text);
|
void edit_start (const char* path, const char* text);
|
||||||
|
|
||||||
#endif // _EDIT_H
|
#endif // _EDIT_H
|
||||||
|
|||||||
@@ -235,7 +235,7 @@ static void edit (struct context* context, const char* path_string) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
edit_start (str);
|
edit_start (path_string, str);
|
||||||
|
|
||||||
volume_close ();
|
volume_close ();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
#define ANSIQ_SCR_CLR_SAV ANSIQ_ESC"[3J" // Clear saved lines
|
#define ANSIQ_SCR_CLR_SAV ANSIQ_ESC"[3J" // Clear saved lines
|
||||||
#define ANSIQ_SCR_CLR2LEND ANSIQ_ESC"[0K" // Clear to end of line
|
#define ANSIQ_SCR_CLR2LEND ANSIQ_ESC"[0K" // Clear to end of line
|
||||||
#define ANSIQ_SCR_CLR2LBEG ANSIQ_ESC"[1K" // Clear to begining of line
|
#define ANSIQ_SCR_CLR2LBEG ANSIQ_ESC"[1K" // Clear to begining of line
|
||||||
#define ANSIQ_SCR_CLR_LINE ANSIQ_ESC"[1K" // Clear entire line
|
#define ANSIQ_SCR_CLR_LINE ANSIQ_ESC"[2K" // Clear entire line
|
||||||
#define ANSIQ_SCR_RESTORE ANSIQ_ESC"[?47l"
|
#define ANSIQ_SCR_RESTORE ANSIQ_ESC"[?47l"
|
||||||
#define ANSIQ_SCR_SAVE ANSIQ_ESC"[?47h"
|
#define ANSIQ_SCR_SAVE ANSIQ_ESC"[?47h"
|
||||||
/* clang-format on */
|
/* clang-format on */
|
||||||
|
|||||||
Reference in New Issue
Block a user