summaryrefslogtreecommitdiff
path: root/ted.h
diff options
context:
space:
mode:
authorLeo Tenenbaum <pommicket@gmail.com>2021-01-18 16:37:51 -0500
committerLeo Tenenbaum <pommicket@gmail.com>2021-01-18 16:37:51 -0500
commita3adbe5ea6015a76a3df84ee5942b89fbb762947 (patch)
tree712d0fdfaf23818ebf2b361306dbb9d4452e6540 /ted.h
parent37102a766e1913cd0548a981e5c601852ae47963 (diff)
opening files kinda working
Diffstat (limited to 'ted.h')
-rw-r--r--ted.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/ted.h b/ted.h
index 5cc5f4e..b0e325b 100644
--- a/ted.h
+++ b/ted.h
@@ -1,3 +1,5 @@
+#define TED_PATH_MAX 256
+
#define TEXT_SIZE_MIN 6
#define TEXT_SIZE_MAX 70
@@ -22,7 +24,7 @@ typedef struct {
#define KEY_MODIFIER_ALT (1<<KEY_MODIFIER_ALT_BIT)
// ctrl+alt+c is encoded as SDL_SCANCODE_C << 3 | KEY_MODIFIER_CTRL | KEY_MODIFIER_ALT
-typedef struct {
+typedef struct KeyAction {
u32 line_number; // config line number where this was set
Command command; // this will be 0 (COMMAND_UNKNOWN) if there's no action for the key
i64 argument;
@@ -50,11 +52,12 @@ typedef struct BufferEdit {
} BufferEdit;
typedef struct {
- char const *filename;
+ char *filename; // NULL if this buffer doesn't correspond to a file (e.g. line buffers)
struct Ted *ted; // we keep a back-pointer to the ted instance so we don't have to pass it in to every buffer function
double scroll_x, scroll_y; // number of characters scrolled in the x/y direction
BufferPos cursor_pos;
BufferPos selection_pos; // if selection is true, the text between selection_pos and cursor_pos is selected.
+ bool is_line_buffer; // "line buffers" are buffers which can only have one line of text (used for inputs)
bool selection;
bool store_undo_events; // set to false to disable undo events
float x1, y1, x2, y2;
@@ -80,6 +83,8 @@ typedef struct Ted {
Settings settings;
float window_width, window_height;
Menu menu;
+ TextBuffer line_buffer; // general-purpose line buffer for inputs -- used for menus
+ TextBuffer main_buffer;
KeyAction key_actions[KEY_COMBO_COUNT];
char error[256];
} Ted;