save timestamp on change; show in recent changes
This commit is contained in:
parent
f3dd541561
commit
07bf55b460
17
chesstv.tlv
17
chesstv.tlv
|
@ -1,5 +1,6 @@
|
||||||
teliva_program = {
|
teliva_program = {
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
window = [==[
|
window = [==[
|
||||||
window = curses.stdscr()
|
window = curses.stdscr()
|
||||||
-- animation-based app
|
-- animation-based app
|
||||||
|
@ -7,10 +8,12 @@ window:nodelay(true)
|
||||||
lines, cols = window:getmaxyx()]==],
|
lines, cols = window:getmaxyx()]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
current_game = [==[
|
current_game = [==[
|
||||||
current_game = {}]==],
|
current_game = {}]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
piece_glyph = [==[
|
piece_glyph = [==[
|
||||||
piece_glyph = {
|
piece_glyph = {
|
||||||
-- for legibility, white pieces also use unicode glyphs for black pieces
|
-- for legibility, white pieces also use unicode glyphs for black pieces
|
||||||
|
@ -30,6 +33,7 @@ piece_glyph = {
|
||||||
}]==],
|
}]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
top_player = [==[
|
top_player = [==[
|
||||||
function top_player(current_game)
|
function top_player(current_game)
|
||||||
if current_game.players[1].color == "black" then
|
if current_game.players[1].color == "black" then
|
||||||
|
@ -39,6 +43,7 @@ function top_player(current_game)
|
||||||
end]==],
|
end]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
bottom_player = [==[
|
bottom_player = [==[
|
||||||
function bottom_player(current_game)
|
function bottom_player(current_game)
|
||||||
if current_game.players[1].color == "white" then
|
if current_game.players[1].color == "white" then
|
||||||
|
@ -48,6 +53,7 @@ function bottom_player(current_game)
|
||||||
end]==],
|
end]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
render_player = [==[
|
render_player = [==[
|
||||||
function render_player(y, x, player)
|
function render_player(y, x, player)
|
||||||
curses.mvaddstr(y, x, player.user.name)
|
curses.mvaddstr(y, x, player.user.name)
|
||||||
|
@ -56,6 +62,7 @@ function render_player(y, x, player)
|
||||||
end]==],
|
end]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
render_square = [==[
|
render_square = [==[
|
||||||
function render_square(current_game, rank, file, highlighted_squares)
|
function render_square(current_game, rank, file, highlighted_squares)
|
||||||
-- decide whether to highlight
|
-- decide whether to highlight
|
||||||
|
@ -78,6 +85,7 @@ function render_square(current_game, rank, file, highlighted_squares)
|
||||||
end]==],
|
end]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
render_fen_rank = [==[
|
render_fen_rank = [==[
|
||||||
function render_fen_rank(rank, fen_rank, highlighted_squares)
|
function render_fen_rank(rank, fen_rank, highlighted_squares)
|
||||||
local file = 1
|
local file = 1
|
||||||
|
@ -116,6 +124,7 @@ function render_fen_rank(rank, fen_rank, highlighted_squares)
|
||||||
end]==],
|
end]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
render_time = [==[
|
render_time = [==[
|
||||||
function render_time(y, x, seconds)
|
function render_time(y, x, seconds)
|
||||||
if seconds == nil then return end
|
if seconds == nil then return end
|
||||||
|
@ -124,6 +133,7 @@ function render_time(y, x, seconds)
|
||||||
end]==],
|
end]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
render_board = [==[
|
render_board = [==[
|
||||||
function render_board(current_game)
|
function render_board(current_game)
|
||||||
--? curses.mvaddstr(1, 50, dump(current_game.fen))
|
--? curses.mvaddstr(1, 50, dump(current_game.fen))
|
||||||
|
@ -141,6 +151,7 @@ function render_board(current_game)
|
||||||
end]==],
|
end]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
parse_lm = [==[
|
parse_lm = [==[
|
||||||
function parse_lm(move)
|
function parse_lm(move)
|
||||||
--? curses.mvaddstr(4, 50, move)
|
--? curses.mvaddstr(4, 50, move)
|
||||||
|
@ -153,6 +164,7 @@ function parse_lm(move)
|
||||||
end]==],
|
end]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
render = [==[
|
render = [==[
|
||||||
function render(chunk)
|
function render(chunk)
|
||||||
local o = json.decode(chunk)
|
local o = json.decode(chunk)
|
||||||
|
@ -175,6 +187,7 @@ function render(chunk)
|
||||||
end]==],
|
end]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
init_colors = [==[
|
init_colors = [==[
|
||||||
function init_colors()
|
function init_colors()
|
||||||
-- colors
|
-- colors
|
||||||
|
@ -196,6 +209,7 @@ function init_colors()
|
||||||
end]==],
|
end]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
main = [==[
|
main = [==[
|
||||||
function main()
|
function main()
|
||||||
init_colors()
|
init_colors()
|
||||||
|
@ -214,6 +228,7 @@ function main()
|
||||||
end]==],
|
end]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
utf8 = [==[
|
utf8 = [==[
|
||||||
-- https://stackoverflow.com/questions/7983574/how-to-write-a-unicode-symbol-in-lua
|
-- https://stackoverflow.com/questions/7983574/how-to-write-a-unicode-symbol-in-lua
|
||||||
function utf8(decimal)
|
function utf8(decimal)
|
||||||
|
@ -235,6 +250,7 @@ function utf8(decimal)
|
||||||
end]==],
|
end]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
split = [==[
|
split = [==[
|
||||||
function split(s, pat)
|
function split(s, pat)
|
||||||
result = {}
|
result = {}
|
||||||
|
@ -245,6 +261,7 @@ function split(s, pat)
|
||||||
end]==],
|
end]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
dump = [==[
|
dump = [==[
|
||||||
-- https://stackoverflow.com/questions/9168058/how-to-dump-a-table-to-console
|
-- https://stackoverflow.com/questions/9168058/how-to-dump-a-table-to-console
|
||||||
function dump(o)
|
function dump(o)
|
||||||
|
|
18
counter.tlv
18
counter.tlv
|
@ -1,14 +1,17 @@
|
||||||
teliva_program = {
|
teliva_program = {
|
||||||
{
|
{
|
||||||
window = [==[
|
__teliva_timestamp = [==[original]==],
|
||||||
|
window = [==[
|
||||||
window = curses.stdscr()]==],
|
window = curses.stdscr()]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
n = [==[
|
__teliva_timestamp = [==[original]==],
|
||||||
|
n = [==[
|
||||||
n = 0]==],
|
n = 0]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
render = [==[
|
__teliva_timestamp = [==[original]==],
|
||||||
|
render = [==[
|
||||||
function render(window)
|
function render(window)
|
||||||
window:clear()
|
window:clear()
|
||||||
window:attron(curses.A_BOLD)
|
window:attron(curses.A_BOLD)
|
||||||
|
@ -21,11 +24,13 @@ function render(window)
|
||||||
end]==],
|
end]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
menu = [==[
|
__teliva_timestamp = [==[original]==],
|
||||||
|
menu = [==[
|
||||||
menu = {Enter="increment"}]==],
|
menu = {Enter="increment"}]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
update = [==[
|
__teliva_timestamp = [==[original]==],
|
||||||
|
update = [==[
|
||||||
function update(window)
|
function update(window)
|
||||||
local key = curses.getch()
|
local key = curses.getch()
|
||||||
if key == 10 then
|
if key == 10 then
|
||||||
|
@ -34,7 +39,8 @@ function update(window)
|
||||||
end]==],
|
end]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
main = [==[
|
__teliva_timestamp = [==[original]==],
|
||||||
|
main = [==[
|
||||||
function main()
|
function main()
|
||||||
for i=1,7 do
|
for i=1,7 do
|
||||||
curses.init_pair(i, 0, i)
|
curses.init_pair(i, 0, i)
|
||||||
|
|
12
hanoi.tlv
12
hanoi.tlv
|
@ -1,5 +1,6 @@
|
||||||
teliva_program = {
|
teliva_program = {
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
render = [==[
|
render = [==[
|
||||||
function render(window)
|
function render(window)
|
||||||
window:clear()
|
window:clear()
|
||||||
|
@ -13,6 +14,7 @@ function render(window)
|
||||||
end]==],
|
end]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
lines = [==[
|
lines = [==[
|
||||||
function lines(window)
|
function lines(window)
|
||||||
local lines, cols = window:getmaxyx()
|
local lines, cols = window:getmaxyx()
|
||||||
|
@ -20,16 +22,19 @@ function lines(window)
|
||||||
end]==],
|
end]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
pop = [==[
|
pop = [==[
|
||||||
function pop(array)
|
function pop(array)
|
||||||
return table.remove(array)
|
return table.remove(array)
|
||||||
end]==],
|
end]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
window = [==[
|
window = [==[
|
||||||
window = curses.stdscr()]==],
|
window = curses.stdscr()]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
render_tower = [==[
|
render_tower = [==[
|
||||||
function render_tower(window, line, col, tower_index, tower)
|
function render_tower(window, line, col, tower_index, tower)
|
||||||
window:attron(curses.A_BOLD)
|
window:attron(curses.A_BOLD)
|
||||||
|
@ -51,10 +56,12 @@ function render_tower(window, line, col, tower_index, tower)
|
||||||
end]==],
|
end]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
tower = [==[
|
tower = [==[
|
||||||
tower = {{6, 5, 4, 3, 2}, {}, {}}]==],
|
tower = {{6, 5, 4, 3, 2}, {}, {}}]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
render_disk = [==[
|
render_disk = [==[
|
||||||
function render_disk(window, line, col, size)
|
function render_disk(window, line, col, size)
|
||||||
col = col-size+1
|
col = col-size+1
|
||||||
|
@ -67,6 +74,7 @@ function render_disk(window, line, col, size)
|
||||||
end]==],
|
end]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
main = [==[
|
main = [==[
|
||||||
function main()
|
function main()
|
||||||
for i=1,7 do
|
for i=1,7 do
|
||||||
|
@ -81,6 +89,7 @@ end
|
||||||
]==],
|
]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
len = [==[
|
len = [==[
|
||||||
function len(array)
|
function len(array)
|
||||||
local result = 0
|
local result = 0
|
||||||
|
@ -91,6 +100,7 @@ function len(array)
|
||||||
end]==],
|
end]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
update = [==[
|
update = [==[
|
||||||
function update(window)
|
function update(window)
|
||||||
window:mvaddstr(lines(window)-2, 5, "tower to remove top disk from? ")
|
window:mvaddstr(lines(window)-2, 5, "tower to remove top disk from? ")
|
||||||
|
@ -101,6 +111,7 @@ function update(window)
|
||||||
end]==],
|
end]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
make_move = [==[
|
make_move = [==[
|
||||||
function make_move(from, to)
|
function make_move(from, to)
|
||||||
local disk = pop(tower[from])
|
local disk = pop(tower[from])
|
||||||
|
@ -108,6 +119,7 @@ function make_move(from, to)
|
||||||
end]==],
|
end]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
cols = [==[
|
cols = [==[
|
||||||
function cols(window)
|
function cols(window)
|
||||||
local lines, cols = window:getmaxyx()
|
local lines, cols = window:getmaxyx()
|
||||||
|
|
15
life.tlv
15
life.tlv
|
@ -13,6 +13,7 @@ end
|
||||||
]==],
|
]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
window = [==[
|
window = [==[
|
||||||
window = curses.stdscr()
|
window = curses.stdscr()
|
||||||
-- animation-based app
|
-- animation-based app
|
||||||
|
@ -20,6 +21,7 @@ window:nodelay(true)
|
||||||
lines, cols = window:getmaxyx()]==],
|
lines, cols = window:getmaxyx()]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
grid_char = [==[
|
grid_char = [==[
|
||||||
-- grab a 4x2 chunk of grid
|
-- grab a 4x2 chunk of grid
|
||||||
function grid_char(line, col)
|
function grid_char(line, col)
|
||||||
|
@ -31,6 +33,7 @@ function grid_char(line, col)
|
||||||
end]==],
|
end]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
print_grid_char = [==[
|
print_grid_char = [==[
|
||||||
function print_grid_char(window, x)
|
function print_grid_char(window, x)
|
||||||
result = {}
|
result = {}
|
||||||
|
@ -43,6 +46,7 @@ function print_grid_char(window, x)
|
||||||
end]==],
|
end]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
glyph = [==[
|
glyph = [==[
|
||||||
-- look up the braille pattern corresponding to a 4x2 chunk of grid
|
-- look up the braille pattern corresponding to a 4x2 chunk of grid
|
||||||
-- https://en.wikipedia.org/wiki/Braille_Patterns
|
-- https://en.wikipedia.org/wiki/Braille_Patterns
|
||||||
|
@ -68,6 +72,7 @@ glyph = {
|
||||||
}]==],
|
}]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
utf8 = [==[
|
utf8 = [==[
|
||||||
-- https://stackoverflow.com/questions/7983574/how-to-write-a-unicode-symbol-in-lua
|
-- https://stackoverflow.com/questions/7983574/how-to-write-a-unicode-symbol-in-lua
|
||||||
function utf8(decimal)
|
function utf8(decimal)
|
||||||
|
@ -89,6 +94,7 @@ function utf8(decimal)
|
||||||
end]==],
|
end]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
grid_char_to_glyph_index = [==[
|
grid_char_to_glyph_index = [==[
|
||||||
-- convert a chunk of grid into a number
|
-- convert a chunk of grid into a number
|
||||||
function grid_char_to_glyph_index(g)
|
function grid_char_to_glyph_index(g)
|
||||||
|
@ -98,6 +104,7 @@ function grid_char_to_glyph_index(g)
|
||||||
end]==],
|
end]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
render = [==[
|
render = [==[
|
||||||
function render(window)
|
function render(window)
|
||||||
window:clear()
|
window:clear()
|
||||||
|
@ -111,6 +118,7 @@ end
|
||||||
]==],
|
]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
state = [==[
|
state = [==[
|
||||||
function state(line, col)
|
function state(line, col)
|
||||||
if line < 1 or line > table.getn(grid) or col < 1 or col > table.getn(grid[1]) then
|
if line < 1 or line > table.getn(grid) or col < 1 or col > table.getn(grid[1]) then
|
||||||
|
@ -120,6 +128,7 @@ function state(line, col)
|
||||||
end]==],
|
end]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
num_live_neighbors = [==[
|
num_live_neighbors = [==[
|
||||||
function num_live_neighbors(line, col)
|
function num_live_neighbors(line, col)
|
||||||
return state(line-1, col-1) + state(line-1, col) + state(line-1, col+1) +
|
return state(line-1, col-1) + state(line-1, col) + state(line-1, col+1) +
|
||||||
|
@ -128,6 +137,7 @@ function num_live_neighbors(line, col)
|
||||||
end]==],
|
end]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
step = [==[
|
step = [==[
|
||||||
function step()
|
function step()
|
||||||
local new_grid = {}
|
local new_grid = {}
|
||||||
|
@ -148,6 +158,7 @@ function step()
|
||||||
end]==],
|
end]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
sleep = [==[
|
sleep = [==[
|
||||||
function sleep(a)
|
function sleep(a)
|
||||||
local sec = tonumber(os.clock() + a);
|
local sec = tonumber(os.clock() + a);
|
||||||
|
@ -156,6 +167,7 @@ function sleep(a)
|
||||||
end]==],
|
end]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
file_exists = [==[
|
file_exists = [==[
|
||||||
function file_exists(filename)
|
function file_exists(filename)
|
||||||
local f = io.open(filename, "r")
|
local f = io.open(filename, "r")
|
||||||
|
@ -168,6 +180,7 @@ function file_exists(filename)
|
||||||
end]==],
|
end]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
load_file = [==[
|
load_file = [==[
|
||||||
function load_file(window, filename)
|
function load_file(window, filename)
|
||||||
io.input(filename)
|
io.input(filename)
|
||||||
|
@ -190,6 +203,7 @@ function load_file(window, filename)
|
||||||
end]==],
|
end]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
update = [==[
|
update = [==[
|
||||||
menu = {arrow="pan"}
|
menu = {arrow="pan"}
|
||||||
|
|
||||||
|
@ -230,6 +244,7 @@ function update(window, c)
|
||||||
end]==],
|
end]==],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
__teliva_timestamp = [==[original]==],
|
||||||
main = [==[
|
main = [==[
|
||||||
function main()
|
function main()
|
||||||
for i=1,7 do
|
for i=1,7 do
|
||||||
|
|
22
src/lua.c
22
src/lua.c
|
@ -14,6 +14,7 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <time.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
#define lua_c
|
#define lua_c
|
||||||
|
@ -26,6 +27,9 @@
|
||||||
#include "lualib.h"
|
#include "lualib.h"
|
||||||
|
|
||||||
|
|
||||||
|
#define BG(i) (COLOR_PAIR((i)+8))
|
||||||
|
#define FG(i) (COLOR_PAIR(i))
|
||||||
|
|
||||||
|
|
||||||
static lua_State *globalL = NULL;
|
static lua_State *globalL = NULL;
|
||||||
|
|
||||||
|
@ -407,6 +411,13 @@ static void update_definition (lua_State *L, const char *name, char *new_content
|
||||||
lua_pushstring(L, new_contents);
|
lua_pushstring(L, new_contents);
|
||||||
assert(strlen(name) > 0);
|
assert(strlen(name) > 0);
|
||||||
lua_setfield(L, -2, name);
|
lua_setfield(L, -2, name);
|
||||||
|
/* include timestamp at which binding was created */
|
||||||
|
time_t t;
|
||||||
|
time(&t);
|
||||||
|
char time_string[50] = {0};
|
||||||
|
ctime_r(&t, time_string);
|
||||||
|
lua_pushstring(L, time_string);
|
||||||
|
lua_setfield(L, -2, "__teliva_timestamp");
|
||||||
/* append the new table to the history of mutations */
|
/* append the new table to the history of mutations */
|
||||||
int history_array_size = luaL_getn(L, history_array);
|
int history_array_size = luaL_getn(L, history_array);
|
||||||
++history_array_size;
|
++history_array_size;
|
||||||
|
@ -531,7 +542,16 @@ void render_recent_changes (lua_State *L, int history_array, int start_index, in
|
||||||
int t = lua_gettop(L);
|
int t = lua_gettop(L);
|
||||||
for (lua_pushnil(L); lua_next(L, t) != 0; lua_pop(L, 1)) {
|
for (lua_pushnil(L); lua_next(L, t) != 0; lua_pop(L, 1)) {
|
||||||
const char *definition_name = lua_tostring(L, -2);
|
const char *definition_name = lua_tostring(L, -2);
|
||||||
|
if (is_special_history_key(definition_name)) continue;
|
||||||
addstr(definition_name);
|
addstr(definition_name);
|
||||||
|
/* save timestamp of binding if available */
|
||||||
|
lua_getfield(L, t, "__teliva_timestamp");
|
||||||
|
if (!lua_isnil(L, -1)) {
|
||||||
|
attron(FG(7));
|
||||||
|
printw(" %s", lua_tostring(L, -1));
|
||||||
|
attroff(FG(7));
|
||||||
|
}
|
||||||
|
lua_pop(L, 1);
|
||||||
y++;
|
y++;
|
||||||
const char *definition_contents = lua_tostring(L, -1);
|
const char *definition_contents = lua_tostring(L, -1);
|
||||||
int x = 1;
|
int x = 1;
|
||||||
|
@ -641,8 +661,6 @@ static int is_current_definition(lua_State *L, const char *definition_name, int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#define BG(i) (COLOR_PAIR((i)+8))
|
|
||||||
#define FG(i) (COLOR_PAIR(i))
|
|
||||||
void draw_definition_name (const char *definition_name) {
|
void draw_definition_name (const char *definition_name) {
|
||||||
attron(BG(7));
|
attron(BG(7));
|
||||||
addstr(definition_name);
|
addstr(definition_name);
|
||||||
|
|
Loading…
Reference in New Issue