Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Multi-line status prompt ticker #3577

Merged
merged 121 commits into from
Sep 26, 2024
Merged
Changes from 1 commit
Commits
Show all changes
121 commits
Select commit Hold shift + click to select a range
d532b49
wip
lihaoyi Sep 18, 2024
82a2ab0
Merge branch 'main' into multi-prompt
lihaoyi Sep 18, 2024
52d4163
.
lihaoyi Sep 18, 2024
35fcf43
works when not scrolling, but scrolling breaks save/restore cursor
lihaoyi Sep 18, 2024
8cdca12
.
lihaoyi Sep 18, 2024
2c615ab
.
lihaoyi Sep 18, 2024
277feef
wip trying to buffer output
lihaoyi Sep 18, 2024
c9bc44a
track newlines in wrapped multiline prompt stream
lihaoyi Sep 19, 2024
6c8f3c1
wip
lihaoyi Sep 19, 2024
da050ab
works
lihaoyi Sep 19, 2024
4ff88de
wip
lihaoyi Sep 19, 2024
771be38
wip
lihaoyi Sep 19, 2024
81311f2
wip
lihaoyi Sep 19, 2024
641f55e
.
lihaoyi Sep 19, 2024
64f8973
.
lihaoyi Sep 19, 2024
3c98ee2
.
lihaoyi Sep 19, 2024
486be7d
.
lihaoyi Sep 19, 2024
038aae9
.
lihaoyi Sep 19, 2024
239f76a
.
lihaoyi Sep 19, 2024
a70766d
Merge branch 'main' into multi-prompt
lihaoyi Sep 19, 2024
bd68251
.
lihaoyi Sep 19, 2024
bd895a0
119 width, preserve ending header
lihaoyi Sep 19, 2024
36b97f8
.
lihaoyi Sep 19, 2024
990f7d1
.
lihaoyi Sep 19, 2024
c447df0
wip
lihaoyi Sep 19, 2024
515e704
.
lihaoyi Sep 19, 2024
cb6f9b6
.
lihaoyi Sep 19, 2024
f2cd440
.
lihaoyi Sep 19, 2024
d1c41d7
.
lihaoyi Sep 19, 2024
8ab7918
.
lihaoyi Sep 19, 2024
b6ad58c
make use of org.jline.terminal
lihaoyi Sep 19, 2024
7fda88f
prompt title centering
lihaoyi Sep 19, 2024
4c5efd5
preserve prompt header for final render during shutdown
lihaoyi Sep 19, 2024
3269c72
renderHeader tests
lihaoyi Sep 19, 2024
d67b456
more debouncing on removal
lihaoyi Sep 19, 2024
616dea6
Long.MaxValue
lihaoyi Sep 19, 2024
a5e1385
transfer terminfo from client
lihaoyi Sep 19, 2024
325ccc1
renderPrompt unit tests
lihaoyi Sep 19, 2024
e4f3ea6
wip removalDelay test
lihaoyi Sep 19, 2024
d44b0d5
fix rendering
lihaoyi Sep 19, 2024
d79906e
fix-compile
lihaoyi Sep 19, 2024
12ec229
.
lihaoyi Sep 19, 2024
085ede3
.
lihaoyi Sep 19, 2024
611c7d4
use ProxyStream to prepare for batch prompt updates
lihaoyi Sep 19, 2024
34c7208
.
lihaoyi Sep 19, 2024
6842986
move StateStream logic into Pumper hooks for debouncing
lihaoyi Sep 20, 2024
816b800
avoid duplicate preWrite clearScreens
lihaoyi Sep 20, 2024
432b1fc
buffer up prompts
lihaoyi Sep 20, 2024
7db0c81
write final prompt before closing streams
lihaoyi Sep 20, 2024
36ac687
simplify termDimensions
lihaoyi Sep 20, 2024
306ec44
simplify termDimensions
lihaoyi Sep 20, 2024
1df4fe4
fix more threads reporting and remove unnecessary blank line at bottom
lihaoyi Sep 20, 2024
8f8ed1c
more fixes
lihaoyi Sep 20, 2024
289c8dd
fix+format
lihaoyi Sep 20, 2024
b40bba8
improve non-interactive prompting
lihaoyi Sep 20, 2024
1e0110f
.
lihaoyi Sep 20, 2024
1573a96
tweaks
lihaoyi Sep 20, 2024
3e51dab
try and fix exit code
lihaoyi Sep 20, 2024
9ed81b3
avoid closing downstream streams in ProxyStreams.Pumper
lihaoyi Sep 20, 2024
a3c0fe6
.
lihaoyi Sep 20, 2024
35907a3
fixes
lihaoyi Sep 20, 2024
b5a7083
fixes
lihaoyi Sep 20, 2024
3156586
wip
lihaoyi Sep 21, 2024
2eab6a2
add global override for systemstreams to prevent threading problems
lihaoyi Sep 21, 2024
7199e05
fix stream original comparison
lihaoyi Sep 21, 2024
1a05e1c
fix missing trailing output
lihaoyi Sep 21, 2024
7ccdea3
fix
lihaoyi Sep 21, 2024
e8420a0
avoid infinite recursion with system.out
lihaoyi Sep 21, 2024
e3de328
swap out Piped*Stream with our on PipeStreams
lihaoyi Sep 22, 2024
e23fc07
.
lihaoyi Sep 22, 2024
aabc13d
put back line prefixes
lihaoyi Sep 22, 2024
6da90c0
fixes
lihaoyi Sep 22, 2024
5d85b47
fixes
lihaoyi Sep 22, 2024
e4cd4f6
fixes
lihaoyi Sep 22, 2024
2ae3478
fix
lihaoyi Sep 22, 2024
985c691
.
lihaoyi Sep 22, 2024
414e727
try to fix circular system stream
lihaoyi Sep 22, 2024
68b0d1a
.
lihaoyi Sep 23, 2024
7f94afd
.
lihaoyi Sep 23, 2024
7fcd03d
.
lihaoyi Sep 23, 2024
21d3704
Merge branch 'main' into multi-prompt
lihaoyi Sep 23, 2024
d2d2b1e
.
lihaoyi Sep 23, 2024
516182d
.
lihaoyi Sep 23, 2024
7726da3
.
lihaoyi Sep 23, 2024
38a2b1a
always notify in PipeStreams
lihaoyi Sep 23, 2024
fd3acf9
.
lihaoyi Sep 23, 2024
4704013
task log headers
lihaoyi Sep 23, 2024
6dd4e17
.
lihaoyi Sep 24, 2024
0cce6b1
split out MultilinePromptLoggerUtil
lihaoyi Sep 24, 2024
f4dbbe0
add simple integration test for MultilinePromptLogger
lihaoyi Sep 24, 2024
101802a
implement test terminal
lihaoyi Sep 24, 2024
048f00b
wip
lihaoyi Sep 24, 2024
470caf5
wip
lihaoyi Sep 24, 2024
a211350
disable prompt updater in integration tests
lihaoyi Sep 24, 2024
66b389d
wip
lihaoyi Sep 24, 2024
9989a08
.
lihaoyi Sep 24, 2024
35c0638
.
lihaoyi Sep 24, 2024
4fdfdbf
use raw outputstreams in withPromptPaused
lihaoyi Sep 24, 2024
4965555
.
lihaoyi Sep 24, 2024
c61c914
Merge branch 'main' into multi-prompt
lihaoyi Sep 25, 2024
7f6c713
rename
lihaoyi Sep 25, 2024
b042c77
rename
lihaoyi Sep 25, 2024
ae88d2b
remove unnecessary sleep
lihaoyi Sep 25, 2024
93f6fae
.
lihaoyi Sep 25, 2024
5f74864
wip
lihaoyi Sep 25, 2024
1ca0c71
wip
lihaoyi Sep 25, 2024
b3a69f7
wip
lihaoyi Sep 25, 2024
7057570
wip
lihaoyi Sep 25, 2024
5482bfb
wip
lihaoyi Sep 25, 2024
b7579d1
avoid using SystemStreams.original due to it's uncapturability in ser…
lihaoyi Sep 25, 2024
c127015
disable prompt integration tests on windows due to flakiness
lihaoyi Sep 25, 2024
32cc9c4
.
lihaoyi Sep 25, 2024
c4a9578
make prompt based on prefix keys rather than thread IDs
lihaoyi Sep 26, 2024
38386bc
renames
lihaoyi Sep 26, 2024
0a475d6
.
lihaoyi Sep 26, 2024
b62f9e7
color prompt details
lihaoyi Sep 26, 2024
c9d0f7a
merge
lihaoyi Sep 26, 2024
f95f5b6
mima
lihaoyi Sep 26, 2024
3a8a4e7
merge
lihaoyi Sep 26, 2024
7a029da
.
lihaoyi Sep 26, 2024
bcf1056
.
lihaoyi Sep 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
preserve prompt header for final render during shutdown
  • Loading branch information
lihaoyi committed Sep 19, 2024
commit 4c5efd5d3d4f8fe93973cc31418d3eabe72da83b
27 changes: 18 additions & 9 deletions main/util/src/mill/util/MultilinePromptLogger.scala
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@ private[mill] class MultilinePromptLogger(
)

override def close(): Unit = {
state.refreshPrompt()
state.refreshPrompt(ending = true)
stopped = true
}

@@ -130,15 +130,19 @@ private object MultilinePromptLogger {
(AnsiNav.clearScreen(0) + AnsiNav.left(9999)).getBytes
private var currentPromptBytes: Array[Byte] = Array[Byte]()

private def updatePromptBytes() = {
private def updatePromptBytes(ending: Boolean = false) = {
val now = System.currentTimeMillis()
for (k <- statuses.keySet) {
val removedTime = statuses(k).removedTimeMillis
if (removedTime != -1 && now - removedTime > statusRemovalDelayMillis) {
if (removedTime != -1 && now - removedTime > statusRemovalDelayMillis){
statuses.remove(k)
}
}

// For the ending prompt, make sure we clear out all
// the statuses to only show the header alone
if (ending) statuses.clear()

// -1 to leave a bit of buffer
val maxWidth = ConsoleDim.width() - 1
// -2 to account for 1 line header and 1 line `more threads`
@@ -162,10 +166,15 @@ private object MultilinePromptLogger {

val currentPrompt = header :: body
val currentHeight = body.length + 1
currentPromptBytes =
(AnsiNav.clearScreen(0) + currentPrompt.mkString("\n") + "\n" + AnsiNav.up(
currentHeight
)).getBytes
// For the ending prompt, leave the cursor at the bottom rather than scrolling back up.
// We do not want further output to overwrite the header as it will no longer re-render
val backUp = if (ending) "" else AnsiNav.up(currentHeight)
currentPromptBytes = (
AnsiNav.clearScreen(0) +
currentPrompt.mkString("\n") +
"\n" +
backUp
).getBytes
}

def updateGlobal(s: String): Unit = synchronized {
@@ -190,8 +199,8 @@ private object MultilinePromptLogger {
res
}

def refreshPrompt(): Unit = synchronized {
updatePromptBytes()
def refreshPrompt(ending: Boolean = false): Unit = synchronized {
updatePromptBytes(ending)
if (enableTicker) systemStreams0.err.write(currentPromptBytes)
}

Loading