mirror of
https://github.com/martinvonz/jj.git
synced 2024-12-28 15:34:22 +00:00
cli: set LESSCHARSET=utf-8
for our default less -FRX
pager
Without a pager configured (in `ui.pager` or `$PAGER`), running `LC_CTYPE=foo jj log` would replace the Unicode characters in our (Sapling's) "curved" graph style by escapes, like this: ``` @ 1d4ae2372dd2 martinvonz@google.com 2023-02-11 14:56:00.000 -08:00 a8eac1f9efe8 <E2><94><82> (no description set) ``` This fixes that by including the `LESSCHARSET=utf-8` environment variable in our default `ui.pager` value.
This commit is contained in:
parent
170de4749f
commit
aefd0fe69e
1 changed files with 7 additions and 2 deletions
|
@ -18,8 +18,9 @@ use std::str::FromStr;
|
|||
use std::{fmt, io, mem};
|
||||
|
||||
use crossterm::tty::IsTty;
|
||||
use maplit::hashmap;
|
||||
|
||||
use crate::config::CommandNameAndArgs;
|
||||
use crate::config::{CommandNameAndArgs, NonEmptyCommandArgsVec};
|
||||
use crate::formatter::{Formatter, FormatterFactory, LabeledWriter};
|
||||
|
||||
pub struct Ui {
|
||||
|
@ -103,7 +104,11 @@ impl Default for PaginationChoice {
|
|||
fn pager_setting(config: &config::Config) -> CommandNameAndArgs {
|
||||
config
|
||||
.get("ui.pager")
|
||||
.unwrap_or_else(|_| "less -FRX".into())
|
||||
.unwrap_or_else(|_| CommandNameAndArgs::Structured {
|
||||
command: NonEmptyCommandArgsVec::try_from(vec!["less".to_string(), "-FRX".to_string()])
|
||||
.unwrap(),
|
||||
env: hashmap! { "LESSCHARSET".to_string() => "utf-8".to_string() },
|
||||
})
|
||||
}
|
||||
|
||||
impl Ui {
|
||||
|
|
Loading…
Reference in a new issue