diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/environment.rs | 10 | ||||
| -rw-r--r-- | src/main.rs | 10 | ||||
| -rw-r--r-- | src/panes/code_view.rs | 4 |
3 files changed, 16 insertions, 8 deletions
diff --git a/src/environment.rs b/src/environment.rs index 1ebb81b..70953a0 100644 --- a/src/environment.rs +++ b/src/environment.rs @@ -2,6 +2,16 @@ use std::env; use std::path::PathBuf; pub const CONFIG_FILE_NAME: &str = "config.toml"; +pub const VERSION: &str = env!("CARGO_PKG_VERSION"); +pub const GIT_HASH: Option<&str> = option_env!("GIT_HASH"); + +pub fn formatted_version() -> String { + let hash = GIT_HASH + .map(|hash| format!(" ({hash})")) + .unwrap_or_default(); + + format!("{}{hash}", VERSION) +} pub fn config_dir() -> PathBuf { portable_dir().unwrap_or_else(platform_specific_config_dir) diff --git a/src/main.rs b/src/main.rs index 20383f1..e7faea1 100644 --- a/src/main.rs +++ b/src/main.rs @@ -32,7 +32,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> { let version = args.next().is_some_and(|s| s == "--version" || s == "-V"); if version { - println!("{}", env!("CARGO_PKG_VERSION")); + println!("iced-builder {}", environment::formatted_version()); println!("{}", env!("CARGO_PKG_REPOSITORY")); return Ok(()); @@ -366,11 +366,9 @@ impl App { self.project.get_theme(&self.config), is_focused, ), - DesignerPane::CodeView => code_view::view( - &self.editor_content, - self.theme.value().clone(), - is_focused, - ), + DesignerPane::CodeView => { + code_view::view(&self.editor_content, is_focused) + } }, Panes::ElementList => { element_list::view(self.element_list, is_focused) diff --git a/src/panes/code_view.rs b/src/panes/code_view.rs index e133078..89d17e8 100644 --- a/src/panes/code_view.rs +++ b/src/panes/code_view.rs @@ -20,7 +20,6 @@ fn highlight_style(theme: &Theme, scope: &Scope) -> Format<Font> { pub fn view( editor_content: &text_editor::Content, - theme: Theme, is_focused: bool, ) -> pane_grid::Content<'_, Message> { let title = row![ @@ -46,8 +45,9 @@ pub fn view( text_editor(editor_content) .on_action(Message::EditorAction) .font(Font::MONOSPACE) + .rehighlight_on_redraw(true) .highlight_with::<Highlighter>( - Settings::new(vec![], highlight_style, theme, "rs"), + Settings::new(vec![], highlight_style, "rs"), Highlight::to_format, ) .style(|theme, _| { |
