Skip to content

Commit

Permalink
fixed terminal goto
Browse files Browse the repository at this point in the history
  • Loading branch information
Szabo Bogdan committed Jul 9, 2017
1 parent 0f03096 commit 77e3048
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions lifecycle/trial/reporters/writer.d
Original file line number Diff line number Diff line change
Expand Up @@ -126,11 +126,12 @@ version(Have_arsd_official_terminal) {
alias ForceOption = arsd.terminal.ForceOption;

int lines = 0;
bool movedToBottom = false;

void setColor(Context context) {
switch(context) {
case Context.active:
terminal.color(Color.white | Bright, Color.DEFAULT);
terminal.color(Color.white | Bright, Color.DEFAULT);
break;

case Context.inactive:
Expand Down Expand Up @@ -204,6 +205,10 @@ version(Have_arsd_official_terminal) {

/// Go up `y` lines
void goTo(int y) {
if(!movedToBottom) {
movedToBottom = true;
terminal.moveTo(0, terminal.height - 1);
}
terminal.moveTo(0, terminal.cursorY - y, ForceOption.alwaysSend);
}

Expand All @@ -217,7 +222,6 @@ version(Have_arsd_official_terminal) {
terminal.flush;
resetColor;
terminal.flush;

}

/// writes a string with reversed colors
Expand Down

0 comments on commit 77e3048

Please sign in to comment.