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(runtime): Make native modal keyboard interaction consistent with browsers #18453

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
d279a07
Rebase and fix tests
lionel-rowe Apr 3, 2023
8b237e9
Merge branch 'main' into alert-prompt-confirm-keyboard-interaction
bartlomieju Apr 6, 2023
d31fe0e
Merge branch 'main' into alert-prompt-confirm-keyboard-interaction
lionel-rowe Apr 11, 2023
780797d
breaking - throw instead of returning early if !isatty
lionel-rowe Apr 11, 2023
8861563
Merge branch 'main' into alert-prompt-confirm-keyboard-interaction
lionel-rowe Sep 2, 2023
d679281
Implement changes from code review
lionel-rowe Sep 2, 2023
dc369c5
Merge branch 'main' into alert-prompt-confirm-keyboard-interaction
lionel-rowe Sep 4, 2023
06ebf48
Implement changes from code review
lionel-rowe Sep 3, 2023
88317d4
Merge branch 'main' into alert-prompt-confirm-keyboard-interaction
bartlomieju Sep 4, 2023
b79f443
Merge branch 'main' into alert-prompt-confirm-keyboard-interaction
bartlomieju Sep 5, 2023
67a5e25
Merge branch 'main' into alert-prompt-confirm-keyboard-interaction
bartlomieju Sep 6, 2023
d3b7253
Merge branch 'main' into alert-prompt-confirm-keyboard-interaction
lionel-rowe Sep 12, 2023
94e192f
Exclude ctrl+c/ctrl+d tests from macos
lionel-rowe Sep 12, 2023
27d449a
Merge branch 'main' into alert-prompt-confirm-keyboard-interaction
lionel-rowe Sep 12, 2023
9c2c740
Fix test on Windows
dsherret Sep 18, 2023
f8f13de
Merge branch 'main' into alert-prompt-confirm-keyboard-interaction
dsherret Sep 18, 2023
1332048
Merge branch 'main' into alert-prompt-confirm-keyboard-interaction
bartlomieju Dec 6, 2023
6778a12
update rustyline
bartlomieju Dec 6, 2023
ebb3f63
Merge branch 'main' into alert-prompt-confirm-keyboard-interaction
bartlomieju Dec 6, 2023
2634dc6
Merge branch 'main' into alert-prompt-confirm-keyboard-interaction
bartlomieju Dec 8, 2023
445c895
Merge branch 'main' into alert-prompt-confirm-keyboard-interaction
bartlomieju Dec 13, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
update rustyline
  • Loading branch information
bartlomieju committed Dec 6, 2023
commit 6778a125645319b2ed4a117d9b1d848901a53c5b
57 changes: 16 additions & 41 deletions Cargo.lock

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

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ rustls = "0.21.8"
rustls-pemfile = "1.0.0"
rustls-tokio-stream = "=0.2.16"
rustls-webpki = "0.101.4"
rustyline = { version = "=10.0.0", default-features = false, features = ["custom-bindings"] }
rustyline = { version = "=13.0.0", default-features = false, features = ["custom-bindings"] }
webpki-roots = "0.25.2"
scopeguard = "1.2.0"
saffron = "=0.1.0"
Expand Down
6 changes: 3 additions & 3 deletions cli/tools/repl/editor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ impl Highlighter for EditorHelper {
}
}

fn highlight_char(&self, line: &str, _: usize) -> bool {
fn highlight_char(&self, line: &str, _: usize, _: bool) -> bool {
!line.is_empty()
}

Expand Down Expand Up @@ -422,7 +422,7 @@ impl Highlighter for EditorHelper {

#[derive(Clone)]
pub struct ReplEditor {
inner: Arc<Mutex<Editor<EditorHelper>>>,
inner: Arc<Mutex<Editor<EditorHelper, rustyline::history::MemHistory>>>,
history_file_path: Option<PathBuf>,
errored_on_history_save: Arc<AtomicBool>,
should_exit_on_interrupt: Arc<AtomicBool>,
Expand Down Expand Up @@ -482,7 +482,7 @@ impl ReplEditor {
}

pub fn update_history(&self, entry: String) {
self.inner.lock().add_history_entry(entry);
let _ = self.inner.lock().add_history_entry(entry);
if let Some(history_file_path) = &self.history_file_path {
if let Err(e) = self.inner.lock().append_history(history_file_path) {
if self.errored_on_history_save.load(Relaxed) {
Expand Down
3 changes: 2 additions & 1 deletion runtime/ops/tty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,8 @@ pub fn op_read_line_prompt(
#[string] prompt_text: String,
#[string] default_value: String,
) -> Result<Option<String>, AnyError> {
let mut editor = Editor::<()>::new().expect("Failed to create editor.");
let mut editor = Editor::<(), rustyline::history::MemHistory>::new()
.expect("Failed to create editor.");

editor.set_keyseq_timeout(1);
editor
Expand Down
Loading