summaryrefslogtreecommitdiff
path: root/src/config/theme/editor
diff options
context:
space:
mode:
authorNathan Reiner <nathan@nathanreiner.xyz>2024-08-10 19:06:46 +0200
committerNathan Reiner <nathan@nathanreiner.xyz>2024-08-10 19:06:46 +0200
commit63cfcbe7a7745b276de58ec92e0141b958c44feb (patch)
tree990e33a83756e27187033579ee2f85d5c79169d5 /src/config/theme/editor
parentb747ca8af52129876b577a4f20f7105a05c6b002 (diff)
use unsafe blocks instead of mutexes
Diffstat (limited to 'src/config/theme/editor')
-rw-r--r--src/config/theme/editor/bar.rs3
-rw-r--r--src/config/theme/editor/mod.rs18
2 files changed, 7 insertions, 14 deletions
diff --git a/src/config/theme/editor/bar.rs b/src/config/theme/editor/bar.rs
index 62be7b0..e0ff0a7 100644
--- a/src/config/theme/editor/bar.rs
+++ b/src/config/theme/editor/bar.rs
@@ -3,6 +3,5 @@ use crate::config::{theme::bar::BarTheme, GlobalConfig};
BarTheme!(
EditorBarTheme,
(),
- GlobalConfig::instance().theme.editor.bar,
- GlobalConfig::instance_mut().theme.editor.bar
+ GlobalConfig::get().theme.editor.bar
);
diff --git a/src/config/theme/editor/mod.rs b/src/config/theme/editor/mod.rs
index 662dacc..33ab600 100644
--- a/src/config/theme/editor/mod.rs
+++ b/src/config/theme/editor/mod.rs
@@ -36,13 +36,7 @@ impl EditorTheme {
macro_rules! cfg {
() => {
- GlobalConfig::instance().theme.editor
- };
-}
-
-macro_rules! cfg_mut {
- () => {
- GlobalConfig::instance_mut().theme.editor
+ GlobalConfig::get().theme.editor
};
}
@@ -50,25 +44,25 @@ impl UserData for EditorTheme {
fn add_fields<'lua, F: mlua::prelude::LuaUserDataFields<'lua, Self>>(fields: &mut F) {
fields.add_field_function_get("background", |_, _| Ok(cfg!().background.clone()));
fields.add_field_function_set("background", |_, _, background: EvalTo<Style, ()>| {
- cfg_mut!().background = background;
+ cfg!().background = background;
Ok(())
});
fields.add_field_function_get("highlight", |_, _| Ok(cfg!().highlight.clone()));
fields.add_field_function_set("highlight", |_, _, highlight: HighlightTheme| {
- cfg_mut!().highlight = highlight;
+ cfg!().highlight = highlight;
Ok(())
});
fields.add_field_function_get("cursor_line", |_, _| Ok(cfg!().cursor_line.clone()));
fields.add_field_function_set("cursor_line", |_, _, cursor_line: EvalTo<Style, ()>| {
- cfg_mut!().cursor_line = cursor_line;
+ cfg!().cursor_line = cursor_line;
Ok(())
});
fields.add_field_function_get("line_number", |_, _| Ok(cfg!().line_number.clone()));
fields.add_field_function_set("line_number", |_, _, line_number: EvalTo<Style, ()>| {
- cfg_mut!().line_number = line_number;
+ cfg!().line_number = line_number;
Ok(())
});
@@ -78,7 +72,7 @@ impl UserData for EditorTheme {
fields.add_field_function_set(
"active_line_number",
|_, _, active_line_number: EvalTo<Style, ()>| {
- cfg_mut!().active_line_number = active_line_number;
+ cfg!().active_line_number = active_line_number;
Ok(())
},
);