mirror of
https://github.com/apache/maven-mvnd.git
synced 2025-09-10 04:59:54 +00:00
Fix display when more concurrent threads than the terminal height, fixes #17
This commit is contained in:
@@ -163,11 +163,17 @@ public class Client {
|
|||||||
Size size = terminal.getSize();
|
Size size = terminal.getSize();
|
||||||
display.resize(size.getRows(), size.getColumns());
|
display.resize(size.getRows(), size.getColumns());
|
||||||
List<AttributedString> lines = new ArrayList<>();
|
List<AttributedString> lines = new ArrayList<>();
|
||||||
lines.add(new AttributedString("Building..."));
|
|
||||||
projects.values().stream()
|
projects.values().stream()
|
||||||
.map(AttributedString::fromAnsi)
|
.map(AttributedString::fromAnsi)
|
||||||
.map(s -> s.columnSubSequence(0, size.getColumns()))
|
.map(s -> s.columnSubSequence(0, size.getColumns()))
|
||||||
.forEachOrdered(lines::add);
|
.forEachOrdered(lines::add);
|
||||||
|
// Make sure we don't try to display more lines than the terminal height
|
||||||
|
boolean rem = false;
|
||||||
|
while (lines.size() >= terminal.getHeight()) {
|
||||||
|
lines.remove(0);
|
||||||
|
rem = true;
|
||||||
|
}
|
||||||
|
lines.add(0, new AttributedString(rem ? "Building... (trimmed)" : "Building..."));
|
||||||
display.update(lines, -1);
|
display.update(lines, -1);
|
||||||
} else if (m instanceof BuildMessage) {
|
} else if (m instanceof BuildMessage) {
|
||||||
BuildMessage bm = (BuildMessage) m;
|
BuildMessage bm = (BuildMessage) m;
|
||||||
|
Reference in New Issue
Block a user