Skip to content

Commit

Permalink
terminfo: Pretend to be xterm if Windows console supports ansi
Browse files Browse the repository at this point in the history
 As mentioned in the comment, Windows people seem to be fine with this:
 microsoft/WSL#1446

 I still think a precise terminfo file with the list of
 supported sequences documented in the below link would be ideal:
 https://docs.microsoft.com/en-us/windows/console/console-virtual-terminal-sequences

 But I didn't find such a file. And I don't know how to generate one easily.

Signed-off-by: Mohammad AlSaleh <[email protected]>
  • Loading branch information
MoSal committed Aug 21, 2018
1 parent 5c98f59 commit 648bf59
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions src/terminfo/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ use std::io;
use std::io::BufReader;
use std::path::Path;


#[cfg(windows)]
use win;

use Attr;
use color;
use Terminal;
Expand Down Expand Up @@ -67,6 +71,18 @@ impl TermInfo {
}
})
});

#[cfg(windows)]
let term_name = term_name.or_else(|| {
if win::conout_supports_ansi() {
// Microsoft people don't seem to mind, I think:
// https://github.com/Microsoft/WSL/issues/1446
Some("xterm-256color")
} else {
None
}
});

if let Some(term_name) = term_name {
return TermInfo::from_name(term_name);
} else {
Expand Down

0 comments on commit 648bf59

Please sign in to comment.