Remove termion dependency

Termion is only used to get TTY which is simple enough to implement.
This commit is contained in:
Arijit Basu 2021-07-28 11:27:09 +05:30 committed by Arijit Basu
parent 5626335e0e
commit f1e75caf89
3 changed files with 8 additions and 37 deletions

28
Cargo.lock generated
View File

@ -570,12 +570,6 @@ dependencies = [
"libc",
]
[[package]]
name = "numtoa"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b8f8bdf33df195859076e54ab11ee78a1b208382d3a26ec40d142ffc1ecc49ef"
[[package]]
name = "oorandom"
version = "11.1.3"
@ -719,15 +713,6 @@ dependencies = [
"bitflags",
]
[[package]]
name = "redox_termios"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8440d8acb4fd3d277125b4bd01a6f38aee8d814b3b5fc09b3f2b825d37d3fe8f"
dependencies = [
"redox_syscall",
]
[[package]]
name = "redox_users"
version = "0.4.0"
@ -897,18 +882,6 @@ dependencies = [
"unicode-xid",
]
[[package]]
name = "termion"
version = "1.5.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "077185e2eac69c3f8379a4298e1e07cd36beb962290d4a51199acf0fdc10607e"
dependencies = [
"libc",
"numtoa",
"redox_syscall",
"redox_termios",
]
[[package]]
name = "textwrap"
version = "0.11.0"
@ -1133,7 +1106,6 @@ dependencies = [
"natord",
"serde",
"serde_yaml",
"termion",
"tui",
]

View File

@ -19,7 +19,6 @@ name = "xplr"
[dependencies]
tui = { version = "0.15.0", default-features = false, features = ['crossterm', 'serde'] }
termion = "1.5.6"
crossterm = "0.19.0"
dirs = "3.0.2"
serde = { version = "1.0.126", features = ["derive"] }

View File

@ -18,15 +18,21 @@ use std::io::Write;
use std::path::PathBuf;
use std::process::{Command, ExitStatus, Stdio};
use std::sync::mpsc;
use termion::get_tty;
use tui::backend::CrosstermBackend;
use tui::Terminal;
fn get_tty() -> io::Result<fs::File> {
fs::OpenOptions::new()
.read(true)
.write(true)
.open("/dev/tty")
}
fn call_lua(
app: &app::App,
lua: &mlua::Lua,
func: &str,
silent: bool,
_silent: bool,
) -> Result<Option<Vec<app::ExternalMsg>>> {
let _focus_index = app
.directory_buffer()
@ -34,12 +40,6 @@ fn call_lua(
.unwrap_or_default()
.to_string();
let (_, _, _) = if silent {
(Stdio::null(), Stdio::null(), Stdio::null())
} else {
(get_tty()?.into(), get_tty()?.into(), get_tty()?.into())
};
let arg = app.to_lua_arg();
let arg = lua.to_value(&arg)?;
lua::call(lua, func, arg)