diff --git a/src/commands.rs b/src/commands.rs index 7fd01e8..8552baa 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -19,7 +19,6 @@ const HELLO: &str = "PRINT \"Hello World!\""; const MAIN: &str = "main.bas"; const SRC: &str = "src"; const TOML: &str = "Bargo.toml"; -const WIDTH: usize = 80; pub trait BargoCommand { fn execute(&self) -> Result<(), Box>; @@ -139,7 +138,9 @@ impl BuildCommand { if line.to_uppercase().starts_with("LABEL") { String::from(":") } else if line.to_uppercase().starts_with("REM") && line.ends_with('=') { - line.chars().take(WIDTH - (padding + 3)).collect() + line.chars() + .take(self.config.package.width - (padding + 3)) + .collect() } else { let mut new_line = line.clone(); if self.config.package.labels { diff --git a/src/config.rs b/src/config.rs index 2ed8619..75afc80 100644 --- a/src/config.rs +++ b/src/config.rs @@ -6,6 +6,7 @@ use std::path::Path; use std::{collections::HashMap, env, error::Error, fs::File, path::PathBuf}; const EMU: &str = "fab-agon-emulator"; +const WITDH: usize = 80; #[derive(Deserialize, Serialize)] pub struct Config { @@ -55,6 +56,7 @@ pub struct Package { pub carriage_return: bool, pub labels: bool, pub numbering: usize, + pub width: usize, pub emu_path: PathBuf, pub version: String, } @@ -71,6 +73,7 @@ impl Default for Package { carriage_return: true, labels: false, numbering: 10, + width: WITDH, emu_path, version: String::from("0.1.0"), }