summaryrefslogtreecommitdiff
path: root/buffer.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 /buffer.c
parent00fce97eb96fc2f1c1bfd8daf4f795ff36cf98c0 (diff)
per-language settings
also fixed ctrl+/ in go
Diffstat (limited to 'buffer.c')
-rw-r--r--buffer.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/buffer.c b/buffer.c
index e1498ef..a4eeab6 100644
--- a/buffer.c
+++ b/buffer.c
@@ -243,16 +243,11 @@ static inline Font *buffer_font(TextBuffer *buffer) {
return buffer->ted->font;
}
-// Get the settings used for this buffer.
-static inline Settings const *buffer_settings(TextBuffer *buffer) {
- return &buffer->ted->settings;
-}
-
// what programming language is this?
Language buffer_language(TextBuffer *buffer) {
if (buffer->manual_language >= 1 && buffer->manual_language <= LANG_COUNT)
return (Language)(buffer->manual_language - 1);
- Settings const *settings = buffer_settings(buffer);
+ Settings const *settings = buffer->ted->settings;
char const *filename = buffer->filename;
if (!filename)
return LANG_NONE;
@@ -277,6 +272,12 @@ Language buffer_language(TextBuffer *buffer) {
return LANG_NONE;
}
+// Get the settings used for this buffer.
+Settings *buffer_settings(TextBuffer *buffer) {
+ return &buffer->ted->settings_by_language[buffer_language(buffer)];
+}
+
+
// NOTE: this string will be invalidated when the line is edited!!!
// only use it briefly!!
static String32 buffer_get_line(TextBuffer *buffer, u32 line_number) {