Skip to content

Commit 0ae0e2e

Browse files
committed
infocmp -C: don't mark a bare %? verbatim cap obsolete
The ".." obsolete marker tracks parameter/arithmetic usage (%p/%+/%-/%*), not a conditional operator on its own: a value like is3=\E%? (a bare %? with no parameter or conditional body) is copied through unmarked, as ncurses does (wy350 i2). terminfo -1 100%; tests green; termcap (-C) content 82.0%. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01CbiPgWC3PHKmrTNvZzXcWQ
1 parent 72be71b commit 0ae0e2e

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

crates/ncurses-tools/src/bin/infocmp.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -669,14 +669,14 @@ fn drop_acs_for_consistency(ti: &Terminfo) -> bool {
669669
}
670670

671671
/// Build a termcap field `code=value`. A value kept verbatim (untranslatable) is prefixed with `..`
672-
/// only when it references a parameter or uses arithmetic/conditional ops (`%p`/`%+`/`%-`/`%*`/`%?`/
673-
/// `%t`/`%e`/`%;`): ncurses marks such caps obsolete, but copies through non-parameterized exotica
674-
/// (`%g`/`%P`/`%^`/`%{`/unknown ops) unmarked.
672+
/// only when it references a parameter or uses arithmetic (`%p`/`%+`/`%-`/`%*`): ncurses marks such
673+
/// caps obsolete, but copies through non-parameterized exotica (`%g`/`%P`/`%^`/`%{`, a bare `%?`
674+
/// without a conditional body, unknown ops) unmarked.
675675
fn tc_field(code: &str, raw: &[u8]) -> String {
676676
let (val, verbatim) = tc_xlat(raw);
677677
let marks_obsolete = raw
678678
.windows(2)
679-
.any(|w| w[0] == b'%' && matches!(w[1], b'p' | b'+' | b'-' | b'*' | b'?' | b't' | b'e' | b';'));
679+
.any(|w| w[0] == b'%' && matches!(w[1], b'p' | b'+' | b'-' | b'*'));
680680
let prefix = if verbatim && marks_obsolete { ".." } else { "" };
681681
format!("{prefix}{code}={val}")
682682
}

0 commit comments

Comments
 (0)