mirror of
https://github.com/ClementTsang/bottom.git
synced 2025-07-27 07:34:27 +02:00
Use max grapheme length rather than max "string" length.
This commit is contained in:
parent
a755a5d41c
commit
ce9b5372d9
@ -9,6 +9,7 @@ use crate::{canvas, constants, utils::error::Result};
|
|||||||
mod process_killer;
|
mod process_killer;
|
||||||
|
|
||||||
use unicode_segmentation::GraphemeCursor;
|
use unicode_segmentation::GraphemeCursor;
|
||||||
|
use unicode_width::UnicodeWidthStr;
|
||||||
|
|
||||||
const MAX_SEARCH_LENGTH: usize = 200;
|
const MAX_SEARCH_LENGTH: usize = 200;
|
||||||
|
|
||||||
@ -818,11 +819,12 @@ impl App {
|
|||||||
self.last_key_press = current_key_press_inst;
|
self.last_key_press = current_key_press_inst;
|
||||||
|
|
||||||
if let WidgetPosition::ProcessSearch = self.current_widget_selected {
|
if let WidgetPosition::ProcessSearch = self.current_widget_selected {
|
||||||
if self
|
if UnicodeWidthStr::width_cjk(
|
||||||
.process_search_state
|
self.process_search_state
|
||||||
.search_state
|
.search_state
|
||||||
.current_search_query
|
.current_search_query
|
||||||
.len() <= MAX_SEARCH_LENGTH
|
.as_str(),
|
||||||
|
) <= MAX_SEARCH_LENGTH
|
||||||
{
|
{
|
||||||
self.process_search_state
|
self.process_search_state
|
||||||
.search_state
|
.search_state
|
||||||
|
Loading…
x
Reference in New Issue
Block a user