summaryrefslogtreecommitdiff
path: root/ted.h
diff options
context:
space:
mode:
Diffstat (limited to 'ted.h')
-rw-r--r--ted.h46
1 files changed, 43 insertions, 3 deletions
diff --git a/ted.h b/ted.h
index 59bdf65..7dc9602 100644
--- a/ted.h
+++ b/ted.h
@@ -28,7 +28,7 @@ extern "C" {
#include "sdl-inc.h"
/// Version number
-#define TED_VERSION "2.1"
+#define TED_VERSION "2.1r1"
/// Version string
#define TED_VERSION_FULL "ted v. " TED_VERSION
/// Maximum path size ted handles.
@@ -181,13 +181,23 @@ typedef struct {
/// extract key modifier from \ref KeyCombo
#define KEY_COMBO_MODIFIER(combo) ((u32)((combo.value) & 0xff))
+typedef struct {
+ const char *string;
+ i64 number;
+} CommandArgument;
+
+typedef struct {
+ bool from_macro;
+} CommandContext;
+
/// Thing to do when a key combo is pressed.
typedef struct {
KeyCombo key_combo;
Command command;
- i64 argument;
+ CommandArgument argument;
} KeyAction;
+
/// A SettingsContext is a context where a specific set of settings are applied.
/// this corresponds to `[PATH//LANGUAGE.(section)]` in config files.
typedef struct {
@@ -531,7 +541,12 @@ typedef struct {
typedef struct {
char *path;
- BufferPos pos;
+ u32 line;
+ u32 column;
+ /// if this is 1, then column == UTF-32 index.
+ /// if this is 4, for example, then column 4 in a line starting with a tab would
+ /// be the character right after the tab.
+ u8 columns_per_tab;
/// which line in the build output corresponds to this error
u32 build_output_line;
} BuildError;
@@ -695,6 +710,18 @@ typedef enum {
MESSAGE_ERROR
} MessageType;
+typedef struct {
+ Command command;
+ CommandArgument argument;
+} Action;
+
+typedef struct {
+ // dynamic array
+ Action *actions;
+} Macro;
+
+#define TED_MACRO_MAX 256
+
/// (almost) all data used by the ted application
typedef struct Ted {
/// all running LSP servers
@@ -702,6 +729,10 @@ typedef struct Ted {
/// current time (see time_get_seconds), as of the start of this frame
double frame_time;
+ Macro macros[TED_MACRO_MAX];
+ Macro *recording_macro;
+ bool executing_macro;
+
SDL_Window *window;
Font *font_bold;
Font *font;
@@ -914,6 +945,7 @@ u8 buffer_tab_width(TextBuffer *buffer);
bool buffer_indent_with_spaces(TextBuffer *buffer);
/// NOTE: this string will be invalidated when the line is edited!!!
/// only use it briefly!!
+/// returns an empty string if `line_number` is out of range.
String32 buffer_get_line(TextBuffer *buffer, u32 line_number);
/// get at most `nchars` characters starting from position `pos`.
/// returns the number of characters actually available.
@@ -1242,6 +1274,7 @@ void command_init(void);
Command command_from_str(const char *str);
const char *command_to_str(Command c);
void command_execute(Ted *ted, Command c, i64 argument);
+void command_execute_ex(Ted *ted, Command c, CommandArgument argument, CommandContext context);
// === config.c ===
/// first, we read all config files, then we parse them.
@@ -1461,6 +1494,13 @@ void usages_find(Ted *ted);
void usages_process_lsp_response(Ted *ted, const LSPResponse *response);
void usages_frame(Ted *ted);
+// === macro.c ===
+void macro_start_recording(Ted *ted, u32 index);
+void macro_stop_recording(Ted *ted);
+void macro_add(Ted *ted, Command command, CommandArgument argument);
+void macro_execute(Ted *ted, u32 index);
+void macros_free(Ted *ted);
+
// === menu.c ===
void menu_close(Ted *ted);
void menu_open(Ted *ted, Menu menu);