diff options
author | Leo Tenenbaum <pommicket@gmail.com> | 2021-04-04 19:36:57 -0400 |
---|---|---|
committer | Leo Tenenbaum <pommicket@gmail.com> | 2021-04-04 19:36:57 -0400 |
commit | 2007d299916be6b079e6b97aea7c4d2835e23bd0 (patch) | |
tree | e8c1fc1000f1822e49e7b724da373fe31166f88e | |
parent | 36444b69593008f40ee2d0b47c894e37428435ae (diff) |
command to reload all buffers, run make on multiple threads
-rw-r--r-- | build.c | 2 | ||||
-rw-r--r-- | command.c | 3 | ||||
-rw-r--r-- | command.h | 2 | ||||
-rw-r--r-- | main.c | 2 | ||||
-rw-r--r-- | ted.c | 16 | ||||
-rw-r--r-- | ted.cfg | 1 |
6 files changed, 23 insertions, 3 deletions
@@ -78,7 +78,7 @@ static void build_start(Ted *ted) { if (cargo) { command = "cargo build"; } else if (make) { - command = "make"; + command = "make -j12"; } build_start_with_command(ted, command); @@ -191,6 +191,9 @@ void command_execute(Ted *ted, Command c, i64 argument) { case CMD_SAVE_ALL: ted_save_all(ted); break; + case CMD_RELOAD_ALL: + ted_reload_all(ted); + break; case CMD_QUIT: // pass argument of 2 to override dialog if (argument == 2) { @@ -52,6 +52,7 @@ ENUM_U16 { CMD_REDO, CMD_COMMAND_SELECTOR, CMD_OPEN_CONFIG, + CMD_RELOAD_ALL, // reload all buffers from file CMD_QUIT, CMD_AUTOCOMPLETE, @@ -137,6 +138,7 @@ static CommandName const command_names[] = { {"save", CMD_SAVE}, {"save-as", CMD_SAVE_AS}, {"save-all", CMD_SAVE_ALL}, + {"reload-all", CMD_RELOAD_ALL}, {"quit", CMD_QUIT}, {"command-selector", CMD_COMMAND_SELECTOR}, {"open-config", CMD_OPEN_CONFIG}, @@ -1,6 +1,4 @@ // @TODO: -// - bug involving load file when going to error (specifically, stuff like ./main.c) -- duplicate file opening -// - command to reload all (unsaved) buffers // - terminate process not working on windows? // - auto-regenerate tags (if no tag found/line number tag found) // - comment/uncomment selection @@ -1,4 +1,5 @@ static void menu_open(Ted *ted, Menu menu); +static void menu_close(Ted *ted); static void find_update(Ted *ted, bool force); static Command command_from_str(char const *str); @@ -317,3 +318,18 @@ static bool ted_save_all(Ted *ted) { } return success; } + +static void ted_reload_all(Ted *ted) { + bool *buffers_used = ted->buffers_used; + for (u64 i = 0; i < TED_MAX_BUFFERS; ++i) { + if (buffers_used[i]) { + TextBuffer *buffer = &ted->buffers[i]; + if (!buffer_unsaved_changes(buffer)) { + buffer_reload(buffer); + } + } + } + if (ted->menu == MENU_ASK_RELOAD) { + menu_close(ted); + } +} @@ -86,6 +86,7 @@ Ctrl+s = :save Ctrl+Alt+Shift+s = :save-all Ctrl+Shift+s = :save-as Ctrl+q = :quit +Ctrl+Shift+r = :reload-all Ctrl+Space = :autocomplete # go to previous completion |