Skip to content

Commit 1825f80

Browse files
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
1 parent 371f4d6 commit 1825f80

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libterm/terminfo/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ impl<T: Write + Send> Terminal for TerminfoTerminal<T> {
190190
fn reset(&mut self) -> io::Result<bool> {
191191
// are there any terminals that have color/attrs and not sgr0?
192192
// Try falling back to sgr, then op
193-
let cmd = match ["sg0", "sgr", "op"]
193+
let cmd = match ["sgr0", "sgr", "op"]
194194
.iter()
195195
.filter_map(|cap| self.ti.strings.get(*cap))
196196
.next() {

0 commit comments

Comments
 (0)