Advertisement
john9912

LightText

Dec 8th, 2016
601
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 19.45 KB | None | 0 0
  1. term.setBackgroundColor(colors.black)
  2. term.clear()
  3. local codeColorIn, handleMovementKeys, handleMouseMenu, handleScreen, handleTimer, handleDelete, handleEnter, handleChar, handleBackspace, handleMouse, save, import
  4. local text = {} -- text
  5. local lastText = {}
  6. local args = {...}
  7. local e = {} -- event data
  8. local textmt = {__index = function() return "" end} -- for new lines
  9. setmetatable(text,textmt)
  10. local MaxX,MaxY = term.getSize()
  11. local fancy = false
  12. local fileName = args[1]
  13. function import(file) -- import or open
  14.    for i=1,#text do
  15.       text[i] = nil
  16.       lastText[i] = nil
  17.    end
  18.    local doc = ""
  19.     if fs.exists(file) then
  20.       doc = fs.open(file,"r")
  21.    else
  22.       return false
  23.    end
  24.     for i = 1,16384 do
  25.         text[i] = doc.readLine()
  26.         if text[i] == nil then break end
  27.     end
  28.    doc.close()
  29.     return true
  30. end
  31. if fileName then
  32.    import(fileName)
  33. end
  34. if not fileName then fileName = "NONAME" end
  35. function save(file) -- what could it mean?
  36.     file = fs.open(file,"w")
  37.     for i=1,(#text)+1 do
  38.         file.writeLine(text[i])
  39.     end
  40.    file.close()
  41. end
  42. local settings = {}
  43. if fs.exists("LightTextSettings") then
  44.    local settingsFile = fs.open("LightTextSettings","r")
  45.    settings = textutils.unserialize(settingsFile.readAll())
  46.    settingsFile.close()
  47. else
  48.    settings.cursorString = "\149"
  49.    settings.cursorColor = 2048
  50.    settings.tabSize = 3
  51.    local settingsFile = fs.open("LightTextSettings","w")
  52.    settingsFile.writeLine(textutils.serialize(settings))
  53.    settingsFile.close()
  54. end
  55. local cursorString = settings.cursorString
  56. local tabSize = settings.tabSize
  57. local KEYWORD = {
  58.    ["if"] = colors.yellow,
  59.    ["then"] = colors.yellow,
  60.    ["else"] = colors.yellow,
  61.    ["elseif"] = colors.yellow,
  62.    ["for"] = colors.yellow,
  63.    ["while"] = colors.yellow,
  64.    ["do"] = colors.yellow,
  65.    ["repeat"] = colors.yellow,
  66.    ["return"] = colors.yellow,
  67.    ["until"] = colors.yellow,
  68.    ["end"] = colors.yellow,
  69.    ["function"] = colors.lime,
  70.    ["local"] = colors.yellow,
  71.    ["break"] = colors.yellow,
  72.    ["and"] = colors.blue,
  73.    ["or"] = colors.blue,
  74.    ["not"] = colors.blue,
  75.    ["true"] = colors.blue,
  76.    ["false"] = colors.blue,
  77.    ["nil"] = colors.blue,
  78.    ["in"] = colors.yellow,
  79.    ["term"] = colors.orange,
  80.    ["os"] = colors.orange,
  81.    ["math"] = colors.orange,
  82.    ["fs"] = colors.orange,
  83.    ["io"] = colors.orange,
  84.    ["string"] = colors.orange,
  85.    ["sleep"] = colors.orange,
  86.    ["print"] = colors.orange,
  87.    ["write"] = colors.orange,
  88.    ["shell"] = colors.orange,
  89.    ["tostring"] = colors.orange,
  90.    ["tonumber"] = colors.orange,
  91.    ["setmetatable"] = colors.orange,
  92.    ["getmetatable"] = colors.orange,
  93.    ["..."] = colors.lightBlue, -- Not working properly
  94.    [".."] = colors.brown,      -- Not working properly
  95.    ["___LightTextCommentColor"] = colors.lightGray,
  96.    ["___LightTextStringColor"] = colors.cyan         -- NYI
  97. }
  98. local SYNTAX = {
  99.    ["."] = colors.green,
  100.    [":"] = colors.green,
  101.    [","] = colors.red,
  102.    ["<"] = colors.lightBlue,
  103.    [">"] = colors.lightBlue,
  104.    ["="] = colors.lightBlue,
  105.    ["+"] = colors.lightBlue,
  106.    ["-"] = colors.lightBlue,
  107.    ["/"] = colors.lightBlue,
  108.    ["*"] = colors.lightBlue,
  109.    ["^"] = colors.lightBlue,
  110.    ["("] = colors.lime,
  111.    [")"] = colors.lime,
  112.    ["["] = colors.green,
  113.    ["]"] = colors.green,
  114.    ["{"] = colors.green,
  115.    ["}"] = colors.green,
  116.    ["'"] = colors.red,
  117.    ["\""] = colors.red,
  118.    ["#"] = colors.red
  119. }
  120. -- some variables
  121. local menu = false
  122. local codeMode = true
  123. local DefaultBackgroundColor = colors.black
  124. local DefaultTextColor = colors.white
  125. local screen = {minX = 1,minY = 1,maxX = 51,maxY = 19}
  126. local cursor = {x = 1,y = 1}
  127. local cursorTimer = os.startTimer(0.3)
  128. local isOnScreenCursor = false
  129. -- modular functions for event handling
  130. function handleMouseMenu()
  131.    if e[4] == 3 and e[3] > 14 and e[3] < 18 then
  132.       if codeMode then
  133.          codeMode = false
  134.       else
  135.          codeMode = true
  136.       end
  137.    elseif e[4] == 8 and e[3] < 7 then
  138.       save("TEMP")
  139.       term.setCursorPos(1,1)
  140.       term.setBackgroundColor(colors.black)
  141.       term.setTextColor(colors.white)
  142.       term.clear()
  143.       error("",999)
  144.    elseif e[4] == 5 and e[3] < 7 then
  145.       save(fileName)
  146.    elseif e[4] == 6 and e[3] < (11+#fileName) then
  147.       local tempName = "]"
  148.       while true do
  149.       term.setCursorPos(1,6)
  150.       term.clearLine()
  151.       write("[Save as:"..tempName)
  152.          e = {os.pullEvent()}
  153.          if e[1] == "key" and e[2] == keys.enter then
  154.             if #tempName < 2 then
  155.                break
  156.             else
  157.                fileName = tempName:sub(1,#tempName-1)
  158.                save(fileName)
  159.                break
  160.             end
  161.          elseif e[1] == "key" and e[2] == keys.backspace and #tempName > 1 then
  162.             tempName = tempName:sub(1,#tempName-2).."]"
  163.          elseif e[1] == "char" then
  164.             tempName = tempName:sub(1,#tempName-1)..e[2].."]"
  165.          end
  166.       end
  167.    elseif e[4] == 7 and e[3] < 8 then
  168.       local tempName = "] "
  169.       while true do
  170.          term.setCursorPos(1,7)
  171.          write("[Open:"..tempName)
  172.          e = {os.pullEvent()}
  173.          if e[1] == "key" and e[2] == keys.enter then
  174.             if #tempName < 3 then
  175.                break
  176.             else
  177.                fileName = tempName:sub(1,#tempName-1)
  178.                import(fileName)
  179.                break
  180.             end
  181.          elseif e[1] == "key" and e[2] == keys.backspace and #tempName > 2 then
  182.             tempName = tempName:sub(1,#tempName-3).."] "
  183.          elseif e[1] == "char" then
  184.             tempName = tempName:sub(1,#tempName-2)..e[2].."] "
  185.          end
  186.       end
  187.    end
  188. end
  189. function handleEnter()
  190.    local lastLine = cursor.y
  191.    if text[cursor.y+1] then
  192.       for i=#text+1,cursor.y+1,-1 do --if there are lines below cursor.y
  193.          text[i] = text[i-1] -- copy every line to one below (reverse order)
  194.       end
  195.    end
  196.    text[cursor.y+1] = ""
  197.    if cursor.x <= #text[cursor.y] then
  198.       text[cursor.y+1] = text[cursor.y]:sub(cursor.x,#text[cursor.y]) -- copy text from cursor.x to end of line to next line
  199.    end
  200.    cursor.y = cursor.y + 1
  201.    if cursor.y > screen.maxY then
  202.       screen.maxY = screen.maxY + 1
  203.       screen.minY = screen.minY + 1
  204.       term.clear()
  205.    end
  206.    screen.maxX = MaxX
  207.    screen.minX = 1
  208.    cursor.x = 1
  209.    if not menu then
  210.       term.setTextColor(DefaultTextColor)
  211.       term.setBackgroundColor(DefaultBackgroundColor)
  212.       if codeMode then
  213.          term.setCursorPos(1,lastLine+1-screen.minY)
  214.          term.setTextColor(DefaultTextColor)
  215.          term.clearLine()
  216.          write(text[lastLine]:sub(screen.minX,screen.maxX))
  217.          codeColorIn(lastLine+1-screen.minY)
  218.       else
  219.          term.setCursorPos(1,lastLine+1-screen.minY)
  220.          term.setTextColor(DefaultTextColor)
  221.          term.clearLine()
  222.          write(text[lastLine]:sub(screen.minX,screen.maxX))
  223.       end
  224.    end
  225. end
  226. function handleChar()
  227.    text[cursor.y] = text[cursor.y]:sub(1,cursor.x-1)..e[2]..text[cursor.y]:sub(cursor.x,#text[cursor.y]) --put char at x,y
  228.    cursor.x = cursor.x + 1
  229.    if cursor.y-1+screen.minY == MaxY and cursor.x-1+screen.minX > MaxX-11 then
  230.       screen.maxX = screen.maxX + 1
  231.       screen.minX = screen.minX + 1
  232.    elseif cursor.x > screen.maxX then
  233.       screen.maxX = screen.maxX + 1
  234.       screen.minX = screen.minX + 1
  235.    end
  236. end
  237. function handleMouse()
  238.    if e[1] == "mouse_click" or e[1] == "mouse_drag" then
  239.       if #text > e[4]-2+screen.minY then
  240.          cursor.y = e[4]-1+screen.minY
  241.          if #text[e[4]-1+screen.minY] > e[3] - 2 then
  242.             cursor.x = e[3]-1+screen.minX
  243.          else
  244.             cursor.x = #text[e[4]-1+screen.minY]+1
  245.          end
  246.       else
  247.          cursor.y = #text
  248.       end
  249.    elseif e[1] == "mouse_scroll" then
  250.       if e[2] == 1 then
  251.          if #text > screen.minY then
  252.             screen.minY = screen.minY + 1
  253.             screen.maxY = screen.maxY + 1
  254.             if cursor.y < screen.minY then
  255.                cursor.y = cursor.y + 1
  256.                if cursor.x > #text[cursor.y] then
  257.                   cursor.x = #text[cursor.y]+1
  258.                end
  259.             end
  260.          end
  261.       elseif e[2] == -1 then
  262.          if screen.minY > 1 then
  263.             screen.maxY = screen.maxY - 1
  264.             screen.minY = screen.minY - 1
  265.             if cursor.y > screen.maxY then
  266.                cursor.y = cursor.y -1
  267.                if #text[cursor.y] < cursor.x then
  268.                   cursor.x = #text[cursor.y]+1
  269.                end
  270.             end
  271.          end
  272.       end
  273.    end
  274. end
  275. function handleMovementKeys()
  276.    if e[2] == keys.up then -- 1 of 4 movement keys
  277.       if cursor.y > 1 then -- is cursor further down than line 1
  278.          cursor.y = cursor.y - 1
  279.          if text[cursor.y]:sub(cursor.x-1,cursor.x-1) == "" then -- is line above (current) as long as cursor.x
  280.             cursor.x = #text[cursor.y]+1 -- place cursor at end of line (default is same x as before)
  281.          end
  282.       elseif cursor.x > 1 then -- if on first line
  283.          cursor.x = 1
  284.       end
  285.    elseif e[2] == keys.down then -- similar to keys.up
  286.       if #text > cursor.y then
  287.          cursor.y = cursor.y + 1
  288.          if #text[cursor.y] < cursor.x then
  289.             cursor.x = #text[cursor.y]+1
  290.          end
  291.       else
  292.           cursor.x = #text[cursor.y]+1
  293.       end
  294.    elseif e[2] == keys.left then
  295.       if cursor.x > 1 then -- is cursor farther right than x = 1
  296.          cursor.x = cursor.x - 1
  297.       elseif cursor.y > 1 then --does the line above exist?
  298.          cursor.y = cursor.y - 1
  299.          cursor.x = #text[cursor.y]+1
  300.       end
  301.    elseif e[2] == keys.right then
  302.       if #text[cursor.y] >= cursor.x then
  303.          cursor.x = cursor.x + 1
  304.       elseif #text > cursor.y then
  305.          cursor.y = cursor.y + 1
  306.          cursor.x = 1
  307.       end
  308.    elseif e[2] == keys.home then
  309.       cursor.x = 1
  310.    elseif e[2] == keys["end"] then
  311.       cursor.x = #text[cursor.y]+1
  312.    elseif e[2] == keys.pageUp then
  313.       if text[cursor.y-MaxY+1] then
  314.          cursor.y = cursor.y-MaxY+1
  315.          if text[cursor.y]:sub(cursor.x-1,cursor.x-1) == "" then
  316.             cursor.x = #text[cursor.y]
  317.          end
  318.       elseif cursor.y > 1 then
  319.          cursor.y = 1
  320.          if text[cursor.y]:sub(cursor.x-1,cursor.x-1) == "" then
  321.             cursor.x = #text[cursor.y]
  322.          end
  323.       end
  324.    end
  325.    if cursor.x == 0 then
  326.       cursor.x = 1
  327.    end
  328. end
  329. function handleBackspace()
  330.    if cursor.x > 1 then --is cursor in text
  331.       text[cursor.y] = text[cursor.y]:sub(1,cursor.x-2)..text[cursor.y]:sub(cursor.x,#text[cursor.y]) --remove char in text
  332.       cursor.x = cursor.x - 1
  333.    elseif cursor.x == 1 and cursor.y > 1 then -- is cursor at start of line and not at line 1
  334.       cursor.x = #text[cursor.y-1]+1 -- get length of above line
  335.       text[cursor.y-1] = text[cursor.y-1]..text[cursor.y] -- copy line to line above
  336.       text[cursor.y] = text[cursor.y+1]
  337.       if text[cursor.y+2] then -- move all lines below one step up
  338.          for i=cursor.y+1,#text-1 do -- from cursor.y to end of file
  339.             text[i] = text[i+1] -- copy line below i to i
  340.          end
  341.          text[#text] = nil -- delete last line (copied)
  342.       end
  343.       cursor.y = cursor.y-1 -- move cursor up
  344.    end
  345. end
  346. function handleDelete()
  347.    if text[cursor.y]:sub(cursor.x,cursor.x) ~= "" then
  348.       text[cursor.y] = text[cursor.y]:sub(1,cursor.x-1)..text[cursor.y]:sub(cursor.x+1,#text[cursor.y])
  349.    elseif cursor.x > #text[cursor.y] and text[cursor.y+1] then
  350.       text[cursor.y] = text[cursor.y]..text[cursor.y+1]
  351.       for i=cursor.y+1,#text do -- from cursor.y to end of file
  352.          text[i]=text[i+1] -- copy line below i to i
  353.       end
  354.       text[#text] = nil -- delete last line (copied)
  355.    end
  356. end
  357. function handleTimer()
  358.    if isOnScreenCursor then
  359.       isOnScreenCursor = false
  360.       if text[cursor.y]:sub(cursor.x,cursor.x) ~= "" then
  361.          cursorString = text[cursor.y]:sub(cursor.x,cursor.x)
  362.       else
  363.          cursorString = " "
  364.       end
  365.       cursorColor = DefaultTextColor
  366.    else
  367.       isOnScreenCursor = true
  368.       cursorString = settings.cursorString
  369.       settings.cursorColor = colors.blue
  370.    end
  371.    cursorTimer = os.startTimer(0.05)
  372. end
  373. function handleScreen()
  374.    while cursor.x < screen.minX do
  375.       screen.minX = screen.minX - 1
  376.       screen.maxX = screen.maxX - 1
  377.    end
  378.    while cursor.x > screen.maxX do
  379.       screen.maxX = screen.maxX + 1
  380.       screen.minX = screen.minX + 1
  381.    end
  382.    while cursor.y < screen.minY do
  383.       screen.minY = screen.minY - 1
  384.       screen.maxY = screen.maxY - 1
  385.    end
  386.    while cursor.y > screen.maxY do
  387.       screen.maxY = screen.maxY + 1
  388.       screen.minY = screen.minY + 1
  389.    end
  390.    while cursor.x-screen.minX+1 > MaxX-9 and cursor.y == screen.maxY do
  391.       screen.minX = screen.minX + 1
  392.       screen.maxX = screen.maxX + 1
  393.    end
  394.    if screen.minX < 1 or screen.minY < 1 then -- baaaad program! >=c      How doe? idk.
  395.       term.clear()
  396.       term.setCursorPos(1,1)
  397.       write("ERROR: screen params incorrect\nPlease report this error.\nWait 10 seconds\n"..textutils.serialize(screen)..textutils.serialize(cursor))
  398.       sleep(10)
  399.       screen.minX = 1
  400.       screen.minY = 1
  401.       screen.maxX = MaxX
  402.       screen.maxY = MaxY
  403.    end
  404. end
  405. local allowedAdj = {
  406.    [""] = true,
  407.    [" "] = true,
  408.    ["."] = true,
  409.    [":"] = true,
  410.    ["("] = true,
  411.    ["["] = true,
  412.    ["{"] = true,
  413.    ["="] = true,
  414.    ["<"] = true,
  415.    [">"] = true,
  416.    ["*"] = true,
  417.    ["/"] = true,
  418.    ["+"] = true,
  419.    ["-"] = true
  420. }
  421. function codeColorIn(n)
  422.    if #text[n-1+screen.minY] > 0 then
  423.       for i=1,#text[n-1+screen.minY] do
  424.          --[[if text[n]:sub(i,i) == "'" then
  425.             term.setCursorPos(i+1-screen.minX,n+1-screen.minY)
  426.             term.setTextColor(KEYWORD.___LightTextStringColor)
  427.             local endstring = i + 1
  428.             local startstring = i
  429.             while i <= #text[n] do
  430.                if text[n]:sub(i,i) == "'" then
  431.                   endstring = endstring + 1
  432.                   break
  433.                end
  434.                i = i + 1
  435.                endstring = i
  436.                
  437.             end
  438.             term.setCursorPos(startstring+1-screen.minX,n+1-screen.minY)
  439.             write(text[n]:sub(startstring,endstring))
  440.  
  441.          end]] --NYI
  442.  
  443.          for k,v in pairs(SYNTAX) do
  444.             if text[n-1+screen.minY]:sub(i,i) == k then
  445.                term.setCursorPos(i+1-screen.minX,n)
  446.                term.setTextColor(v)
  447.                write(k)
  448.             end
  449.          end
  450.          for k,v in pairs(KEYWORD) do
  451.             if allowedAdj[text[n-1+screen.minY]:sub(i-1,i-1)] and allowedAdj[text[n-1+screen.minY]:sub(i+#k,i+#k)] and text[n-1+screen.minY]:sub(i,i+#k-1) == k then
  452.                term.setCursorPos(i+1-screen.minX,n)
  453.                term.setTextColor(v)
  454.                write(k:sub(1,math.min(#k+1,MaxX-i)))
  455.                i = i+#k
  456.             end
  457.          end
  458.          if text[n-1+screen.minY]:sub(i,i+1) == "--" then
  459.             term.setTextColor(KEYWORD["___LightTextCommentColor"])
  460.             term.setCursorPos(i+1-screen.minX,n)
  461.             write(text[n-1+screen.minY]:sub(i,math.min(MaxX,#text[n-1+screen.minY]+screen.minX-1)))
  462.             break
  463.          end
  464.       end
  465.    end
  466. end
  467. while true do -- main loop
  468.    local lastLine = cursor.y
  469.    if not menu then
  470.       term.setCursorPos(1,cursor.y+1-screen.minY)
  471.       term.setTextColor(DefaultTextColor)
  472.       term.clearLine()
  473.       write(text[cursor.y]:sub(screen.minX,screen.maxX))
  474.       codeColorIn(cursor.y+1-screen.minY)
  475.       term.setTextColor(colors.gray)
  476.       term.setCursorPos(MaxX-9,MaxY)
  477.       write("Press ctrl")
  478.    end
  479.    if not menu and isOnScreenCursor then
  480.       term.setCursorPos(cursor.x+1-screen.minX,cursor.y+1-screen.minY)
  481.       if #cursorString ~= 1 then cursorString = " " end
  482.       term.setBackgroundColor(DefaultBackgroundColor)
  483.       term.setTextColor(settings.cursorColor)
  484.       write(cursorString)
  485.     end
  486.  
  487.  
  488.    e = {os.pullEventRaw()}
  489.    if e[1] == "term_resize" then
  490.         MaxX,MaxY = term.getSize()
  491.  
  492.     elseif e[1] == "terminate" then
  493.         save("TEMP")
  494.       term.setCursorPos(1,1)
  495.       term.setBackgroundColor(colors.black)
  496.       term.setTextColor(colors.white)
  497.       term.clear()
  498.       error("",999)
  499.    
  500.    elseif e[1] == "timer" and not menu then
  501.       handleTimer()
  502.    
  503.    elseif e[1] == "char" and not menu then
  504.       handleChar()
  505.    
  506.    elseif e[1] == "mouse_click" or e[1] == "mouse_scroll" or e[1] == "mouse_drag" then
  507.     if not menu then
  508.          handleMouse()
  509.       elseif e[1] == "mouse_click" then
  510.          handleMouseMenu()
  511.       end
  512.    
  513.    elseif e[1] == "key" then
  514.     if not menu and e[2] == keys.up or e[2] == keys.down or e[2] == keys.left or e[2] == keys.right or e[2] == keys.pgUp or e[2] == keys.pgDn or e[2] == keys.home or e[2] == keys["end"] then
  515.          handleMovementKeys()
  516.       elseif not menu and e[2] == keys.enter then
  517.         handleEnter()
  518.       elseif not menu and e[2] == keys.backspace then
  519.         handleBackspace()
  520.       elseif not menu and e[2] == keys.delete then
  521.         handleDelete()
  522.       elseif not menu and e[2] == keys.f1 then
  523.         save(fileName)
  524.       elseif not menu and e[2] == keys.tab then
  525.         text[cursor.y] = text[cursor.y]:sub(1,cursor.x-1)..string.rep(" ",tabSize)..text[cursor.x]:sub(cursor.x,#text[cursor.y]) --put char at x,y
  526.          cursor.x = cursor.x + tabSize
  527.       elseif e[2] == keys.rightCtrl then
  528.          if menu then
  529.             menu = false
  530.             term.setBackgroundColor(colors.black)
  531.             term.clear()
  532.             cursorTimer = os.startTimer(0.3)
  533.             if lastText and #lastText > 0 then
  534.                for i = 1,16384 do
  535.                   lastText[i] = nil
  536.                end
  537.             end
  538.          else
  539.             menu = true
  540.             term.clear()
  541.          end
  542.       end
  543.    
  544.    elseif e[1] == "something else idk" then
  545.    
  546.    end
  547.    handleScreen()
  548.    if not menu then
  549.       term.setTextColor(DefaultTextColor)
  550.       term.setBackgroundColor(DefaultBackgroundColor)
  551.       for i=1,MaxY do
  552.          if lastText[i-1+screen.minY] ~= text[i-1+screen.minY] or i == lastLine+1-screen.minY or e[1] == "mouse_scroll" or e[2] == keys.up or e[2] == keys.down or e[2] == keys.enter then
  553.             term.setCursorPos(1,i)
  554.             term.setTextColor(DefaultTextColor)
  555.             term.clearLine()
  556.             write(text[i-1+screen.minY]:sub(screen.minX,screen.maxX))
  557.             if codeMode then
  558.                codeColorIn(i)
  559.             end
  560.           end
  561.          lastText[i-1+screen.minY] = text[i-1+screen.minY]
  562.       end
  563.       term.setBackgroundColor(DefaultBackgroundColor)
  564.       term.setCursorPos(MaxX-9,MaxY)
  565.       term.setTextColor(colors.gray)
  566.       write("Press ctrl")
  567.       term.setTextColor(DefaultTextColor)
  568.    elseif menu then
  569.       term.setBackgroundColor(colors.gray)
  570.       term.setTextColor(colors.blue)
  571.       term.clear()
  572.       term.setCursorPos(math.max(1,math.floor(MaxX/2-(#fileName/2)-5)),1)
  573.       write(string.sub("LightText "..fileName,1,MaxX))
  574.       term.setCursorPos(1,3)
  575.       write("Code Mode:")
  576.       term.setCursorPos(15,3)
  577.       if codeMode then
  578.          term.blit(" X","8f","85")
  579.       else
  580.          term.blit("X ","f8","e8")
  581.       end
  582.       term.setCursorPos(1,8)
  583.       write("[Exit]")
  584.       term.setCursorPos(1,5)
  585.       write("[Save]        Press f1")
  586.       term.setCursorPos(1,6)
  587.       write("[Save as:"..fileName.."]")
  588.       term.setCursorPos(1,7)
  589.       write("[Open:]")
  590.       term.setCursorPos(MaxX-9,MaxY)
  591.       write("Press ctrl")
  592.    end
  593. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement