forked from extern/nushell
fix: use buffer.len()
instead of cursor_pos
, so the .expect()
isn't useless (#9053)
# Description Use `buffer.len()` instead of `cursor_pos`, so the `.expect()` isn't useless. # User-Facing Changes # Tests + Formatting # After Submitting
This commit is contained in:
parent
a78cd6e231
commit
2a484a3e7e
@ -118,7 +118,7 @@ impl Command for Commandline {
|
||||
.expect("repl cursor pos mutex");
|
||||
let char_pos = buffer
|
||||
.grapheme_indices(true)
|
||||
.chain(std::iter::once((*cursor_pos, "")))
|
||||
.chain(std::iter::once((buffer.len(), "")))
|
||||
.position(|(i, _c)| i == *cursor_pos)
|
||||
.expect("Cursor position isn't on a grapheme boundary");
|
||||
Ok(Value::String {
|
||||
|
Loading…
Reference in New Issue
Block a user