Skip to content

Commit b37d081

Browse files
authored
enable StickyMessages ansi_codes on Windows (#37)
This now works due to new libuv patches landing in recent julia versions. Fixes #28
1 parent c24a6bd commit b37d081

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "TerminalLoggers"
22
uuid = "5d786b92-1e48-4d6f-9151-6b4477ca9bed"
33
authors = ["Chris Foster <[email protected]>"]
4-
version = "0.1.2"
4+
version = "0.1.3"
55

66
[deps]
77
LeftChildRightSiblingTrees = "1d6d02ad-be62-4b6b-8a6d-2f90e265016e"

docs/src/index.md

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,8 @@ end
7272
```
7373

7474
!!! note
75-
Rendering progress bars separately doesn't yet work on windows due to
76-
limitations of the windows console and its interaction with libuv.
77-
We expect this will eventually be solved with some combination of libuv
78-
updates and the new windows terminal.
75+
On Windows, rendering progress bars requires julia 1.5.3 or later,
76+
and scrolling works best on a modern terminal like Windows Terminal.
7977

8078
You can also use the older progress logging API with the `progress=fraction`
8179
key value pair. This is simpler but has some downsides such as not interacting

src/StickyMessages.jl

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""
2-
StickyMessages(io::IO; ansi_codes=io isa Base.TTY && !Sys.iswindows())
2+
StickyMessages(io::IO; ansi_codes=io isa Base.TTY &&
3+
(!Sys.iswindows() || VERSION >= v"1.5.3"))
34
45
A `StickyMessages` type manages the display of a set of persistent "sticky"
56
messages in a terminal. That is, messages which are not part of the normal
@@ -19,11 +20,8 @@ mutable struct StickyMessages
1920
end
2021

2122
function StickyMessages(io::IO; ansi_codes=io isa Base.TTY &&
22-
# Give up on Windows for now, as libuv doesn't recognize the scroll region code.
23-
# Will need to be fixed in libuv and thence julia, but first libuv PR 1884 should merge. See
24-
# https://github.com/libuv/libuv/pull/1884
25-
# https://github.com/JuliaLang/libuv/commit/ed3700c849289ed01fe04273a7bf865340b2bd7e
26-
!Sys.iswindows())
23+
# scroll region code on Windows only works with recent libuv, present in 1.5.3+
24+
(!Sys.iswindows() || VERSION >= v"1.5.3"))
2725
sticky = StickyMessages(io, ansi_codes, Vector{Pair{Any,String}}())
2826
# Ensure we clean up the terminal
2927
finalizer(sticky) do sticky

0 commit comments

Comments
 (0)