mirror of
https://github.com/helix-editor/helix.git
synced 2024-11-25 10:56:19 +04:00
Update to rust 1.56 + 2021 edition
This commit is contained in:
parent
3b032e8e1f
commit
182a59b552
68
flake.lock
68
flake.lock
@ -2,11 +2,11 @@
|
|||||||
"nodes": {
|
"nodes": {
|
||||||
"devshell": {
|
"devshell": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1630239564,
|
"lastModified": 1632436039,
|
||||||
"narHash": "sha256-lv7atkVE1+dFw0llmzONsbSIo5ao85KpNSRoFk4K8vU=",
|
"narHash": "sha256-OtITeVWcKXn1SpVEnImpTGH91FycCskGBPqmlxiykv4=",
|
||||||
"owner": "numtide",
|
"owner": "numtide",
|
||||||
"repo": "devshell",
|
"repo": "devshell",
|
||||||
"rev": "bd86d3a2bb28ce4d223315e0eca0d59fef8a0a73",
|
"rev": "7a7a7aa0adebe5488e5abaec688fd9ae0f8ea9c6",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -15,6 +15,21 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"flake-utils": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1623875721,
|
||||||
|
"narHash": "sha256-A8BU7bjS5GirpAUv4QA+QnJ4CceLHkcXdRp4xITDB0s=",
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"rev": "f7e004a55b120c02ecb6219596820fcd32ca8772",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "numtide",
|
||||||
|
"repo": "flake-utils",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"flakeCompat": {
|
"flakeCompat": {
|
||||||
"flake": false,
|
"flake": false,
|
||||||
"locked": {
|
"locked": {
|
||||||
@ -37,14 +52,16 @@
|
|||||||
"nixpkgs": [
|
"nixpkgs": [
|
||||||
"nixpkgs"
|
"nixpkgs"
|
||||||
],
|
],
|
||||||
"rustOverlay": "rustOverlay"
|
"rustOverlay": [
|
||||||
|
"rust-overlay"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1631254163,
|
"lastModified": 1634796585,
|
||||||
"narHash": "sha256-8+nOGLH1fXwWnNMTQq/Igk434BzZF5Vld45xLDLiNDQ=",
|
"narHash": "sha256-CW4yx6omk5qCXUIwXHp/sztA7u0SpyLq9NEACPnkiz8=",
|
||||||
"owner": "yusdacra",
|
"owner": "yusdacra",
|
||||||
"repo": "nix-cargo-integration",
|
"repo": "nix-cargo-integration",
|
||||||
"rev": "432d8504a32232e8d74710024d5bf5cc31767651",
|
"rev": "a84a2137a396f303978f1d48341e0390b0e16a8b",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -55,11 +72,11 @@
|
|||||||
},
|
},
|
||||||
"nixpkgs": {
|
"nixpkgs": {
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1631206977,
|
"lastModified": 1634782485,
|
||||||
"narHash": "sha256-o3Dct9aJ5ht5UaTUBzXrRcK1RZt2eG5/xSlWJuUCVZM=",
|
"narHash": "sha256-psfh4OQSokGXG0lpq3zKFbhOo3QfoeudRcaUnwMRkQo=",
|
||||||
"owner": "nixos",
|
"owner": "nixos",
|
||||||
"repo": "nixpkgs",
|
"repo": "nixpkgs",
|
||||||
"rev": "4f6d8095fd51954120a1d08ea5896fe42dc3923b",
|
"rev": "34ad3ffe08adfca17fcb4e4a47bb5f3b113687be",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
@ -69,21 +86,40 @@
|
|||||||
"type": "github"
|
"type": "github"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"nixpkgs_2": {
|
||||||
|
"locked": {
|
||||||
|
"lastModified": 1628186154,
|
||||||
|
"narHash": "sha256-r2d0wvywFnL9z4iptztdFMhaUIAaGzrSs7kSok0PgmE=",
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"rev": "06552b72346632b6943c8032e57e702ea12413bf",
|
||||||
|
"type": "github"
|
||||||
|
},
|
||||||
|
"original": {
|
||||||
|
"owner": "NixOS",
|
||||||
|
"repo": "nixpkgs",
|
||||||
|
"type": "github"
|
||||||
|
}
|
||||||
|
},
|
||||||
"root": {
|
"root": {
|
||||||
"inputs": {
|
"inputs": {
|
||||||
"flakeCompat": "flakeCompat",
|
"flakeCompat": "flakeCompat",
|
||||||
"nixCargoIntegration": "nixCargoIntegration",
|
"nixCargoIntegration": "nixCargoIntegration",
|
||||||
"nixpkgs": "nixpkgs"
|
"nixpkgs": "nixpkgs",
|
||||||
|
"rust-overlay": "rust-overlay"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"rustOverlay": {
|
"rust-overlay": {
|
||||||
"flake": false,
|
"inputs": {
|
||||||
|
"flake-utils": "flake-utils",
|
||||||
|
"nixpkgs": "nixpkgs_2"
|
||||||
|
},
|
||||||
"locked": {
|
"locked": {
|
||||||
"lastModified": 1631240108,
|
"lastModified": 1634869268,
|
||||||
"narHash": "sha256-ffsTkAGyQLxu4E28nVcqwc8xFL/H1UEwrRw2ITI43Aw=",
|
"narHash": "sha256-RVAcEFlFU3877Mm4q/nbXGEYTDg/wQNhzmXGMTV6wBs=",
|
||||||
"owner": "oxalica",
|
"owner": "oxalica",
|
||||||
"repo": "rust-overlay",
|
"repo": "rust-overlay",
|
||||||
"rev": "3a29d5e726b855d9463eb5dfe04f1ec14d413289",
|
"rev": "c02c2d86354327317546501af001886fbb53d374",
|
||||||
"type": "github"
|
"type": "github"
|
||||||
},
|
},
|
||||||
"original": {
|
"original": {
|
||||||
|
@ -3,9 +3,11 @@
|
|||||||
|
|
||||||
inputs = {
|
inputs = {
|
||||||
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
nixpkgs.url = "github:nixos/nixpkgs/nixos-unstable";
|
||||||
|
rust-overlay.url = "github:oxalica/rust-overlay";
|
||||||
nixCargoIntegration = {
|
nixCargoIntegration = {
|
||||||
url = "github:yusdacra/nix-cargo-integration";
|
url = "github:yusdacra/nix-cargo-integration";
|
||||||
inputs.nixpkgs.follows = "nixpkgs";
|
inputs.nixpkgs.follows = "nixpkgs";
|
||||||
|
inputs.rustOverlay.follows = "rust-overlay";
|
||||||
};
|
};
|
||||||
flakeCompat = {
|
flakeCompat = {
|
||||||
url = "github:edolstra/flake-compat";
|
url = "github:edolstra/flake-compat";
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
name = "helix-core"
|
name = "helix-core"
|
||||||
version = "0.4.1"
|
version = "0.4.1"
|
||||||
authors = ["Blaž Hrastnik <blaz@mxxn.io>"]
|
authors = ["Blaž Hrastnik <blaz@mxxn.io>"]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
description = "Helix editor core editing primitives"
|
description = "Helix editor core editing primitives"
|
||||||
categories = ["editor"]
|
categories = ["editor"]
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
name = "helix-lsp"
|
name = "helix-lsp"
|
||||||
version = "0.4.1"
|
version = "0.4.1"
|
||||||
authors = ["Blaž Hrastnik <blaz@mxxn.io>"]
|
authors = ["Blaž Hrastnik <blaz@mxxn.io>"]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
description = "LSP client implementation for Helix project"
|
description = "LSP client implementation for Helix project"
|
||||||
categories = ["editor"]
|
categories = ["editor"]
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
name = "helix-syntax"
|
name = "helix-syntax"
|
||||||
version = "0.4.1"
|
version = "0.4.1"
|
||||||
authors = ["Blaž Hrastnik <blaz@mxxn.io>"]
|
authors = ["Blaž Hrastnik <blaz@mxxn.io>"]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
description = "Tree-sitter grammars support"
|
description = "Tree-sitter grammars support"
|
||||||
categories = ["editor"]
|
categories = ["editor"]
|
||||||
|
@ -3,7 +3,7 @@ name = "helix-term"
|
|||||||
version = "0.4.1"
|
version = "0.4.1"
|
||||||
description = "A post-modern text editor."
|
description = "A post-modern text editor."
|
||||||
authors = ["Blaž Hrastnik <blaz@mxxn.io>"]
|
authors = ["Blaž Hrastnik <blaz@mxxn.io>"]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
categories = ["editor", "command-line-utilities"]
|
categories = ["editor", "command-line-utilities"]
|
||||||
repository = "https://github.com/helix-editor/helix"
|
repository = "https://github.com/helix-editor/helix"
|
||||||
|
@ -64,25 +64,23 @@ pub fn new(
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn score(&mut self, pattern: &str) {
|
pub fn score(&mut self, pattern: &str) {
|
||||||
// need to borrow via pattern match otherwise it complains about simultaneous borrow
|
|
||||||
let Self {
|
|
||||||
ref mut matcher,
|
|
||||||
ref mut matches,
|
|
||||||
ref options,
|
|
||||||
..
|
|
||||||
} = *self;
|
|
||||||
|
|
||||||
// reuse the matches allocation
|
// reuse the matches allocation
|
||||||
matches.clear();
|
self.matches.clear();
|
||||||
matches.extend(options.iter().enumerate().filter_map(|(index, option)| {
|
self.matches.extend(
|
||||||
|
self.options
|
||||||
|
.iter()
|
||||||
|
.enumerate()
|
||||||
|
.filter_map(|(index, option)| {
|
||||||
let text = option.filter_text();
|
let text = option.filter_text();
|
||||||
// TODO: using fuzzy_indices could give us the char idx for match highlighting
|
// TODO: using fuzzy_indices could give us the char idx for match highlighting
|
||||||
matcher
|
self.matcher
|
||||||
.fuzzy_match(text, pattern)
|
.fuzzy_match(text, pattern)
|
||||||
.map(|score| (index, score))
|
.map(|score| (index, score))
|
||||||
}));
|
}),
|
||||||
|
);
|
||||||
// matches.sort_unstable_by_key(|(_, score)| -score);
|
// matches.sort_unstable_by_key(|(_, score)| -score);
|
||||||
matches.sort_unstable_by_key(|(index, _score)| options[*index].sort_text());
|
self.matches
|
||||||
|
.sort_unstable_by_key(|(index, _score)| self.options[*index].sort_text());
|
||||||
|
|
||||||
// reset cursor position
|
// reset cursor position
|
||||||
self.cursor = None;
|
self.cursor = None;
|
||||||
|
@ -233,37 +233,28 @@ pub fn new(
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn score(&mut self) {
|
pub fn score(&mut self) {
|
||||||
// need to borrow via pattern match otherwise it complains about simultaneous borrow
|
|
||||||
let Self {
|
|
||||||
ref mut matcher,
|
|
||||||
ref mut matches,
|
|
||||||
ref filters,
|
|
||||||
ref format_fn,
|
|
||||||
..
|
|
||||||
} = *self;
|
|
||||||
|
|
||||||
let pattern = &self.prompt.line;
|
let pattern = &self.prompt.line;
|
||||||
|
|
||||||
// reuse the matches allocation
|
// reuse the matches allocation
|
||||||
matches.clear();
|
self.matches.clear();
|
||||||
matches.extend(
|
self.matches.extend(
|
||||||
self.options
|
self.options
|
||||||
.iter()
|
.iter()
|
||||||
.enumerate()
|
.enumerate()
|
||||||
.filter_map(|(index, option)| {
|
.filter_map(|(index, option)| {
|
||||||
// filter options first before matching
|
// filter options first before matching
|
||||||
if !filters.is_empty() {
|
if !self.filters.is_empty() {
|
||||||
filters.binary_search(&index).ok()?;
|
self.filters.binary_search(&index).ok()?;
|
||||||
}
|
}
|
||||||
// TODO: maybe using format_fn isn't the best idea here
|
// TODO: maybe using format_fn isn't the best idea here
|
||||||
let text = (format_fn)(option);
|
let text = (self.format_fn)(option);
|
||||||
// TODO: using fuzzy_indices could give us the char idx for match highlighting
|
// TODO: using fuzzy_indices could give us the char idx for match highlighting
|
||||||
matcher
|
self.matcher
|
||||||
.fuzzy_match(&text, pattern)
|
.fuzzy_match(&text, pattern)
|
||||||
.map(|score| (index, score))
|
.map(|score| (index, score))
|
||||||
}),
|
}),
|
||||||
);
|
);
|
||||||
matches.sort_unstable_by_key(|(_, score)| -score);
|
self.matches.sort_unstable_by_key(|(_, score)| -score);
|
||||||
|
|
||||||
// reset cursor position
|
// reset cursor position
|
||||||
self.cursor = 0;
|
self.cursor = 0;
|
||||||
|
@ -5,7 +5,7 @@ authors = ["Blaž Hrastnik <blaz@mxxn.io>"]
|
|||||||
description = """
|
description = """
|
||||||
A library to build rich terminal user interfaces or dashboards
|
A library to build rich terminal user interfaces or dashboards
|
||||||
"""
|
"""
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
categories = ["editor"]
|
categories = ["editor"]
|
||||||
repository = "https://github.com/helix-editor/helix"
|
repository = "https://github.com/helix-editor/helix"
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
name = "helix-view"
|
name = "helix-view"
|
||||||
version = "0.4.1"
|
version = "0.4.1"
|
||||||
authors = ["Blaž Hrastnik <blaz@mxxn.io>"]
|
authors = ["Blaž Hrastnik <blaz@mxxn.io>"]
|
||||||
edition = "2018"
|
edition = "2021"
|
||||||
license = "MPL-2.0"
|
license = "MPL-2.0"
|
||||||
description = "UI abstractions for use in backends"
|
description = "UI abstractions for use in backends"
|
||||||
categories = ["editor"]
|
categories = ["editor"]
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
use std::{
|
use std::{
|
||||||
collections::HashMap,
|
collections::HashMap,
|
||||||
convert::TryFrom,
|
|
||||||
path::{Path, PathBuf},
|
path::{Path, PathBuf},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user