Skip to content

Commit

Permalink
Fix clear screen on windows (#772)
Browse files Browse the repository at this point in the history
* fix windows clear screen bug
* update lalrpop
  • Loading branch information
xasopheno authored Apr 27, 2023
1 parent 3cded50 commit 0312fc6
Show file tree
Hide file tree
Showing 5 changed files with 150 additions and 56 deletions.
181 changes: 134 additions & 47 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 9 additions & 1 deletion core/src/ui/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ use colored::*;
const VERSION: &str = env!("CARGO_PKG_VERSION");

pub fn clear_screen() {
std::process::Command::new("clear").status().unwrap();
if let Err(e) = if cfg!(target_os = "windows") {
std::process::Command::new("cmd")
.args(["/C", "cls"])
.status()
} else {
std::process::Command::new("clear").status()
} {
eprintln!("Failed to clear the screen: {:?}", e);
}
}

pub fn were_so_cool_logo(action: Option<&str>, filename: Option<String>) {
Expand Down
4 changes: 2 additions & 2 deletions parser/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ license = "GPL-3.0"
resolver="2"

[build-dependencies.lalrpop]
version = "0.19.6"
version = "0.19.10"
features = ["lexer"]

[dependencies]
weresocool_ast = { path = "../ast", version = "^1.0.44", default_features=false, optional=true }
weresocool_error = { path = "../error", version = "^1.0.44", default_features=false, optional=true }
scop = { path = "../scop", version = "^1.0.44" }
lalrpop-util = { version="0.19.8", features=["lexer"]}
lalrpop-util = { version="0.19.10", features=["lexer"]}
regex = "1.5.4"
colored = "2.0.0"
num-rational = "0.3.2"
Expand Down
2 changes: 1 addition & 1 deletion ring_buffer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ impl<T: Sized + Copy + Clone + std::default::Default> RingBuffer<T> {
T: Clone + Copy,
{
if self.tail == 0 {
return self.buffer[(self.capacity - 1)];
return self.buffer[self.capacity - 1];
}
self.buffer[(self.tail - 1) % self.capacity]
}
Expand Down
9 changes: 4 additions & 5 deletions test.socool
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,9 @@ thing2 = {
}

main = {
csv(f: 1.0, l: 1.0) ./test.csv
-- Overlay [
-- thing1,
-- thing2
-- ]
Overlay [
thing1,
thing2
]
}

0 comments on commit 0312fc6

Please sign in to comment.