Added cursor movement to prevent needless blank rows

This commit is contained in:
sloumdrone 2019-01-13 14:57:15 -08:00
parent 9e20427b43
commit 649b170291
1 changed files with 18 additions and 0 deletions

18
stubb
View File

@ -154,6 +154,21 @@ function go_to_url(u, add2history, noprint)
end
function handle_response(res_table, gtype)
local out = ''
if gtype == '0' or gtype == 0 then
out = table.concat(res_table, '\n')
else
session.tabs[session.current_tab].current_links = {}
for i, v in ipairs(res_table) do
out = out .. (display_gophermap_row(v) or '').. '\n'
end
end
return out
end
function display_gophermap_row(row)
local t = session.tabs[session.current_tab]
local val = string.split(row, '\t')
@ -206,6 +221,9 @@ function mainloop()
local bar = string.format('\27[7m o--[ S t u b b ]--> (H)elp, (Q)uit TAB:%d/%d HST: %d/%d \27[0m', session.current_tab, #session.tabs,th.loc, #th.items)
print(bar)
local key = getch()
io.write(string.char(27) .. "[100D")
io.write(string.char(27) .. "[1A")
io.write(string.char(27) .. "[K")
if key == 'q' then save_favorites(); os.exit(0)
elseif key == 'h' then print_help()
elseif key == 's' then search()