mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-12 16:50:10 +00:00
fix panic when operating inside graphemes while trying to find quotes
This commit is contained in:
parent
a9355654df
commit
bbed401314
2 changed files with 2 additions and 1 deletions
|
|
@ -1,4 +1,5 @@
|
||||||
#![feature(anonymous_lifetime_in_impl_trait)]
|
#![feature(anonymous_lifetime_in_impl_trait)]
|
||||||
|
#![feature(round_char_boundary)]
|
||||||
|
|
||||||
pub mod command;
|
pub mod command;
|
||||||
pub mod flag;
|
pub mod flag;
|
||||||
|
|
|
||||||
|
|
@ -48,7 +48,7 @@ lazy_static::lazy_static! {
|
||||||
// quotes need to be at start/end of words, and are ignored if a closing quote is not present
|
// quotes need to be at start/end of words, and are ignored if a closing quote is not present
|
||||||
// WTB POSIX quoting: https://pubs.opengroup.org/onlinepubs/9799919799/utilities/V3_chap02.html
|
// WTB POSIX quoting: https://pubs.opengroup.org/onlinepubs/9799919799/utilities/V3_chap02.html
|
||||||
fn find_quotes(match_str: &str) -> Option<usize> {
|
fn find_quotes(match_str: &str) -> Option<usize> {
|
||||||
if let Some(right) = QUOTE_PAIRS.get(&match_str[0..1]) {
|
if let Some(right) = QUOTE_PAIRS.get(&match_str[0..match_str.ceil_char_boundary(1)]) {
|
||||||
// try matching end quote
|
// try matching end quote
|
||||||
for possible_quote in right.chars() {
|
for possible_quote in right.chars() {
|
||||||
for (pos, _) in match_str.match_indices(possible_quote) {
|
for (pos, _) in match_str.match_indices(possible_quote) {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue