summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--buffer.c2
-rw-r--r--main.c2
-rw-r--r--syntax.c2
-rw-r--r--ted.c9
-rw-r--r--ted.h2
5 files changed, 11 insertions, 6 deletions
diff --git a/buffer.c b/buffer.c
index 65a90ab..4ee4fbd 100644
--- a/buffer.c
+++ b/buffer.c
@@ -2182,7 +2182,7 @@ bool buffer_save(TextBuffer *buffer) {
buffer->undo_history_write_pos = arr_len(buffer->undo_history);
char const *name = buffer->filename ? path_filename(buffer->filename) : TED_UNTITLED;
if (streq(name, "ted.cfg") && buffer_settings(buffer)->auto_reload_config) {
- ted_load_configs(buffer->ted);
+ ted_load_configs(buffer->ted, true);
}
}
return success;
diff --git a/main.c b/main.c
index 448da87..2857869 100644
--- a/main.c
+++ b/main.c
@@ -398,7 +398,7 @@ int main(int argc, char **argv) {
PROFILE_TIME(misc_end)
PROFILE_TIME(configs_start)
- ted_load_configs(ted);
+ ted_load_configs(ted, false);
if (ted_haserr(ted)) {
strcpy(config_err, ted->error);
ted_clearerr(ted); // clear the error so later things (e.g. loading font) don't detect an error
diff --git a/syntax.c b/syntax.c
index 97d0554..3b477e9 100644
--- a/syntax.c
+++ b/syntax.c
@@ -1090,7 +1090,7 @@ static void syntax_highlight_javascript(SyntaxState *state, char32_t const *line
// this is not foolproof for detecting regex literals
// but should handle all "reasonable" uses of regex.
bool is_regex = i == 0 // slash is first char in line
- || (line[i-1] <= WCHAR_MAX && iswspace(line[i-1])) // slash preceded by space
+ || (line[i-1] <= WCHAR_MAX && iswspace((wint_t)line[i-1])) // slash preceded by space
|| (line[i-1] <= 128 && strchr(";({[=,:", (char)line[i-1])); // slash preceded by any of these characters
if (is_regex) {
in_string = true;
diff --git a/ted.c b/ted.c
index f79ca89..52ce7ed 100644
--- a/ted.c
+++ b/ted.c
@@ -354,8 +354,8 @@ static void ted_reload_all(Ted *ted) {
}
// load/reload configs
-void ted_load_configs(Ted *ted) {
- config_free(ted);
+void ted_load_configs(Ted *ted, bool reloading) {
+ if (reloading) config_free(ted);
// copy global config to local config
char local_config_filename[TED_PATH_MAX];
@@ -386,4 +386,9 @@ void ted_load_configs(Ted *ted) {
config_read(ted, global_config_filename, 1);
config_read(ted, local_config_filename, 1);
if (ted->search_cwd) config_read(ted, TED_CFG, 1);
+
+ if (reloading) {
+ // reset text size
+ ted_load_fonts(ted);
+ }
}
diff --git a/ted.h b/ted.h
index 94e034c..30358a4 100644
--- a/ted.h
+++ b/ted.h
@@ -404,7 +404,7 @@ void command_execute(Ted *ted, Command c, i64 argument);
void ted_switch_to_buffer(Ted *ted, TextBuffer *buffer);
// the settings of the active buffer, or the default settings if there is no active buffer
Settings *ted_active_settings(Ted *ted);
-void ted_load_configs(Ted *ted);
+void ted_load_configs(Ted *ted, bool reloading);
static TextBuffer *find_search_buffer(Ted *ted);
void config_read(Ted *ted, const char *filename, int pass);
void config_free(Ted *ted);