Skip to content

Commit bf9b54e

Browse files
committed
fix positions
add function to be used in startup.lua (scm:cli(true))
1 parent 9eb145b commit bf9b54e

File tree

1 file changed

+31
-22
lines changed

1 file changed

+31
-22
lines changed

scm.lua

Lines changed: 31 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -842,31 +842,40 @@ function scm:init ()
842842
self:loadScripts()
843843
end
844844

845+
---@param resetPosition boolean | nil
846+
function scm:cli (resetPosition)
847+
if resetPosition ~= nil and resetPosition == true then
848+
term.setCursorPos(1, 7)
849+
end
850+
851+
-- enable autocomplete
852+
self:prepareAutocomplete()
853+
updateAutocomplete()
854+
855+
-- some interface
856+
local _, cursorY = term.getCursorPos()
857+
term.setCursorPos(1, cursorY)
858+
term.blit(" ","ffffffffffffffffffffffffffffffff","44444444444444444444444444444444")
859+
term.setCursorPos(1, cursorY)
860+
term.scroll(1)
861+
term.blit(" SCM - Script Manager ","ffffffffffffffffffffffffffffffff","44444444444444444444444444444444")
862+
term.setCursorPos(1, cursorY)
863+
term.scroll(1)
864+
term.blit(" Autocomplete enabled. ","77777777777777777777777777777777","44444444444444444444444444444444")
865+
term.setCursorPos(1, cursorY)
866+
term.scroll(1)
867+
term.blit(" Type `scm help` to learn more. ","77777777ffffffff7777777777777777","44444444444444444444444444444444")
868+
term.setCursorPos(1, cursorY)
869+
term.scroll(1)
870+
term.blit(" ","ffffffffffffffffffffffffffffffff","44444444444444444444444444444444")
871+
term.setCursorPos(1, cursorY)
872+
term.scroll(2)
873+
end
874+
845875
---@param args table
846876
function scm:handleArguments (args)
847877
if #args == 0 then
848-
-- enable autocomplete
849-
self:prepareAutocomplete()
850-
updateAutocomplete()
851-
852-
-- some interface
853-
local _, cursorY = term.getCursorPos()
854-
term.setCursorPos(0, cursorY)
855-
term.blit(" ","fffffffffffffffffffffffffffffffff","444444444444444444444444444444444")
856-
term.setCursorPos(0, cursorY)
857-
term.scroll(1)
858-
term.blit(" SCM - Script Manager ","fffffffffffffffffffffffffffffffff","444444444444444444444444444444444")
859-
term.setCursorPos(0, cursorY)
860-
term.scroll(1)
861-
term.blit(" Autocomplete enabled. ","777777777777777777777777777777777","444444444444444444444444444444444")
862-
term.setCursorPos(0, cursorY)
863-
term.scroll(1)
864-
term.blit(" Type `scm help` to learn more. ","77777777ffffffff77777777777777777","444444444444444444444444444444444")
865-
term.setCursorPos(0, cursorY)
866-
term.scroll(1)
867-
term.blit(" ","fffffffffffffffffffffffffffffffff","444444444444444444444444444444444")
868-
term.setCursorPos(0, cursorY)
869-
term.scroll(2)
878+
self:cli()
870879
return
871880
end
872881

0 commit comments

Comments
 (0)