diff --git a/box.lua b/box.lua new file mode 100644 index 0000000..a38d0d3 --- /dev/null +++ b/box.lua @@ -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 diff --git a/vite.lua b/vite.lua index cbfab07..f63591e 100644 --- a/vite.lua +++ b/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")