diff options
Diffstat (limited to 'term/init.lua')
-rw-r--r-- | term/init.lua | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/term/init.lua b/term/init.lua index bd2024b..b0387a6 100644 --- a/term/init.lua +++ b/term/init.lua | |||
@@ -18,6 +18,19 @@ | |||
18 | -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | 18 | -- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN |
19 | -- THE SOFTWARE. | 19 | -- THE SOFTWARE. |
20 | 20 | ||
21 | do -- set console to utf-8 and enable ANSI escape sequences on Windows | ||
22 | local ok, sys = pcall(require, "system") | ||
23 | if ok and sys.setconsoleflags and sys.windows then | ||
24 | sys.setconsoleoutputcp(sys.CODEPAGE_UTF8) | ||
25 | if sys.isatty(io.stdout) then | ||
26 | sys.setconsoleflags(io.stdout, sys.getconsoleflags(io.stdout) + sys.COF_VIRTUAL_TERMINAL_PROCESSING) | ||
27 | end | ||
28 | if sys.isatty(io.stderr) then | ||
29 | sys.setconsoleflags(io.stderr, sys.getconsoleflags(io.stderr) + sys.COF_VIRTUAL_TERMINAL_PROCESSING) | ||
30 | end | ||
31 | end | ||
32 | end | ||
33 | |||
21 | local term = require 'term.core' | 34 | local term = require 'term.core' |
22 | local sformat = string.format | 35 | local sformat = string.format |
23 | local iotype = io.type | 36 | local iotype = io.type |