You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: miniOS/miniOS.lua
+70-3Lines changed: 70 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,5 @@
1
1
_G._OSNAME="miniOS classic"
2
-
_G._OSVER="0.6.4.3"
2
+
_G._OSVER="0.6.5"
3
3
_G._OSVERSION=_OSNAME.."" .._OSVER
4
4
_G._OSCREDIT="miniOS classic by Skye, based off of OpenOS code from OpenComputers.\nminiOS code is under BSD 2-clause licence, OpenOS code is under the MIT licence."
5
5
@@ -767,12 +767,15 @@ function terminal_code()
767
767
end
768
768
end
769
769
770
-
functionterm.read(history, dobreak)
770
+
functionterm.read(history, dobreak, hint)
771
771
checkArg(1, history, "table", "nil")
772
+
checkArg(3, hint, "table", "function", "nil")
772
773
history=historyor {}
773
774
table.insert(history, "")
774
775
localoffset=term.getCursor() -1
775
776
localscrollX, scrollY=0, #history-1
777
+
778
+
localhints= { handler=hint }
776
779
777
780
localfunctiongetCursor()
778
781
localcx, cy=term.getCursor()
@@ -783,7 +786,7 @@ function terminal_code()
783
786
localcbx, cby=getCursor()
784
787
returnhistory[cby]
785
788
end
786
-
789
+
787
790
localfunctionsetCursor(nbx, nby)
788
791
localw, h=component.gpu.getResolution()
789
792
localcx, cy=term.getCursor()
@@ -830,6 +833,13 @@ function terminal_code()
830
833
str=text.padRight(str, l)
831
834
component.gpu.set(1+offset, cy, str)
832
835
end
836
+
837
+
localfunctionsetline(to)
838
+
localcbx, cby=getCursor()
839
+
history[cby] =to
840
+
redraw()
841
+
end
842
+
833
843
834
844
localfunctionhome()
835
845
localcbx, cby=getCursor()
@@ -911,8 +921,65 @@ function terminal_code()
911
921
right(len)
912
922
end
913
923
924
+
localfunctiontab()
925
+
ifnothints.handlerthenreturnend
926
+
localmain_kb=term.keyboard()
927
+
-- term may not have a keyboard
928
+
-- in which case, we shouldn't be handling tab events
929
+
ifnotmain_kbthen
930
+
return
931
+
end
932
+
ifnothints.cachethen
933
+
localdata=hints.handler
934
+
hints.handler=function(...)
935
+
iftype(data) =="table" then
936
+
localargs= {...}
937
+
localfiltered= {}
938
+
for_,optioninipairs(data) do
939
+
ifstring.sub(option, 1, #args[1]) ==args[1] then
940
+
filtered[#filtered+1] =option
941
+
--print(option)
942
+
end
943
+
end
944
+
returnfiltered
945
+
else
946
+
returndata(...) or {}
947
+
end
948
+
end
949
+
hints.cache=hints.handler(line(), #line() +1)
950
+
hints.cache.i=-1
951
+
end
952
+
953
+
localcache=hints.cache
954
+
localcache_size=#cache
955
+
956
+
ifcache_size==1andcache.i==0then
957
+
-- there was only one solution, and the user is asking for the next
0 commit comments