Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix RTL char highlight #198

Closed
wants to merge 23 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
6c69420
Rename position to cursor_pos
deg0nz Mar 7, 2022
6c4ebb1
Add words with umlauts to example
deg0nz Mar 7, 2022
58bdc28
Use unicode segmentation for displaying and segmenting fuzzy select p…
deg0nz Mar 7, 2022
3aff723
Merge branch 'master' into fix-special-chars-panic-in-fuzzy-select
deg0nz Mar 7, 2022
5cd8093
fmt
deg0nz Mar 7, 2022
38d88f7
Fix wrong param type for prompt item
deg0nz Mar 7, 2022
df0a9fd
Change cursor assignment
deg0nz Mar 7, 2022
9c15cc2
Fix typo in comment
deg0nz Mar 7, 2022
4a28301
Fuzzy: Clear everything on cancel via escape key
deg0nz May 9, 2022
5b1b42d
return KeyModifiers in `select` prompt
Araxeus May 13, 2022
136c39f
return KeyModifiers in `fuzzy_select` prompt
Araxeus May 13, 2022
4de5205
Update ci.yml
Araxeus May 13, 2022
9411655
[fix ci] update examples
Araxeus May 13, 2022
a0c18d1
[fix ci] update examples
Araxeus May 13, 2022
8020313
lint
Araxeus May 13, 2022
1529450
Merge branch 'return-key-modifiers' of https://github.com/Araxeus/dia…
Araxeus May 13, 2022
f7fbd61
Merge pull request #1 from Araxeus/return-key-modifiers
Araxeus May 13, 2022
42e7a47
Merge branch 'fix-fuzzy-clear-on-cancel' of https://github.com/deg0nz…
Araxeus May 13, 2022
a229c20
Merge branch 'deg0nz-fix-fuzzy-clear-on-cancel'
Araxeus May 13, 2022
45a63e6
Merge branch 'fix-special-chars-panic-in-fuzzy-select' of https://git…
Araxeus May 13, 2022
1dc7665
lint
Araxeus May 13, 2022
2d19181
Merge branch 'deg0nz-fix-special-chars-panic-in-fuzzy-select'
Araxeus May 13, 2022
fb4b4c8
don't highlight RTL chars
Araxeus May 13, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 5 additions & 5 deletions .github/workflows/ci.yml
Expand Up @@ -13,19 +13,19 @@ jobs:
include:
- os: macos-latest
target: x86_64-apple-darwin
rust: 1.51.0
rust: 1.60.0
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
rust: 1.51.0
rust: 1.60.0
- os: ubuntu-latest
target: i686-unknown-linux-gnu
rust: 1.51.0
rust: 1.60.0
- os: windows-latest
target: i686-pc-windows-msvc
rust: 1.51.0
rust: 1.60.0
- os: windows-latest
target: x86_64-pc-windows-msvc
rust: 1.51.0
rust: 1.60.0
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
rust: stable
Expand Down
6 changes: 5 additions & 1 deletion Cargo.toml
Expand Up @@ -18,16 +18,20 @@ readme = "README.md"
[features]
default = ["editor", "password"]
editor = ["tempfile"]
fuzzy-select = ["fuzzy-matcher"]
fuzzy-select = ["fuzzy-matcher", "unicode-segmentation", "regex", "lazy_static"]
history = []
password = ["zeroize"]
completion = []

[dependencies]
console = "0.15.0"
crossterm = "0.23.2"
tempfile = { version = "3", optional = true }
zeroize = { version = "1.1.1", optional = true }
fuzzy-matcher = { version = "0.3.7", optional = true }
unicode-segmentation = { version = "1.9.0", optional = true }
regex = { version = "1.5.5", optional = true }
lazy_static = { version = "1.4.0", optional = true }

[[example]]
name = "password"
Expand Down
89 changes: 46 additions & 43 deletions examples/fuzzyselect.rs
@@ -1,43 +1,46 @@
use dialoguer::{theme::ColorfulTheme, FuzzySelect};

fn main() {
let selections = &[
"Ice Cream",
"Vanilla Cupcake",
"Chocolate Muffin",
"A Pile of sweet, sweet mustard",
"Carrots",
"Peas",
"Pistacio",
"Mustard",
"Cream",
"Banana",
"Chocolate",
"Flakes",
"Corn",
"Cake",
"Tarte",
"Cheddar",
"Vanilla",
"Hazelnut",
"Flour",
"Sugar",
"Salt",
"Potato",
"French Fries",
"Pizza",
"Mousse au chocolat",
"Brown sugar",
"Blueberry",
"Burger",
];

let selection = FuzzySelect::with_theme(&ColorfulTheme::default())
.with_prompt("Pick your flavor")
.default(0)
.items(&selections[..])
.interact()
.unwrap();

println!("Enjoy your {}!", selections[selection]);
}
use dialoguer::{theme::ColorfulTheme, FuzzySelect};

fn main() {
let selections = &[
"Ice Cream",
"Vanilla Cupcake",
"Chocolate Muffin",
"A Pile of sweet, sweet mustard",
"Carrots",
"Peas",
"Pistacio",
"Mustard",
"Cream",
"Banana",
"Chocolate",
"Flakes",
"Corn",
"Cake",
"Tarte",
"Cheddar",
"Vanilla",
"Hazelnut",
"Flour",
"Sugar",
"Salt",
"Potato",
"French Fries",
"Pizza",
"Mousse au chocolat",
"Brown sugar",
"Blueberry",
"Burger",
"Käse",
"Döner",
"Blåbär",
];

let selection = FuzzySelect::with_theme(&ColorfulTheme::default())
.with_prompt("Pick your flavor")
.default(0)
.items(&selections[..])
.interact()
.unwrap();

println!("Enjoy your {}!", selections[selection.0]);
}
2 changes: 1 addition & 1 deletion examples/paging.rs
Expand Up @@ -39,5 +39,5 @@ fn main() {
.interact()
.unwrap();

println!("Enjoy your {}!", selections[selection]);
println!("Enjoy your {}!", selections[selection.0]);
}
6 changes: 3 additions & 3 deletions examples/select.rs
Expand Up @@ -15,7 +15,7 @@ fn main() {
.interact()
.unwrap();

println!("Enjoy your {}!", selections[selection]);
println!("Enjoy your {}!", selections[selection.0]);

let selection = Select::with_theme(&ColorfulTheme::default())
.with_prompt("Optionally pick your flavor")
Expand All @@ -25,7 +25,7 @@ fn main() {
.unwrap();

if let Some(selection) = selection {
println!("Enjoy your {}!", selections[selection]);
println!("Enjoy your {}!", selections[selection.0]);
} else {
println!("You didn't select anything!");
}
Expand All @@ -38,5 +38,5 @@ fn main() {
.interact()
.unwrap();

println!("Enjoy your {}!", selections[selection]);
println!("Enjoy your {}!", selections[selection.0]);
}
3 changes: 2 additions & 1 deletion examples/wizard.rs
Expand Up @@ -43,7 +43,8 @@ fn init_config() -> Result<Option<Config>, Box<dyn Error>> {
.item("automatic with ACME")
.item("manual")
.item("no")
.interact()?;
.interact()?
.0;

let (private_key, cert, use_acme) = match tls {
0 => (Some("acme.pkey".into()), Some("acme.cert".into()), true),
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Expand Up @@ -49,3 +49,5 @@ mod paging;
mod prompts;
pub mod theme;
mod validate;

pub use crossterm::event::KeyModifiers;