Code duplication cleanup after last commit
This commit is contained in:
@@ -87,14 +87,6 @@ export class Terminal {
|
||||
return result;
|
||||
}
|
||||
|
||||
getTerminalWidth(): number {
|
||||
const width = this.callbacks.getWidth?.();
|
||||
if(!width) { throw new Error('somehow width is undefined still after all the checks'); }
|
||||
|
||||
console.log(width);
|
||||
return width;
|
||||
}
|
||||
|
||||
executeCommand(input: string): void {
|
||||
this.bash.updateHistory(input);
|
||||
const parsed: ParsedInput = this._parseInput(input);
|
||||
|
||||
@@ -10,16 +10,6 @@
|
||||
|
||||
const printOutput = (e: HTMLElement, d: PrintData): void => print(e, d);
|
||||
|
||||
function getWidth() {
|
||||
const e = document.getElementById('cout');
|
||||
if(!e){
|
||||
throw new Error('cant get width of the teminal element. Its null');
|
||||
}
|
||||
const padding: number = parseInt(window.getComputedStyle(e, null).getPropertyValue('padding').slice(0, -2));
|
||||
console.log(padding);
|
||||
return e.clientWidth - (padding * 2);
|
||||
}
|
||||
|
||||
function updateTerminal() {
|
||||
username = terminal!.getUser().username;
|
||||
cwd = terminal!.getCwd();
|
||||
|
||||
Reference in New Issue
Block a user