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 274e30b
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 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,16 @@ impl TermInfo {
}
})
});

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

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

0 comments on commit 274e30b

Please sign in to comment.