forked from mirrors/jj
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 std::{fmt, io, mem};
|
||||||
|
|
||||||
use crossterm::tty::IsTty;
|
use crossterm::tty::IsTty;
|
||||||
|
use maplit::hashmap;
|
||||||
|
|
||||||
use crate::config::CommandNameAndArgs;
|
use crate::config::{CommandNameAndArgs, NonEmptyCommandArgsVec};
|
||||||
use crate::formatter::{Formatter, FormatterFactory, LabeledWriter};
|
use crate::formatter::{Formatter, FormatterFactory, LabeledWriter};
|
||||||
|
|
||||||
pub struct Ui {
|
pub struct Ui {
|
||||||
|
@ -103,7 +104,11 @@ impl Default for PaginationChoice {
|
||||||
fn pager_setting(config: &config::Config) -> CommandNameAndArgs {
|
fn pager_setting(config: &config::Config) -> CommandNameAndArgs {
|
||||||
config
|
config
|
||||||
.get("ui.pager")
|
.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 {
|
impl Ui {
|
||||||
|
|
Loading…
Reference in a new issue