added getWidth method to bash and terminal + callbackf unction on the end for width rertival and calculations in the ls command

This commit is contained in:
2026-01-02 16:52:20 +01:00
parent 582eb68139
commit 7852a77a7c
5 changed files with 74 additions and 53 deletions

View File

@@ -15,6 +15,16 @@
cwd = terminal!.getCwd();
}
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 handleInput(e: KeyboardEvent) {
switch (e.key) {
case 'Enter': {
@@ -42,7 +52,8 @@
const e = document.getElementById('outputWrapper');
if (!e) return;
printOutput(e, data);
}
},
getWidth: getWidth
};
let testUser: User = {