Make Multishell Scrollable #408
Conversation
@@ -115,7 +117,15 @@ local function redrawMenu() | |||
parentTerm.setCursorPos( 1, 1 ) | |||
parentTerm.setBackgroundColor( menuOtherBgColor ) | |||
parentTerm.clearLine() | |||
for n=1,#tProcesses do | |||
local nCharcou = 0 |
dan200
Sep 10, 2017
Owner
Change to "nCharCount"
Change to "nCharCount"
@@ -8,6 +8,8 @@ local nCurrentProcess = nil | |||
local nRunningProcess = nil | |||
local bShowMenu = false | |||
local bWindowsResized = false | |||
local nScrollpos = 1 |
dan200
Sep 10, 2017
Owner
Change to "nScrollPos"
Change to "nScrollPos"
if x == 1 and nScrollpos ~= 1 then | ||
nScrollpos = nScrollpos - 1 | ||
redrawMenu() | ||
elseif x == term.getSize() and bScrollRight == true then |
dan200
Sep 10, 2017
Owner
remove "== true"
remove "== true"
Lupus590
Sep 10, 2017
•
Contributor
Thinking optimisation, you may want to change the line to elseif bScrollRight and x == term.getSize() then
. Doing this will mean that if bScrollRight is false then Lua will not bother calling the function to check if x is equal to the size of the terminal.
Thinking optimisation, you may want to change the line to elseif bScrollRight and x == term.getSize() then
. Doing this will mean that if bScrollRight is false then Lua will not bother calling the function to check if x is equal to the size of the terminal.
Please make requested changes, then i'll merge this. |
@dan200 Changes are now done |
Scrolling by scrolling!
Whoops
Update multishell.lua
I added a patch from @BombBloke which allow the scroll with the mousewhell. |
nScrollPos = nScrollPos + 1 | ||
redrawMenu() | ||
end | ||
elseif not (bShowMenu and y == 1) then |
KnightMiner
Sep 11, 2017
I feel like this would be clearer as elseif not bShowMenu or y ~= 1 then
, the and
in a not
is a bit more confusing to read. Arguably you could just move sEvent == "mouse_scroll"
into a separate if
and make this just an else
statement though.
I feel like this would be clearer as elseif not bShowMenu or y ~= 1 then
, the and
in a not
is a bit more confusing to read. Arguably you could just move sEvent == "mouse_scroll"
into a separate if
and make this just an else
statement though.
Just trying this out today and noticed a issue with the scroll offset not changing when tabs are closed:
I think the best thing to do would be to ensure the offset is valid before each menu redraw, clamping it if required. |
@SquidDev Thanks for reporting. The Bug is now fixed. |
Thought I'd commented this a couple of weeks ago but apparently I didn't. Sorry. @Wilma456 The fix works, but I feel it would be nicer closing a tab scrolled the selection to the left again, so that the whole tab list is always full - rather than just having one tab on the far left. |
You can now Scroll through the Programlist, if the list bigger than your Screen.