mirror of
https://github.com/nushell/nushell.git
synced 2024-12-23 15:39:06 +01:00
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