summaryrefslogtreecommitdiff
path: root/ted.c
diff options
context:
space:
mode:
authorpommicket <pommicket@gmail.com>2022-07-29 14:29:36 -0400
committerpommicket <pommicket@gmail.com>2022-07-29 14:33:32 -0400
commitab65fe136f7a8739b78aaa4801a9fb761a301417 (patch)
treed9193726574c6ed7884562ad2c376bef48905b58 /ted.c
parent00fce97eb96fc2f1c1bfd8daf4f795ff36cf98c0 (diff)
per-language settings
also fixed ctrl+/ in go
Diffstat (limited to 'ted.c')
-rw-r--r--ted.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/ted.c b/ted.c
index e98edde..e861736 100644
--- a/ted.c
+++ b/ted.c
@@ -48,6 +48,10 @@ static void *ted_realloc(Ted *ted, void *p, size_t new_size) {
return ret;
}
+Settings *ted_active_settings(Ted *ted) {
+ return ted->active_buffer ? buffer_settings(ted->active_buffer) : ted->settings;
+}
+
static void ted_path_full(Ted *ted, char const *relpath, char *abspath, size_t abspath_size) {
path_full(ted->cwd, relpath, abspath, abspath_size);
}
@@ -81,7 +85,7 @@ static Status ted_get_file(Ted const *ted, char const *name, char *out, size_t o
static void ted_load_font(Ted *ted, char const *filename, Font **out) {
char font_filename[TED_PATH_MAX];
if (ted_get_file(ted, filename, font_filename, sizeof font_filename)) {
- Font *font = text_font_load(font_filename, ted->settings.text_size);
+ Font *font = text_font_load(font_filename, ted_active_settings(ted)->text_size);
if (font) {
// we don't properly handle variable-width fonts
text_font_set_force_monospace(font, true);
@@ -199,9 +203,8 @@ static i32 ted_new_node(Ted *ted) {
// how tall is a line buffer?
static float ted_line_buffer_height(Ted const *ted) {
- Settings const *settings = &ted->settings;
float const char_height = text_font_char_height(ted->font);
- return char_height + 2 * settings->border_thickness;
+ return char_height + 2 * ted->settings->border_thickness;
}
// switch to this node