diff options
Diffstat (limited to 'helix-term')
-rw-r--r-- | helix-term/src/compositor.rs | 2 | ||||
-rw-r--r-- | helix-term/src/main.rs | 22 |
2 files changed, 14 insertions, 10 deletions
diff --git a/helix-term/src/compositor.rs b/helix-term/src/compositor.rs index 3a17904d..7753e0a5 100644 --- a/helix-term/src/compositor.rs +++ b/helix-term/src/compositor.rs @@ -122,7 +122,9 @@ impl Compositor { } pub fn render(&mut self, cx: &mut Context) { + self.terminal.autoresize().unwrap(); let area = self.size(); + let surface = self.terminal.current_buffer_mut(); for layer in &self.layers { diff --git a/helix-term/src/main.rs b/helix-term/src/main.rs index e3304312..da03569d 100644 --- a/helix-term/src/main.rs +++ b/helix-term/src/main.rs @@ -8,6 +8,8 @@ mod ui; use application::Application; +use helix_core::config_dir; + use std::path::PathBuf; use anyhow::{Context, Result}; @@ -27,8 +29,6 @@ fn setup_logging(verbosity: u64) -> Result<()> { _3_or_more => base_config.level(log::LevelFilter::Trace), }; - let home = dirs_next::home_dir().context("can't find the home directory")?; - // Separate file config so we can include year, month and day in file logs let file_config = fern::Dispatch::new() .format(|out, message, record| { @@ -40,7 +40,7 @@ fn setup_logging(verbosity: u64) -> Result<()> { message )) }) - .chain(fern::log_file(home.join("helix.log"))?); + .chain(fern::log_file(config_dir().join("helix.log"))?); base_config.chain(file_config).apply()?; @@ -51,7 +51,8 @@ pub struct Args { files: Vec<PathBuf>, } -fn main() -> Result<()> { +#[tokio::main] +async fn main() -> Result<()> { let help = format!( "\ {} {} @@ -89,6 +90,12 @@ FLAGS: verbosity = 1; } + let conf_dir = config_dir(); + + if !conf_dir.exists() { + std::fs::create_dir(&conf_dir); + } + setup_logging(verbosity).context("failed to initialize logging")?; let args = Args { @@ -96,7 +103,6 @@ FLAGS: }; // initialize language registry - use helix_core::config_dir; use helix_core::syntax::{Loader, LOADER}; // load $HOME/.config/helix/languages.toml, fallback to default config @@ -108,13 +114,9 @@ FLAGS: let config = toml::from_slice(toml).context("Could not parse languages.toml")?; LOADER.get_or_init(|| Loader::new(config)); - let runtime = tokio::runtime::Runtime::new().context("unable to start tokio runtime")?; - // TODO: use the thread local executor to spawn the application task separately from the work pool let mut app = Application::new(args).context("unable to create new appliction")?; - runtime.block_on(async move { - app.run().await; - }); + app.run().await; Ok(()) } |