added box.lua
This commit is contained in:
parent
a8d346dd70
commit
81c8185df9
15
box.lua
Normal file
15
box.lua
Normal 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
|
30
vite.lua
30
vite.lua
@ -1,15 +1,23 @@
|
||||
--Vi Inspired Textual Editor === VITE
|
||||
-- Version alpha 0.02
|
||||
filename="./dummy.txt"
|
||||
-- Version 0.05
|
||||
-- by: ASCII Benefactor
|
||||
-- April 2022
|
||||
----------------------------------
|
||||
--
|
||||
filename="dummy.txt"
|
||||
VER="v0.05"
|
||||
nc=require("nocurses")
|
||||
dofile("box.lua")
|
||||
|
||||
|
||||
|
||||
-- Small Funcs Start ------------------------------
|
||||
|
||||
function at(s,p)
|
||||
return string.sub(s,p,p)
|
||||
end
|
||||
|
||||
----------------------------end small funcs
|
||||
----------------------------end small funcs ------
|
||||
function start()
|
||||
nc.setunderline(true)
|
||||
print("VITE === Vi Inspired Text Editor === "..VER)
|
||||
@ -72,7 +80,7 @@ function cmd()
|
||||
elseif at(inp,1)=="x" and at(inp,2)=="!" then
|
||||
break
|
||||
elseif at(inp,1)=="?" and #inp==1 then
|
||||
print("Help")
|
||||
print_help()
|
||||
elseif at(inp,1)==":" and at(inp,2)=="q" then
|
||||
break
|
||||
else
|
||||
@ -135,6 +143,20 @@ function display_file() -- Displays file proper
|
||||
print("=================================\n\n")
|
||||
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)
|
||||
currfile:seek("set")
|
||||
|
Loading…
Reference in New Issue
Block a user