added box.lua

This commit is contained in:
asciibene 2022-04-08 18:44:31 -04:00
parent a8d346dd70
commit 81c8185df9
2 changed files with 41 additions and 4 deletions

15
box.lua Normal file
View File

@ -0,0 +1,15 @@
-- various 'UI' functions
-- ::asciibene::
function draw_pane(ttl)
local bxlen=#ttl+4
local bylen=3
for i=1,bylen do
if i==1 or i==3 then
print(string.rep("*",bxlen))
elseif i==2 then
print("*".." "..ttl.." ".."*")
end
end
end

View File

@ -1,15 +1,23 @@
--Vi Inspired Textual Editor === VITE --Vi Inspired Textual Editor === VITE
-- Version alpha 0.02 -- Version 0.05
filename="./dummy.txt" -- by: ASCII Benefactor
-- April 2022
----------------------------------
--
filename="dummy.txt"
VER="v0.05" VER="v0.05"
nc=require("nocurses") nc=require("nocurses")
dofile("box.lua") dofile("box.lua")
-- Small Funcs Start ------------------------------
function at(s,p) function at(s,p)
return string.sub(s,p,p) return string.sub(s,p,p)
end end
----------------------------end small funcs ----------------------------end small funcs ------
function start() function start()
nc.setunderline(true) nc.setunderline(true)
print("VITE === Vi Inspired Text Editor === "..VER) print("VITE === Vi Inspired Text Editor === "..VER)
@ -72,7 +80,7 @@ function cmd()
elseif at(inp,1)=="x" and at(inp,2)=="!" then elseif at(inp,1)=="x" and at(inp,2)=="!" then
break break
elseif at(inp,1)=="?" and #inp==1 then elseif at(inp,1)=="?" and #inp==1 then
print("Help") print_help()
elseif at(inp,1)==":" and at(inp,2)=="q" then elseif at(inp,1)==":" and at(inp,2)=="q" then
break break
else else
@ -135,6 +143,20 @@ function display_file() -- Displays file proper
print("=================================\n\n") print("=================================\n\n")
end end
function print_help()
nc.clrscr()
nc.setfontcolor("GREEN")
print(" VITE commands ")
print("===============")
print("* new file ")
print("> insert line")
print("= Show lines")
print(": main commands")
nc.setfontcolor("WHITE")
end
function display_text() -- prints lines_tbl (bef flush) function display_text() -- prints lines_tbl (bef flush)
currfile:seek("set") currfile:seek("set")