summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.c2
-rw-r--r--command.c3
-rw-r--r--command.h2
-rw-r--r--main.c2
-rw-r--r--ted.c16
-rw-r--r--ted.cfg1
6 files changed, 23 insertions, 3 deletions
diff --git a/build.c b/build.c
index cc6899d..376566f 100644
--- a/build.c
+++ b/build.c
@@ -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);
diff --git a/command.c b/command.c
index 402686c..29c76a8 100644
--- a/command.c
+++ b/command.c
@@ -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) {
diff --git a/command.h b/command.h
index 97812b0..49ffc09 100644
--- a/command.h
+++ b/command.h
@@ -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},
diff --git a/main.c b/main.c
index c30d86d..0b9aaef 100644
--- a/main.c
+++ b/main.c
@@ -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
diff --git a/ted.c b/ted.c
index bd3ac46..91471b4 100644
--- a/ted.c
+++ b/ted.c
@@ -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);
+ }
+}
diff --git a/ted.cfg b/ted.cfg
index 0ac455c..d98f0b8 100644
--- a/ted.cfg
+++ b/ted.cfg
@@ -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