@@ -74,20 +74,22 @@ int watchMain(string[] args)
7474 bool hasShownLastLineMessage = false ;
7575 terminal.updateCursorPosition();
7676 terminal.hideCursor();
77- int cursorY = terminal.cursorY + 1 ;
77+ int cursorY = terminal.cursorY;
7878 int buildLinesCount = 0 ;
7979 int runLinesCount = 0 ;
80- int firstCursorY = cursorY - 1 ;
80+ int firstCursorY = cursorY;
8181 int failureCursorYOffset = 0 ;
8282
8383 bool autoRunScheduled = false ;
8484
85- while (true )
85+ bool bRunning = true ;
86+
87+ while (bRunning)
8688 {
8789 import core.thread ;
8890 if (! drawnBuildStats)
8991 {
90- terminal.moveTo(0 , cursorY - 1 , ForceOption.alwaysSend);
92+ terminal.moveTo(0 , cursorY, ForceOption.alwaysSend);
9193 terminal.clearToEndOfLine();
9294 terminal.write(" | Build " , buildCount, " | " );
9395 long min = minTime, max = maxTime;
@@ -123,25 +125,28 @@ int watchMain(string[] args)
123125
124126 ProjectDetails doProjectBuild (ProjectDetails d)
125127 {
128+ if (isProjectUpToDate(d))
129+ return d;
126130 ulong clearCount = 1 + failureCursorYOffset; // The build stats at leat.
127131 if (! watchArgs.run) clearCount+= choices.length + 1 ; // Selection hint
128132
129- clearLines(terminal, clearCount + buildLinesCount, firstCursorY); // -offset because I have no idea
133+ clearLines(terminal, clearCount + buildLinesCount + runLinesCount , firstCursorY);
130134 failureCursorYOffset = 0 ;
131135
132136 import std.datetime.stopwatch ;
133137 StopWatch sw = StopWatch(AutoStart.yes);
134138 try
135139 {
136140 d = buildProject(d);
141+ d = redub.extensions.cli.resolveDependencies(args.dup );
137142 successCount++ ;
138143 long buildTime = sw.peek.total! " msecs" ;
139144 timeSpentBuilding+= buildTime;
140145
141146 terminal.updateCursorPosition();
142147
143148 buildLinesCount = (terminal.cursorY - 1 ) - firstCursorY; // -1 because of the | Build | stats
144- cursorY = terminal.cursorY + 1 ;
149+ cursorY = terminal.cursorY;
145150
146151
147152 if (buildTime > maxTime) maxTime = buildTime;
@@ -190,10 +195,10 @@ int watchMain(string[] args)
190195 {
191196 if (autoRunScheduled)
192197 {
193- terminal.moveTo(0 , cursorY, ForceOption.alwaysSend);
198+ terminal.moveTo(0 , cursorY + 1 , ForceOption.alwaysSend);
194199 executeProgram(d.tree, null );
195200 terminal.updateCursorPosition();
196- runLinesCount = terminal.cursorY - cursorY;
201+ runLinesCount = ( terminal.cursorY - cursorY) ;
197202 autoRunScheduled = false ;
198203 }
199204 }
@@ -205,7 +210,7 @@ int watchMain(string[] args)
205210 auto selected = selectChoiceBase(terminal, k, choices, choice, cursorY+ failureCursorYOffset);
206211 if (! selected)
207212 {
208- drawChoices(terminal, choices, choices[choice], cursorY+ failureCursorYOffset);
213+ drawChoices(terminal, choices, choices[choice], cursorY+ 1 + failureCursorYOffset);
209214 hasShownLastLineMessage = true ;
210215 }
211216 else
@@ -217,8 +222,8 @@ int watchMain(string[] args)
217222 terminal.writeln(" Press any button to continue." );
218223 input.getch();
219224 terminal.updateCursorPosition();
220- int newOffset = terminal.cursorY - cursorY;
221- clearLines(terminal, newOffset , cursorY);
225+ runLinesCount = terminal.cursorY - cursorY;
226+ clearLines(terminal, runLinesCount , cursorY);
222227 hasShownLastLineMessage = false ;
223228 drawnBuildStats = false ;
224229 break ;
@@ -228,15 +233,16 @@ int watchMain(string[] args)
228233 d.forceRebuild = false ;
229234 break ;
230235 case " Exit" :
231- return 0 ;
236+ bRunning = false ;
237+ break ;
232238 }
233239 }
234240 }
235241 }
236242 Thread .sleep(dur! " msecs" (33 ));
237243 }
238244
239- clearLines(terminal, buildLinesCount, cursorY);
245+ clearLines(terminal, buildLinesCount+ runLinesCount + choices.length + 2 , cursorY); // Selection hint + Build Stats
240246
241247 terminal.showCursor();
242248
0 commit comments