Skip to content

Commit

Permalink
Rollup merge of rust-lang#38660 - martijnvermaat:terminfo-reset-typo,…
Browse files Browse the repository at this point in the history
… r=alexcrichton

Fix default terminfo code for reset (sg0 -> sgr0)

Resetting the terminal should first try `sgr0` (as per the comment), not
`sg0` which I believe to be a typo.

This will at least fix rustc output in Emacs terminals (e.g., ansi-term)
with `TERM=eterm-color` which does not provide the next fallback `sgr`. In
such a terminal, the final fallback `op` (`\e[39;49`) is used  which
resets only colors, not all attributes. This causes all text to be
printed in bold from the first string printed in bold by rustc onwards,
including the terminal prompt and the output from all following commands.

The typo seems to have been introduced by rust-lang#29999
  • Loading branch information
alexcrichton committed Dec 30, 2016
2 parents 7d14e3a + 1825f80 commit 3f65c5d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/libterm/terminfo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ impl<T: Write + Send> Terminal for TerminfoTerminal<T> {
fn reset(&mut self) -> io::Result<bool> {
// are there any terminals that have color/attrs and not sgr0?
// Try falling back to sgr, then op
let cmd = match ["sg0", "sgr", "op"]
let cmd = match ["sgr0", "sgr", "op"]
.iter()
.filter_map(|cap| self.ti.strings.get(*cap))
.next() {
Expand Down

0 comments on commit 3f65c5d

Please sign in to comment.