From a04ddd9b1741b98d162c57acac5c0e2ca5f7c436 Mon Sep 17 00:00:00 2001 From: Peter Ammon Date: Sun, 10 Aug 2025 16:40:43 -0700 Subject: [PATCH] Adopt get_is_multibyte_locale in the pager --- src/pager.rs | 6 +++--- src/reader.rs | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/pager.rs b/src/pager.rs index 59bcc6c6f..abb02c23d 100644 --- a/src/pager.rs +++ b/src/pager.rs @@ -4,14 +4,14 @@ use std::collections::HashMap; use crate::common::{ - escape_string, get_ellipsis_char, get_ellipsis_str, EscapeFlags, EscapeStringStyle, + escape_string, get_ellipsis_char, get_ellipsis_str, get_is_multibyte_locale, EscapeFlags, + EscapeStringStyle, }; use crate::complete::Completion; use crate::editable_line::EditableLine; #[allow(unused_imports)] use crate::future::IsSomeAnd; use crate::highlight::{highlight_shell, HighlightRole, HighlightSpec}; -use crate::libc::MB_CUR_MAX; use crate::operation_context::OperationContext; use crate::screen::{wcswidth_rendered, wcwidth_rendered, CharOffset, Line, ScreenData}; use crate::termsize::Termsize; @@ -1243,7 +1243,7 @@ fn process_completions_into_infos(lst: &[Completion]) -> Vec { // We should probably fix this by first highlighting the original completion, and // then writing a variant of escape_string() that adjusts highlighting according // so it matches the escaped string. - && MB_CUR_MAX() > 1 + && get_is_multibyte_locale() { highlight_shell( &comp.completion, diff --git a/src/reader.rs b/src/reader.rs index 1d4a77074..07601bb3a 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -54,9 +54,10 @@ use crate::builtins::shared::STATUS_CMD_OK; use crate::common::ScopeGuarding; use crate::common::{ - escape, escape_string, exit_without_destructors, get_ellipsis_char, get_obfuscation_read_char, - restore_term_foreground_process_group_for_exit, shell_modes, str2wcstring, write_loop, - EscapeFlags, EscapeStringStyle, ScopeGuard, PROGRAM_NAME, UTF8_BOM_WCHAR, + escape, escape_string, exit_without_destructors, get_ellipsis_char, get_is_multibyte_locale, + get_obfuscation_read_char, restore_term_foreground_process_group_for_exit, shell_modes, + str2wcstring, write_loop, EscapeFlags, EscapeStringStyle, ScopeGuard, PROGRAM_NAME, + UTF8_BOM_WCHAR, }; use crate::complete::{ complete, complete_load, sort_and_prioritize, CompleteFlags, Completion, CompletionList, @@ -97,7 +98,6 @@ use crate::io::IoChain; use crate::key::ViewportPosition; use crate::kill::{kill_add, kill_replace, kill_yank, kill_yank_rotate}; -use crate::libc::MB_CUR_MAX; use crate::nix::{getpgrp, getpid, isatty}; use crate::operation_context::{get_bg_context, OperationContext}; use crate::pager::{PageRendering, Pager, SelectionMotion}; @@ -3226,7 +3226,7 @@ fn handle_readline_command(&mut self, c: ReadlineCmd) { // Update the pager data. self.pager.set_search_field_shown(true); self.pager.set_prefix( - if MB_CUR_MAX() > 1 { + if get_is_multibyte_locale() { L!("► ") } else { L!("> ")