about summary refs log tree commit diff
diff options
context:
space:
mode:
authorMartijn Vermaat <martijn@vermaat.name>2016-12-28 14:40:00 -0500
committerMartijn Vermaat <martijn@vermaat.name>2016-12-28 14:40:00 -0500
commit1825f80fab649f0a5647239c58bcfbc58f378947 (patch)
treecef9af3a745f5b6b09468dce5116739d42d63b37
parent371f4d6bf697ac4b08845b6e739ab263df6f8395 (diff)
downloadrust-1825f80fab649f0a5647239c58bcfbc58f378947.tar.gz
rust-1825f80fab649f0a5647239c58bcfbc58f378947.zip
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 #29999
-rw-r--r--src/libterm/terminfo/mod.rs2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/libterm/terminfo/mod.rs b/src/libterm/terminfo/mod.rs
index 395d966b9f2..68cfc7033ef 100644
--- a/src/libterm/terminfo/mod.rs
+++ b/src/libterm/terminfo/mod.rs
@@ -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() {