mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-21 23:01:05 +00:00
fix: renaming may cause a crash when encountering Unicode characters (#519)
This commit is contained in:
parent
cb80ca81da
commit
89848ad779
1 changed files with 6 additions and 1 deletions
|
|
@ -64,7 +64,12 @@ impl Manager {
|
|||
let name = Self::empty_url_part(&hovered, opt.empty);
|
||||
let cursor = match opt.cursor {
|
||||
"start" => Some(0),
|
||||
"before_ext" => name.rfind('.').filter(|&n| n != 0),
|
||||
"before_ext" => name
|
||||
.chars()
|
||||
.rev()
|
||||
.position(|c| c == '.')
|
||||
.map(|i| name.chars().count() - i - 1)
|
||||
.filter(|&i| i != 0),
|
||||
_ => None,
|
||||
};
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue