aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Cargo.lock254
-rw-r--r--helix-core/src/state.rs2
-rw-r--r--helix-syntax/Cargo.toml1
-rw-r--r--helix-syntax/src/lib.rs3
-rw-r--r--helix-term/Cargo.toml7
-rw-r--r--helix-term/src/editor.rs4
-rw-r--r--helix-term/src/main.rs21
-rw-r--r--helix-view/Cargo.toml5
-rw-r--r--helix-view/src/commands.rs1
9 files changed, 114 insertions, 184 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 57f5fc17..7253b7fd 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -22,35 +22,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4d25d88fd6b8041580a654f9d0c581a047baee2b3efee13275f2fc392fc75034"
[[package]]
-name = "argh"
-version = "0.1.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ca1877e24cecacd700d469066e0160c4f8497cc5635367163f50c8beec820154"
-dependencies = [
- "argh_derive",
- "argh_shared",
-]
-
-[[package]]
-name = "argh_derive"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e742194e0f43fc932bcb801708c2b279d3ec8f527e3acda05a6a9f342c5ef764"
-dependencies = [
- "argh_shared",
- "heck",
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
-name = "argh_shared"
-version = "0.1.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e1ba68f4276a778591e36a0c348a269888f3a177c8d2054969389e3b59611ff5"
-
-[[package]]
name = "async-barrier"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -97,9 +68,9 @@ dependencies = [
[[package]]
name = "async-io"
-version = "1.1.3"
+version = "1.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "a9951f92a2b4f7793f8fc06a80bdb89b62c618c993497d4606474fb8c34941b5"
+checksum = "6e727cebd055ab2861a854f79def078c4b99ea722d54c6800a0e274389882d4c"
dependencies = [
"concurrent-queue",
"fastrand",
@@ -136,9 +107,9 @@ dependencies = [
[[package]]
name = "async-net"
-version = "1.4.3"
+version = "1.4.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fb04482b77baa38d59d56aee0a7b4266600ab28e2b8be7af03508f6a30ecbdcf"
+checksum = "14a5335056541826f855bf95b936df9788adbacf94b15ef7104029f7fff3e82a"
dependencies = [
"async-io",
"blocking",
@@ -194,6 +165,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "065374052e7df7ee4047b1160cca5e1467a12351a40b3da123c870ba0b8eda2a"
[[package]]
+name = "autocfg"
+version = "1.0.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "cdb031dd78e28731d87d56cc8ffef4a8f36ca26c38fe2de700543e627f8a464a"
+
+[[package]]
name = "bitflags"
version = "1.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -241,10 +218,24 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4785bdd1c96b2a846b2bd7cc02e86b6b3dbf14e7e53446c4f54c92a361040822"
[[package]]
+name = "clap"
+version = "3.0.0-beta.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4bd1061998a501ee7d4b6d449020df3266ca3124b941ec56cf2005c3779ca142"
+dependencies = [
+ "bitflags",
+ "indexmap",
+ "os_str_bytes",
+ "textwrap",
+ "unicode-width",
+ "vec_map",
+]
+
+[[package]]
name = "cloudabi"
-version = "0.0.3"
+version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ddfc5b9aa5d4507acaf872de71051dfd0e309860e88966e1051e462a077aac4f"
+checksum = "4344512281c643ae7638bbabc3af17a11307803ec8f0fcad9fae512a8bf36467"
dependencies = [
"bitflags",
]
@@ -260,13 +251,13 @@ dependencies = [
[[package]]
name = "crossterm"
-version = "0.17.7"
+version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6f4919d60f26ae233e14233cc39746c8c8bb8cd7b05840ace83604917b51b6c7"
+checksum = "c2fcdc3c9cf8ee446222e8ee8691a6d21b563b8fe1a64b1873080db7b5b23cf0"
dependencies = [
"bitflags",
"crossterm_winapi",
- "futures-util",
+ "futures-core",
"lazy_static",
"libc",
"mio",
@@ -285,26 +276,6 @@ dependencies = [
]
[[package]]
-name = "enum-iterator"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c79a6321a1197d7730510c7e3f6cb80432dfefecb32426de8cea0aa19b4bb8d7"
-dependencies = [
- "enum-iterator-derive",
-]
-
-[[package]]
-name = "enum-iterator-derive"
-version = "0.6.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "1e94aa31f7c0dc764f57896dc615ddd76fc13b0d5dca7eb6cc5e018a5a09ec06"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
name = "event-listener"
version = "2.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -354,31 +325,10 @@ dependencies = [
]
[[package]]
-name = "futures-task"
-version = "0.3.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "bdb66b5f09e22019b1ab0830f7785bcea8e7a42148683f99214f73f8ec21a626"
-
-[[package]]
-name = "futures-util"
-version = "0.3.5"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8764574ff08b701a084482c3c7031349104b07ac897393010494beaa18ce32c6"
-dependencies = [
- "futures-core",
- "futures-task",
- "pin-project",
- "pin-utils",
-]
-
-[[package]]
-name = "heck"
-version = "0.3.1"
+name = "hashbrown"
+version = "0.9.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "20564e78d53d2bb135c343b3f47714a56af2061f1c928fdb541dc7b9fdd94205"
-dependencies = [
- "unicode-segmentation",
-]
+checksum = "d7afe4a420e3fe79967a00898cc1f4db7c8a49a9333a29f8a4bd76a253d5cd04"
[[package]]
name = "helix-core"
@@ -401,7 +351,6 @@ name = "helix-syntax"
version = "0.1.0"
dependencies = [
"cc",
- "enum-iterator",
"tree-sitter",
]
@@ -410,7 +359,7 @@ name = "helix-term"
version = "0.1.0"
dependencies = [
"anyhow",
- "argh",
+ "clap",
"crossterm",
"helix-core",
"helix-view",
@@ -440,6 +389,25 @@ dependencies = [
]
[[package]]
+name = "indexmap"
+version = "1.6.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "55e2e4c765aa53a0424761bf9f41aa7a6ac1efa87238f59560640e27fca028f2"
+dependencies = [
+ "autocfg",
+ "hashbrown",
+]
+
+[[package]]
+name = "instant"
+version = "0.1.7"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "63312a18f7ea8760cdd0a7c5aac1a619752a246b833545e3e36d1f81f7cd9e66"
+dependencies = [
+ "cfg-if",
+]
+
+[[package]]
name = "jobserver"
version = "0.1.21"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -462,9 +430,9 @@ checksum = "f2f96b10ec2560088a8e76961b00d47107b3a625fecb76dedb29ee7ccbf98235"
[[package]]
name = "lock_api"
-version = "0.3.4"
+version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c4da24a77a3d8a6d4862d95f72e6fdb9c09a643ecdb402d754004a557f2bec75"
+checksum = "28247cc5a5be2f05fbcd76dd0cf2c7d3b5400cb978a28042abcd4fa0b3f8261c"
dependencies = [
"scopeguard",
]
@@ -492,11 +460,10 @@ checksum = "3728d817d99e5ac407411fa471ff9800a778d88a24685968b36824eaf4bee400"
[[package]]
name = "mio"
-version = "0.7.0"
+version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6e9971bc8349a361217a8f2a41f5d011274686bd4436465ba51730921039d7fb"
+checksum = "d1bb17be6a300845baad6dc2062a31de575e9148696df52f040aea6398627350"
dependencies = [
- "lazy_static",
"libc",
"log",
"miow",
@@ -516,9 +483,9 @@ dependencies = [
[[package]]
name = "nb-connect"
-version = "1.0.0"
+version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "e847c76b390f44529c2071ef06d0b52fbb4bdb04cc8987a5cfa63954c000abca"
+checksum = "701f47aeb98466d0a7fea67e2c2f667c33efa1f2e4fd7f76743aac1153196f72"
dependencies = [
"libc",
"winapi",
@@ -556,6 +523,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "260e51e7efe62b592207e9e13a68e43692a7a279171d6ba57abd208bf23645ad"
[[package]]
+name = "os_str_bytes"
+version = "2.3.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2ac6fe3538f701e339953a3ebbe4f39941aababa8a3f6964635b24ab526daeac"
+
+[[package]]
name = "parking"
version = "2.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -563,22 +536,24 @@ checksum = "427c3892f9e783d91cc128285287e70a59e206ca452770ece88a76f7a3eddd72"
[[package]]
name = "parking_lot"
-version = "0.10.2"
+version = "0.11.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d3a704eb390aafdc107b0e392f56a82b668e3a71366993b5340f5833fd62505e"
+checksum = "a4893845fa2ca272e647da5d0e46660a314ead9c2fdd9a883aabc32e481a8733"
dependencies = [
+ "instant",
"lock_api",
"parking_lot_core",
]
[[package]]
name = "parking_lot_core"
-version = "0.7.2"
+version = "0.8.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d58c7c768d4ba344e3e8d72518ac13e259d7c7ade24167003b8488e10b6740a3"
+checksum = "c361aa727dd08437f2f1447be8b59a33b0edd15e0fcee698f935613d9efbca9b"
dependencies = [
"cfg-if",
"cloudabi",
+ "instant",
"libc",
"redox_syscall",
"smallvec",
@@ -586,36 +561,10 @@ dependencies = [
]
[[package]]
-name = "pin-project"
-version = "0.4.23"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ca4433fff2ae79342e497d9f8ee990d174071408f28f726d6d83af93e58e48aa"
-dependencies = [
- "pin-project-internal",
-]
-
-[[package]]
-name = "pin-project-internal"
-version = "0.4.23"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "2c0e815c3ee9a031fdf5af21c10aa17c573c9c6a566328d99e3936c34e36461f"
-dependencies = [
- "proc-macro2",
- "quote",
- "syn",
-]
-
-[[package]]
name = "pin-project-lite"
-version = "0.1.7"
+version = "0.1.9"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "282adbf10f2698a7a77f8e983a74b2d18176c19a7fd32a45446139ae7b02b715"
-
-[[package]]
-name = "pin-utils"
-version = "0.1.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184"
+checksum = "4fe74897791e156a0cd8cce0db31b9b2198e67877316bf3086c3acd187f719f0"
[[package]]
name = "polling"
@@ -631,24 +580,6 @@ dependencies = [
]
[[package]]
-name = "proc-macro2"
-version = "1.0.21"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "36e28516df94f3dd551a587da5357459d9b36d945a7c37c3557928c1c2ff2a2c"
-dependencies = [
- "unicode-xid",
-]
-
-[[package]]
-name = "quote"
-version = "1.0.7"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aa563d17ecb180e500da1cfd2b028310ac758de548efdd203e18f283af693f37"
-dependencies = [
- "proc-macro2",
-]
-
-[[package]]
name = "redox_syscall"
version = "0.1.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -716,9 +647,9 @@ checksum = "fbee7696b84bbf3d89a1c2eccff0850e3047ed46bfcd2e92c29a2d074d57e252"
[[package]]
name = "smol"
-version = "1.2.1"
+version = "1.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d41237ba3e3ada55ff3515d37becc8fa90e5e4af2b13a011ec3f932d9f1b2405"
+checksum = "7ca2722989073e89917a575862fb49dba3321af152f0cf4a4164d9482aabdf28"
dependencies = [
"async-channel",
"async-executor",
@@ -745,17 +676,6 @@ dependencies = [
]
[[package]]
-name = "syn"
-version = "1.0.41"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "6690e3e9f692504b941dc6c3b188fd28df054f7fb8469ab40680df52fdcc842b"
-dependencies = [
- "proc-macro2",
- "quote",
- "unicode-xid",
-]
-
-[[package]]
name = "tendril"
version = "0.4.1"
source = "git+https://github.com/servo/tendril#9532724c32a0bf5e65acb56209373d97223bc530"
@@ -766,6 +686,15 @@ dependencies = [
]
[[package]]
+name = "textwrap"
+version = "0.12.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "203008d98caf094106cfaba70acfed15e18ed3ddb7d94e49baec153a2b462789"
+dependencies = [
+ "unicode-width",
+]
+
+[[package]]
name = "thread_local"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -786,9 +715,8 @@ dependencies = [
[[package]]
name = "tui"
-version = "0.11.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "36626dee5ede9fd34015e9fb4fd7eedf3f3d05bdf1436aaef15b7d0a24233778"
+version = "0.12.0"
+source = "git+https://github.com/fdehau/tui-rs#25ff2e5e61f8902101e485743992db2412f77aad"
dependencies = [
"bitflags",
"cassowary",
@@ -810,12 +738,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9337591893a19b88d8d87f2cec1e73fad5cdfd10e5a6f349f498ad6ea2ffb1e3"
[[package]]
-name = "unicode-xid"
-version = "0.2.1"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "f7fe0bb3479651439c9112f72b6c505038574c9fbb575ed1bf3b797fa39dd564"
-
-[[package]]
name = "utf-8"
version = "0.7.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
@@ -828,6 +750,12 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "eafc1b9b2dfc6f5529177b62cf806484db55b32dc7c9658a118e11bbeb33061d"
[[package]]
+name = "vec_map"
+version = "0.8.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191"
+
+[[package]]
name = "waker-fn"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
diff --git a/helix-core/src/state.rs b/helix-core/src/state.rs
index aa377091..c17e9c90 100644
--- a/helix-core/src/state.rs
+++ b/helix-core/src/state.rs
@@ -244,8 +244,6 @@ impl State {
skip_over_next(slice, &mut pos, |ch| ch.is_ascii_punctuation());
}
- // TODO: stops on spaces
-
pos.saturating_sub(1)
}
diff --git a/helix-syntax/Cargo.toml b/helix-syntax/Cargo.toml
index 61a9b5b0..12da3924 100644
--- a/helix-syntax/Cargo.toml
+++ b/helix-syntax/Cargo.toml
@@ -8,7 +8,6 @@ edition = "2018"
[dependencies]
tree-sitter = "0.17"
-enum-iterator = "0.6"
[build-dependencies]
cc = { version = "1", features = ["parallel"] }
diff --git a/helix-syntax/src/lib.rs b/helix-syntax/src/lib.rs
index 61d63273..a20a2ab7 100644
--- a/helix-syntax/src/lib.rs
+++ b/helix-syntax/src/lib.rs
@@ -1,4 +1,3 @@
-use enum_iterator::IntoEnumIterator;
use tree_sitter::Language;
#[macro_export]
@@ -13,7 +12,7 @@ macro_rules! mk_extern {
#[macro_export]
macro_rules! mk_enum {
( $( $camel:ident ),* ) => {
- #[derive(Clone, Copy, Debug, IntoEnumIterator, PartialEq)]
+ #[derive(Clone, Copy, Debug, PartialEq)]
pub enum LANG {
$(
$camel,
diff --git a/helix-term/Cargo.toml b/helix-term/Cargo.toml
index ecbbe7d2..82eeb345 100644
--- a/helix-term/Cargo.toml
+++ b/helix-term/Cargo.toml
@@ -15,9 +15,10 @@ helix-core = { path = "../helix-core" }
helix-view = { path = "../helix-view", features = ["term"]}
anyhow = "1"
-argh = "0.1"
smol = "1"
num_cpus = "1.13"
-tui = { version = "0.11", default-features = false, features = ["crossterm"] }
-crossterm = { version = "0.17", features = ["event-stream"] }
+# tui = { version = "0.12", default-features = false, features = ["crossterm"] }
+tui = { git = "https://github.com/fdehau/tui-rs", default-features = false, features = ["crossterm"] }
+crossterm = { version = "0.18", features = ["event-stream"] }
+clap = { version = "3.0.0-beta.2 ", default-features = false, features = ["std"] }
diff --git a/helix-term/src/editor.rs b/helix-term/src/editor.rs
index 2cc210f4..b745eff2 100644
--- a/helix-term/src/editor.rs
+++ b/helix-term/src/editor.rs
@@ -1,4 +1,4 @@
-use crate::Args;
+use clap::ArgMatches as Args;
use helix_core::{state::coords_at_pos, state::Mode, syntax::HighlightEvent, Range, State};
use helix_view::{commands, keymap, View};
@@ -53,7 +53,7 @@ impl Editor {
// TODO; move to state
};
- if let Some(file) = args.files.pop() {
+ if let Some(file) = args.values_of_t::<PathBuf>("files").unwrap().pop() {
editor.open(file)?;
}
diff --git a/helix-term/src/main.rs b/helix-term/src/main.rs
index b691eb65..eeb498bc 100644
--- a/helix-term/src/main.rs
+++ b/helix-term/src/main.rs
@@ -4,22 +4,25 @@ mod editor;
use editor::Editor;
-use argh::FromArgs;
+use clap::{App, Arg};
use std::path::PathBuf;
use anyhow::Error;
-#[derive(FromArgs)]
-/// A post-modern text editor.
-pub struct Args {
- #[argh(positional)]
- files: Vec<PathBuf>,
-}
-
static EX: smol::Executor = smol::Executor::new();
fn main() -> Result<(), Error> {
- let args: Args = argh::from_env();
+ let args = App::new("helix")
+ .version("0.1")
+ .about("A post-modern text editor.")
+ .arg(
+ Arg::new("files")
+ .about("Sets the input file to use")
+ .required(true)
+ .multiple(true)
+ .index(1),
+ )
+ .get_matches();
for _ in 0..num_cpus::get() {
std::thread::spawn(move || smol::block_on(EX.run(smol::future::pending::<()>())));
diff --git a/helix-view/Cargo.toml b/helix-view/Cargo.toml
index d205d7ad..330ae696 100644
--- a/helix-view/Cargo.toml
+++ b/helix-view/Cargo.toml
@@ -15,6 +15,7 @@ anyhow = "1"
helix-core = { path = "../helix-core" }
# Conversion traits
-tui = { version = "0.11", default-features = false, features = ["crossterm"], optional = true}
-crossterm = { version = "0.17", features = ["event-stream"], optional = true}
+# tui = { version = "0.12", default-features = false, features = ["crossterm"], optional = true}
+tui = { git = "https://github.com/fdehau/tui-rs", default-features = false, features = ["crossterm"], optional = true}
+crossterm = { version = "0.18", features = ["event-stream"], optional = true}
once_cell = "1.4"
diff --git a/helix-view/src/commands.rs b/helix-view/src/commands.rs
index a3906b9b..1309d48a 100644
--- a/helix-view/src/commands.rs
+++ b/helix-view/src/commands.rs
@@ -151,6 +151,7 @@ pub fn extend_line_down(view: &mut View, count: usize) {
pub fn split_selection_on_newline(view: &mut View, _count: usize) {
let text = &view.state.doc.slice(..);
// only compile the regex once
+ #[allow(clippy::trivial_regex)]
static REGEX: Lazy<Regex> = Lazy::new(|| Regex::new(r"\n").unwrap());
// TODO: use a transaction
view.state.selection = selection::split_on_matches(text, view.state.selection(), &REGEX)