From 2a6558f6677cd3251c48d3b907f3941a592cbe57 Mon Sep 17 00:00:00 2001 From: Ali Hassan Date: Fri, 9 Feb 2024 00:50:06 +0500 Subject: [PATCH] Now terminal focus area is full --- src/node_modules/tab-window/tab-window.js | 19 +++++++++++++------ src/node_modules/terminal/terminal.js | 2 +- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/src/node_modules/tab-window/tab-window.js b/src/node_modules/tab-window/tab-window.js index 6daceab..b7d978e 100644 --- a/src/node_modules/tab-window/tab-window.js +++ b/src/node_modules/tab-window/tab-window.js @@ -23,6 +23,7 @@ function tab_window (opts = default_opts, protocol) { const ro = new ResizeObserver(entries => { console.log('ResizeObserver:terminal:resize') const scroll_channel = state.net[state.aka.scrollbar] + textAreaAdjust() scroll_channel.send({ head: [id, scroll_channel.send.id, scroll_channel.mid++], refs: { }, @@ -81,7 +82,6 @@ function tab_window (opts = default_opts, protocol) { // ---------------------------------------- // ELEMENTS // ---------------------------------------- - input.onkeyup = textAreaAdjust input.onkeydown = handleKeyDown { // scrollbar @@ -134,9 +134,13 @@ function tab_window (opts = default_opts, protocol) { return el - function textAreaAdjust (e) { - e.target.style.height = "1px"; - e.target.style.height = (25+e.target.scrollHeight)+"px"; + function textAreaAdjust () { + if(scrollbar_wrapper.classList.contains('fullscreen')){ + input.style.minHeight = `${window.innerHeight - 110 - history.getBoundingClientRect().height}px` + } + else{ + input.style.minHeight = `${194 - history.getBoundingClientRect().height}px` + } } function handleKeyDown (e) { if (e.which === 13){ @@ -179,7 +183,6 @@ function tab_window (opts = default_opts, protocol) { response = command_list const arguments = data.split('/') arguments.forEach(argument => { - console.error(argument) if(argument){ response = response[argument] check = false @@ -213,7 +216,6 @@ function tab_window (opts = default_opts, protocol) { response = command_list const arguments = data.split('/') arguments.forEach(argument => { - console.error(response) if(argument){ response = response[argument] check = false @@ -286,6 +288,7 @@ function tab_window (opts = default_opts, protocol) { } function toggle_fullscreen (msg){ scrollbar_wrapper.classList.toggle('fullscreen') + textAreaAdjust() } async function on_shrink (){ scrollbar_wrapper.classList.add('shrink') @@ -329,12 +332,16 @@ function get_theme() { border: none; outline: none; width: 100%; + min-height: 194px; text-indent: 20px; font-family: Silkscreen; font-size: 16px; padding: 0; resize: none; } + .tab_wrapper .scrollbar_wrapper.fullscreen #input{ + min-height: calc(100vh - 110px); + } .tab_wrapper .dollar{ position: relative; } diff --git a/src/node_modules/terminal/terminal.js b/src/node_modules/terminal/terminal.js index 50ba11e..2dbe114 100644 --- a/src/node_modules/terminal/terminal.js +++ b/src/node_modules/terminal/terminal.js @@ -33,7 +33,7 @@ function terminal (opts = default_opts, protocol) { refs: { }, type: 'handle_scroll', }) - //Added this to avoid a very sticky situation where the height of tabs_window needs to be changed when scrollbar appear + //Added this to avoid a very sticky situation where the height of tabs_window needs to be changed when scrollbar appears if(scrollbar_wrapper.clientHeight !== status.scrollbar_height){ status.scrollbar_height = scrollbar_wrapper.clientHeight if(scrollbar_wrapper.clientHeight > 0)