Skip to content

Commit

Permalink
Pretend to be xterm if Windows console supports ansi
Browse files Browse the repository at this point in the history
 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 Nov 3, 2018
1 parent 19303a7 commit f4400b1
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 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,17 @@ impl TermInfo {
}
})
});

#[cfg(windows)]
{
if term_name.is_none() && win::conout_supports_ansi() {
// Microsoft people seem to be fine with pretending to be xterm:
// https://github.com/Microsoft/WSL/issues/1446
// The basic ANSI fallback terminal will be uses.
return TermInfo::from_name("xterm");
}
}

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

0 comments on commit f4400b1

Please sign in to comment.