Well hi.
I'm trying to make a progress bar using the edit-line command, but instead of modify the last line that was printed adds a new line or doesn't do anything. It surely is something im doing wrong, or i missunderstood the function of edit-line.
I've modified the code a lot, but this is the function that i have now:
let progressStatus = 0 /// to know if its the first time that executes or not
function progress(cmd){ /// the progress bar string is drawed outside and sent via cmd
if(cmd === "done"){ /// if the progress bar finished
progressStatus = 0 /// reset the status flag
} else{ /// if not
if(progressStatus === 0){ /// if its the first time that the function is executed
Terminal.terminalObj.printToActive(cmd) /// send the first line with printToActive
progressStatus = 1; /// turns flag on
} else{ /// if its not the first time
Terminal.terminalObj.runCommandOnActive(`edit-line ${cmd}`) /// update the last line
}
}
}
//// The terminalObj is obtained inside the Terminal class with this
ref={(terminal) => { Terminal.terminalObj = terminal; }}
Well hi. I'm trying to make a progress bar using the edit-line command, but instead of modify the last line that was printed adds a new line or doesn't do anything. It surely is something im doing wrong, or i missunderstood the function of edit-line. I've modified the code a lot, but this is the function that i have now:
Any help will be apreciated. Thanks.