diff options
author | Thijs <thijs@thijsschreijer.nl> | 2024-06-24 23:18:10 +0200 |
---|---|---|
committer | Thijs <thijs@thijsschreijer.nl> | 2024-06-24 23:18:10 +0200 |
commit | 4dd0fbac93fcd18a8074f5021ca60be4bb87e979 (patch) | |
tree | 1906c8a2267aab01d98cfbf36bb16785e58087bf /term | |
parent | 9143542451bc7b193d4baf2b816b73f59b12cc4c (diff) | |
download | lua-term-4dd0fbac93fcd18a8074f5021ca60be4bb87e979.tar.gz lua-term-4dd0fbac93fcd18a8074f5021ca60be4bb87e979.tar.bz2 lua-term-4dd0fbac93fcd18a8074f5021ca60be4bb87e979.zip |
enable Windows support
requires LuaSystem to be installed
Diffstat (limited to 'term')
-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 |