Start of binary search for ls command

This commit is contained in:
2026-02-12 06:21:30 +01:00
parent f678c0fa54
commit 05c3dcd5b5
6 changed files with 106 additions and 15 deletions

View File

@@ -20,11 +20,21 @@
if(!e){
throw new Error('cant get width of the teminal element. Its null');
}
//gets an int from padding property value (which is a string) by cutting last 2 letters "px" and parsing to int
const padding: number = parseInt(window.getComputedStyle(e, null).getPropertyValue('padding').slice(0, -2));
console.log(padding);
return e.clientWidth - (padding * 2);
}
function getFontSize() {
const e = document.getElementById('cout');
if(!e) {
throw new Error('cant get font size of the terminal element. its null');
}
const size: number = parseInt(window.getComputedStyle(e, null).getPropertyValue('font-size').slice(0, -2));
return size;
}
function handleInput(e: KeyboardEvent) {
switch (e.key) {
case 'Enter': {
@@ -54,7 +64,8 @@
if (!e) return;
printOutput(e, data);
},
getWidth: getWidth
getWidth: getWidth,
getFontSize: getFontSize
};
//Test user with basic data so the bash can run