distinguish between window global and arg
This commit is contained in:
parent
afb3f46db7
commit
68d956e31a
10
anagrams.tlv
10
anagrams.tlv
|
@ -80,7 +80,7 @@
|
||||||
check_eq:
|
check_eq:
|
||||||
>function check_eq(x, expected, msg)
|
>function check_eq(x, expected, msg)
|
||||||
> if eq(x, expected) then
|
> if eq(x, expected) then
|
||||||
> window:addch('.')
|
> Window:addch('.')
|
||||||
> else
|
> else
|
||||||
> print('F - '..msg)
|
> print('F - '..msg)
|
||||||
> print(' expected '..str(expected)..' but got '..str(x))
|
> print(' expected '..str(expected)..' but got '..str(x))
|
||||||
|
@ -207,8 +207,8 @@
|
||||||
> end
|
> end
|
||||||
>end
|
>end
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
window:
|
Window:
|
||||||
>window = curses.stdscr()
|
>Window = curses.stdscr()
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
doc:blurb:
|
doc:blurb:
|
||||||
>Show all anagrams of a given word
|
>Show all anagrams of a given word
|
||||||
|
@ -229,8 +229,8 @@
|
||||||
main:
|
main:
|
||||||
>function main()
|
>function main()
|
||||||
> while true do
|
> while true do
|
||||||
> render(window)
|
> render(Window)
|
||||||
> update(window)
|
> update(Window)
|
||||||
> end
|
> end
|
||||||
>end
|
>end
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
|
|
66
chesstv.tlv
66
chesstv.tlv
|
@ -17,11 +17,11 @@
|
||||||
# If these constraints are violated, Teliva may unceremoniously crash. Please
|
# If these constraints are violated, Teliva may unceremoniously crash. Please
|
||||||
# report bugs at http://akkartik.name/contact
|
# report bugs at http://akkartik.name/contact
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
window:
|
Window:
|
||||||
>window = curses.stdscr()
|
>Window = curses.stdscr()
|
||||||
>-- animation-based app
|
>-- animation-based app
|
||||||
>window:nodelay(true)
|
>Window:nodelay(true)
|
||||||
>lines, cols = window:getmaxyx()
|
>lines, cols = Window:getmaxyx()
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
current_game:
|
current_game:
|
||||||
>current_game = {}
|
>current_game = {}
|
||||||
|
@ -62,9 +62,9 @@
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
render_player:
|
render_player:
|
||||||
>function render_player(y, x, player)
|
>function render_player(y, x, player)
|
||||||
> window:mvaddstr(y, x, player.user.name)
|
> Window:mvaddstr(y, x, player.user.name)
|
||||||
> window:addstr(" · ")
|
> Window:addstr(" · ")
|
||||||
> window:addstr(tostring(player.rating))
|
> Window:addstr(tostring(player.rating))
|
||||||
>end
|
>end
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
render_square:
|
render_square:
|
||||||
|
@ -77,15 +77,15 @@
|
||||||
> end
|
> end
|
||||||
> if (rank+file)%2 == 1 then
|
> if (rank+file)%2 == 1 then
|
||||||
> -- light square
|
> -- light square
|
||||||
> window:attrset(curses.color_pair(1+hl))
|
> Window:attrset(curses.color_pair(1+hl))
|
||||||
> else
|
> else
|
||||||
> -- dark square
|
> -- dark square
|
||||||
> window:attrset(curses.color_pair(3+hl))
|
> Window:attrset(curses.color_pair(3+hl))
|
||||||
> end
|
> end
|
||||||
> window:mvaddstr((8 - rank + 1)*3, file*5, " ")
|
> Window:mvaddstr((8 - rank + 1)*3, file*5, " ")
|
||||||
> window:mvaddstr((8 - rank + 1)*3+1, file*5, " ")
|
> Window:mvaddstr((8 - rank + 1)*3+1, file*5, " ")
|
||||||
> window:mvaddstr((8 - rank + 1)*3+2, file*5, " ")
|
> Window:mvaddstr((8 - rank + 1)*3+2, file*5, " ")
|
||||||
> window:attrset(curses.A_NORMAL)
|
> Window:attrset(curses.A_NORMAL)
|
||||||
>end
|
>end
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
render_fen_rank:
|
render_fen_rank:
|
||||||
|
@ -104,22 +104,22 @@
|
||||||
> if (rank+file)%2 == 1 then
|
> if (rank+file)%2 == 1 then
|
||||||
> if x < 'Z' then
|
> if x < 'Z' then
|
||||||
> -- white piece on light square
|
> -- white piece on light square
|
||||||
> window:attrset(curses.color_pair(1+hl))
|
> Window:attrset(curses.color_pair(1+hl))
|
||||||
> else
|
> else
|
||||||
> -- black piece on light square
|
> -- black piece on light square
|
||||||
> window:attrset(curses.color_pair(2+hl))
|
> Window:attrset(curses.color_pair(2+hl))
|
||||||
> end
|
> end
|
||||||
> else
|
> else
|
||||||
> if x < 'Z' then
|
> if x < 'Z' then
|
||||||
> -- white piece on dark square
|
> -- white piece on dark square
|
||||||
> window:attrset(curses.color_pair(3+hl))
|
> Window:attrset(curses.color_pair(3+hl))
|
||||||
> else
|
> else
|
||||||
> -- black piece on dark square
|
> -- black piece on dark square
|
||||||
> window:attrset(curses.color_pair(4+hl))
|
> Window:attrset(curses.color_pair(4+hl))
|
||||||
> end
|
> end
|
||||||
> end
|
> end
|
||||||
> window:mvaddstr((8 - rank + 1)*3+1, file*5+2, utf8(piece_glyph[x]))
|
> Window:mvaddstr((8 - rank + 1)*3+1, file*5+2, utf8(piece_glyph[x]))
|
||||||
> window:attrset(curses.A_NORMAL)
|
> Window:attrset(curses.A_NORMAL)
|
||||||
> file = file + 1
|
> file = file + 1
|
||||||
> end
|
> end
|
||||||
> end
|
> end
|
||||||
|
@ -128,14 +128,14 @@
|
||||||
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
|
||||||
> window:mvaddstr(y, x, tostring(math.floor(seconds/60)))
|
> Window:mvaddstr(y, x, tostring(math.floor(seconds/60)))
|
||||||
> window:addstr(string.format(":%02d", seconds%60))
|
> Window:addstr(string.format(":%02d", seconds%60))
|
||||||
>end
|
>end
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
render_board:
|
render_board:
|
||||||
>function render_board(current_game)
|
>function render_board(current_game)
|
||||||
>--? window:mvaddstr(1, 50, dump(current_game.fen))
|
>--? Window:mvaddstr(1, 50, dump(current_game.fen))
|
||||||
>--? window:mvaddstr(6, 50, dump(current_game.previously_moved_squares))
|
>--? Window:mvaddstr(6, 50, dump(current_game.previously_moved_squares))
|
||||||
> render_player(2, 5, top_player(current_game))
|
> render_player(2, 5, top_player(current_game))
|
||||||
> render_time(2, 35, current_game.bc)
|
> render_time(2, 35, current_game.bc)
|
||||||
> for rank=8,1,-1 do
|
> for rank=8,1,-1 do
|
||||||
|
@ -150,12 +150,12 @@
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
parse_lm:
|
parse_lm:
|
||||||
>function parse_lm(move)
|
>function parse_lm(move)
|
||||||
>--? window:mvaddstr(4, 50, move)
|
>--? Window:mvaddstr(4, 50, move)
|
||||||
> local file1 = string.byte(move:sub(1, 1)) - 96 -- 'a'-1
|
> local file1 = string.byte(move:sub(1, 1)) - 96 -- 'a'-1
|
||||||
> local rank1 = string.byte(move:sub(2, 2)) - 48 -- '0'
|
> local rank1 = string.byte(move:sub(2, 2)) - 48 -- '0'
|
||||||
> local file2 = string.byte(move:sub(3, 3)) - 96 -- 'a'-1
|
> local file2 = string.byte(move:sub(3, 3)) - 96 -- 'a'-1
|
||||||
> local rank2 = string.byte(move:sub(4, 4)) - 48 -- '0'
|
> local rank2 = string.byte(move:sub(4, 4)) - 48 -- '0'
|
||||||
>--? window:mvaddstr(5, 50, dump({{rank1, file1}, {rank2, file2}}))
|
>--? Window:mvaddstr(5, 50, dump({{rank1, file1}, {rank2, file2}}))
|
||||||
> return {from={rank=rank1, file=file1}, to={rank=rank2, file=file2}}
|
> return {from={rank=rank1, file=file1}, to={rank=rank2, file=file2}}
|
||||||
>end
|
>end
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
|
@ -172,12 +172,12 @@
|
||||||
> current_game.bc = o.d.bc
|
> current_game.bc = o.d.bc
|
||||||
>--? current_game.lm = o.d.lm
|
>--? current_game.lm = o.d.lm
|
||||||
> current_game.previously_moved_squares = parse_lm(o.d.lm)
|
> current_game.previously_moved_squares = parse_lm(o.d.lm)
|
||||||
>--? window:nodelay(false)
|
>--? Window:nodelay(false)
|
||||||
>--? window:mvaddstr(3, 50, "paused")
|
>--? Window:mvaddstr(3, 50, "paused")
|
||||||
> end
|
> end
|
||||||
> current_game.fen_rank = split(current_game.fen, "%w+")
|
> current_game.fen_rank = split(current_game.fen, "%w+")
|
||||||
> render_board(current_game)
|
> render_board(current_game)
|
||||||
> window:refresh()
|
> Window:refresh()
|
||||||
>end
|
>end
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
init_colors:
|
init_colors:
|
||||||
|
@ -207,9 +207,9 @@
|
||||||
> url = "https://lichess.org/api/tv/feed",
|
> url = "https://lichess.org/api/tv/feed",
|
||||||
> sink = function(chunk, err)
|
> sink = function(chunk, err)
|
||||||
> if chunk then
|
> if chunk then
|
||||||
> window:clear()
|
> Window:clear()
|
||||||
> render(chunk)
|
> render(chunk)
|
||||||
> window:getch()
|
> Window:getch()
|
||||||
> end
|
> end
|
||||||
> return 1
|
> return 1
|
||||||
> end,
|
> end,
|
||||||
|
@ -271,17 +271,17 @@
|
||||||
> url = "https://lichess.org/api/tv/feed",
|
> url = "https://lichess.org/api/tv/feed",
|
||||||
> sink = function(chunk, err)
|
> sink = function(chunk, err)
|
||||||
> if chunk then
|
> if chunk then
|
||||||
> window:clear()
|
> Window:clear()
|
||||||
> -- main event loop is here
|
> -- main event loop is here
|
||||||
> render(chunk)
|
> render(chunk)
|
||||||
> window:getch()
|
> Window:getch()
|
||||||
> end
|
> end
|
||||||
> return 1
|
> return 1
|
||||||
> end,
|
> end,
|
||||||
> }
|
> }
|
||||||
> http.request(request)
|
> http.request(request)
|
||||||
> -- degenerate event loop just to show errors in sandboxing, etc.
|
> -- degenerate event loop just to show errors in sandboxing, etc.
|
||||||
> while true do window:getch(); end
|
> while true do Window:getch(); end
|
||||||
>end
|
>end
|
||||||
- __teliva_timestamp:
|
- __teliva_timestamp:
|
||||||
>Thu Feb 17 20:00:23 2022
|
>Thu Feb 17 20:00:23 2022
|
||||||
|
|
|
@ -80,7 +80,7 @@
|
||||||
check_eq:
|
check_eq:
|
||||||
>function check_eq(x, expected, msg)
|
>function check_eq(x, expected, msg)
|
||||||
> if x == expected then
|
> if x == expected then
|
||||||
> window:addch('.')
|
> Window:addch('.')
|
||||||
> else
|
> else
|
||||||
> print('F - '..msg)
|
> print('F - '..msg)
|
||||||
> print(' expected '..tostring(expected)..' but got '..x)
|
> print(' expected '..tostring(expected)..' but got '..x)
|
||||||
|
@ -147,8 +147,8 @@
|
||||||
> return result
|
> return result
|
||||||
>end
|
>end
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
window:
|
Window:
|
||||||
>window = curses.stdscr()
|
>Window = curses.stdscr()
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
render:
|
render:
|
||||||
>function render(window)
|
>function render(window)
|
||||||
|
@ -193,7 +193,7 @@
|
||||||
> init_colors()
|
> init_colors()
|
||||||
>
|
>
|
||||||
> while true do
|
> while true do
|
||||||
> render(window)
|
> render(Window)
|
||||||
> update(window)
|
> update(Window)
|
||||||
> end
|
> end
|
||||||
>end
|
>end
|
||||||
|
|
|
@ -17,8 +17,8 @@
|
||||||
# If these constraints are violated, Teliva may unceremoniously crash. Please
|
# If these constraints are violated, Teliva may unceremoniously crash. Please
|
||||||
# report bugs at http://akkartik.name/contact
|
# report bugs at http://akkartik.name/contact
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
window:
|
Window:
|
||||||
>window = curses.stdscr()
|
>Window = curses.stdscr()
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
n:
|
n:
|
||||||
>n = 0
|
>n = 0
|
||||||
|
@ -55,8 +55,8 @@
|
||||||
> end
|
> end
|
||||||
>
|
>
|
||||||
> while true do
|
> while true do
|
||||||
> render(window)
|
> render(Window)
|
||||||
> update(window)
|
> update(Window)
|
||||||
> end
|
> end
|
||||||
>end
|
>end
|
||||||
- __teliva_timestamp:
|
- __teliva_timestamp:
|
||||||
|
|
10
gemini.tlv
10
gemini.tlv
|
@ -80,7 +80,7 @@
|
||||||
check_eq:
|
check_eq:
|
||||||
>function check_eq(x, expected, msg)
|
>function check_eq(x, expected, msg)
|
||||||
> if x == expected then
|
> if x == expected then
|
||||||
> window:addch('.')
|
> Window:addch('.')
|
||||||
> else
|
> else
|
||||||
> print('F - '..msg)
|
> print('F - '..msg)
|
||||||
> print(' expected '..tostring(expected)..' but got '..x)
|
> print(' expected '..tostring(expected)..' but got '..x)
|
||||||
|
@ -167,8 +167,8 @@
|
||||||
> append(target, src)
|
> append(target, src)
|
||||||
>end
|
>end
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
window:
|
Window:
|
||||||
>window = curses.stdscr()
|
>Window = curses.stdscr()
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
render_line:
|
render_line:
|
||||||
>function render_line(window, y, line)
|
>function render_line(window, y, line)
|
||||||
|
@ -377,8 +377,8 @@
|
||||||
> lines = gemini_get(state.url)
|
> lines = gemini_get(state.url)
|
||||||
> end
|
> end
|
||||||
> while true do
|
> while true do
|
||||||
> render(window, lines)
|
> render(Window, lines)
|
||||||
> update(window, lines)
|
> update(Window, lines)
|
||||||
> end
|
> end
|
||||||
>end
|
>end
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
|
|
|
@ -40,8 +40,8 @@
|
||||||
> return table.remove(array)
|
> return table.remove(array)
|
||||||
>end
|
>end
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
window:
|
Window:
|
||||||
>window = curses.stdscr()
|
>Window = curses.stdscr()
|
||||||
- __teliva_timestamp: original
|
- __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)
|
||||||
|
@ -86,8 +86,8 @@
|
||||||
> curses.init_pair(15, 0, 250) -- tower frames
|
> curses.init_pair(15, 0, 250) -- tower frames
|
||||||
>
|
>
|
||||||
> while true do
|
> while true do
|
||||||
> render(window)
|
> render(Window)
|
||||||
> update(window)
|
> update(Window)
|
||||||
> end
|
> end
|
||||||
>end
|
>end
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
|
|
16
life.tlv
16
life.tlv
|
@ -27,12 +27,12 @@
|
||||||
> end
|
> end
|
||||||
>end
|
>end
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
window:
|
Window:
|
||||||
>window = curses.stdscr()
|
>Window = curses.stdscr()
|
||||||
>-- animation-based app
|
>-- animation-based app
|
||||||
>window:nodelay(true)
|
>Window:nodelay(true)
|
||||||
>curses.curs_set(0)
|
>curses.curs_set(0)
|
||||||
>lines, cols = window:getmaxyx()
|
>lines, cols = Window:getmaxyx()
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
grid_char:
|
grid_char:
|
||||||
>-- grab a 4x2 chunk of grid
|
>-- grab a 4x2 chunk of grid
|
||||||
|
@ -285,14 +285,14 @@
|
||||||
> --
|
> --
|
||||||
> -- For example, check out the list of Important Patterns at
|
> -- For example, check out the list of Important Patterns at
|
||||||
> -- https://www.conwaylife.com/wiki/Category:Patterns_with_Catagolue_frequency_class_0
|
> -- https://www.conwaylife.com/wiki/Category:Patterns_with_Catagolue_frequency_class_0
|
||||||
> load_file(window, arg[1])
|
> load_file(Window, arg[1])
|
||||||
> end
|
> end
|
||||||
>
|
>
|
||||||
> -- main loop
|
> -- main loop
|
||||||
> while true do
|
> while true do
|
||||||
> render(window)
|
> render(Window)
|
||||||
> c = window:getch()
|
> c = Window:getch()
|
||||||
> update(window, c)
|
> update(Window, c)
|
||||||
> step()
|
> step()
|
||||||
> end
|
> end
|
||||||
>end
|
>end
|
||||||
|
|
10
lisp.tlv
10
lisp.tlv
|
@ -80,7 +80,7 @@
|
||||||
check_eq:
|
check_eq:
|
||||||
>function check_eq(x, expected, msg)
|
>function check_eq(x, expected, msg)
|
||||||
> if x == expected then
|
> if x == expected then
|
||||||
> window:addch('.')
|
> Window:addch('.')
|
||||||
> else
|
> else
|
||||||
> print('F - '..msg)
|
> print('F - '..msg)
|
||||||
> print(' expected '..tostring(expected)..' but got '..x)
|
> print(' expected '..tostring(expected)..' but got '..x)
|
||||||
|
@ -147,8 +147,8 @@
|
||||||
> return result
|
> return result
|
||||||
>end
|
>end
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
window:
|
Window:
|
||||||
>window = curses.stdscr()
|
>Window = curses.stdscr()
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
render:
|
render:
|
||||||
>function render(window)
|
>function render(window)
|
||||||
|
@ -195,8 +195,8 @@
|
||||||
> init_colors()
|
> init_colors()
|
||||||
>
|
>
|
||||||
> while true do
|
> while true do
|
||||||
> render(window)
|
> render(Window)
|
||||||
> update(window)
|
> update(Window)
|
||||||
> end
|
> end
|
||||||
>end
|
>end
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
|
|
22
sieve.tlv
22
sieve.tlv
|
@ -80,7 +80,7 @@
|
||||||
check_eq:
|
check_eq:
|
||||||
>function check_eq(x, expected, msg)
|
>function check_eq(x, expected, msg)
|
||||||
> if eq(x, expected) then
|
> if eq(x, expected) then
|
||||||
> window:addch('.')
|
> Window:addch('.')
|
||||||
> else
|
> else
|
||||||
> print('F - '..msg)
|
> print('F - '..msg)
|
||||||
> print(' expected '..str(expected)..' but got '..str(x))
|
> print(' expected '..str(expected)..' but got '..str(x))
|
||||||
|
@ -207,8 +207,8 @@
|
||||||
> end
|
> end
|
||||||
>end
|
>end
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
window:
|
Window:
|
||||||
>window = curses.stdscr()
|
>Window = curses.stdscr()
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
render:
|
render:
|
||||||
>function render(window)
|
>function render(window)
|
||||||
|
@ -255,8 +255,8 @@
|
||||||
> init_colors()
|
> init_colors()
|
||||||
>
|
>
|
||||||
> while true do
|
> while true do
|
||||||
> render(window)
|
> render(Window)
|
||||||
> update(window)
|
> update(Window)
|
||||||
> end
|
> end
|
||||||
>end
|
>end
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
|
@ -271,7 +271,7 @@
|
||||||
> task.spawn(main_task)
|
> task.spawn(main_task)
|
||||||
> task.scheduler()
|
> task.scheduler()
|
||||||
> print('out of scheduler')
|
> print('out of scheduler')
|
||||||
> window:getch()
|
> Window:getch()
|
||||||
>end
|
>end
|
||||||
- __teliva_timestamp:
|
- __teliva_timestamp:
|
||||||
>Sat Feb 26 21:50:11 2022
|
>Sat Feb 26 21:50:11 2022
|
||||||
|
@ -362,13 +362,13 @@
|
||||||
>infinite primes
|
>infinite primes
|
||||||
main:
|
main:
|
||||||
>function main()
|
>function main()
|
||||||
> window:nodelay(true)
|
> Window:nodelay(true)
|
||||||
> window:clear()
|
> Window:clear()
|
||||||
> task.spawn(main_task, window)
|
> task.spawn(main_task, Window)
|
||||||
> task.scheduler()
|
> task.scheduler()
|
||||||
> print('key pressed; done')
|
> print('key pressed; done')
|
||||||
> window:nodelay(false)
|
> Window:nodelay(false)
|
||||||
> window:getch()
|
> Window:getch()
|
||||||
>end
|
>end
|
||||||
- __teliva_timestamp:
|
- __teliva_timestamp:
|
||||||
>Sat Feb 26 22:09:47 2022
|
>Sat Feb 26 22:09:47 2022
|
||||||
|
|
10
template.tlv
10
template.tlv
|
@ -80,7 +80,7 @@
|
||||||
check_eq:
|
check_eq:
|
||||||
>function check_eq(x, expected, msg)
|
>function check_eq(x, expected, msg)
|
||||||
> if eq(x, expected) then
|
> if eq(x, expected) then
|
||||||
> window:addch('.')
|
> Window:addch('.')
|
||||||
> else
|
> else
|
||||||
> print('F - '..msg)
|
> print('F - '..msg)
|
||||||
> print(' expected '..str(expected)..' but got '..str(x))
|
> print(' expected '..str(expected)..' but got '..str(x))
|
||||||
|
@ -207,8 +207,8 @@
|
||||||
> end
|
> end
|
||||||
>end
|
>end
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
window:
|
Window:
|
||||||
>window = curses.stdscr()
|
>Window = curses.stdscr()
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
render:
|
render:
|
||||||
>function render(window)
|
>function render(window)
|
||||||
|
@ -255,8 +255,8 @@
|
||||||
> init_colors()
|
> init_colors()
|
||||||
>
|
>
|
||||||
> while true do
|
> while true do
|
||||||
> render(window)
|
> render(Window)
|
||||||
> update(window)
|
> update(Window)
|
||||||
> end
|
> end
|
||||||
>end
|
>end
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
|
|
|
@ -80,7 +80,7 @@
|
||||||
check_eq:
|
check_eq:
|
||||||
>function check_eq(x, expected, msg)
|
>function check_eq(x, expected, msg)
|
||||||
> if x == expected then
|
> if x == expected then
|
||||||
> window:addch('.')
|
> Window:addch('.')
|
||||||
> else
|
> else
|
||||||
> print('F - '..msg)
|
> print('F - '..msg)
|
||||||
> print(' expected '..tostring(expected)..' but got '..x)
|
> print(' expected '..tostring(expected)..' but got '..x)
|
||||||
|
@ -147,8 +147,8 @@
|
||||||
> return result
|
> return result
|
||||||
>end
|
>end
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
window:
|
Window:
|
||||||
>window = curses.stdscr()
|
>Window = curses.stdscr()
|
||||||
>curses.curs_set(0) -- we'll simulate our own cursor
|
>curses.curs_set(0) -- we'll simulate our own cursor
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
menu:
|
menu:
|
||||||
|
@ -162,8 +162,8 @@
|
||||||
> init_colors()
|
> init_colors()
|
||||||
>
|
>
|
||||||
> while true do
|
> while true do
|
||||||
> render(window)
|
> render(Window)
|
||||||
> update(window)
|
> update(Window)
|
||||||
> end
|
> end
|
||||||
>end
|
>end
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
|
|
40
zet.tlv
40
zet.tlv
|
@ -80,7 +80,7 @@
|
||||||
check_eq:
|
check_eq:
|
||||||
>function check_eq(x, expected, msg)
|
>function check_eq(x, expected, msg)
|
||||||
> if x == expected then
|
> if x == expected then
|
||||||
> window:addch('.')
|
> Window:addch('.')
|
||||||
> else
|
> else
|
||||||
> print('F - '..msg)
|
> print('F - '..msg)
|
||||||
> print(' expected '..tostring(expected)..' but got '..x)
|
> print(' expected '..tostring(expected)..' but got '..x)
|
||||||
|
@ -150,12 +150,12 @@
|
||||||
spaces:
|
spaces:
|
||||||
>function spaces(n)
|
>function spaces(n)
|
||||||
> for i=1,n do
|
> for i=1,n do
|
||||||
> window:addch(' ')
|
> Window:addch(' ')
|
||||||
> end
|
> end
|
||||||
>end
|
>end
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
window:
|
Window:
|
||||||
>window = curses.stdscr()
|
>Window = curses.stdscr()
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
menu:
|
menu:
|
||||||
>-- To show app-specific hotkeys in the menu bar, add hotkey/command
|
>-- To show app-specific hotkeys in the menu bar, add hotkey/command
|
||||||
|
@ -182,8 +182,8 @@
|
||||||
> current_zettel_id = zettels.root
|
> current_zettel_id = zettels.root
|
||||||
>
|
>
|
||||||
> while true do
|
> while true do
|
||||||
> render(window)
|
> render(Window)
|
||||||
> update(window)
|
> update(Window)
|
||||||
> end
|
> end
|
||||||
>end
|
>end
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
|
@ -389,7 +389,7 @@
|
||||||
>}
|
>}
|
||||||
- __teliva_timestamp: original
|
- __teliva_timestamp: original
|
||||||
editz:
|
editz:
|
||||||
>function editz()
|
>function editz(window)
|
||||||
> menu = { {'^e', 'back to browsing'},}
|
> menu = { {'^e', 'back to browsing'},}
|
||||||
> local top = (render_state.curr_h - 1) * (view_settings.height + view_settings.vmargin)
|
> local top = (render_state.curr_h - 1) * (view_settings.height + view_settings.vmargin)
|
||||||
> local bottom = top + view_settings.height
|
> local bottom = top + view_settings.height
|
||||||
|
@ -752,8 +752,8 @@
|
||||||
>
|
>
|
||||||
> curses.curs_set(0)
|
> curses.curs_set(0)
|
||||||
> while true do
|
> while true do
|
||||||
> render(window)
|
> render(Window)
|
||||||
> update(window)
|
> update(Window)
|
||||||
> end
|
> end
|
||||||
>end
|
>end
|
||||||
- __teliva_timestamp:
|
- __teliva_timestamp:
|
||||||
|
@ -763,7 +763,7 @@
|
||||||
>
|
>
|
||||||
>There's a reason vim hides it. Confusing to have two cursors on screen.
|
>There's a reason vim hides it. Confusing to have two cursors on screen.
|
||||||
editz:
|
editz:
|
||||||
>function editz()
|
>function editz(window)
|
||||||
> menu = { {'^e', 'back to browsing'},}
|
> menu = { {'^e', 'back to browsing'},}
|
||||||
> local top = (render_state.curr_h - 1) * (view_settings.height + view_settings.vmargin)
|
> local top = (render_state.curr_h - 1) * (view_settings.height + view_settings.vmargin)
|
||||||
> local bottom = top + view_settings.height
|
> local bottom = top + view_settings.height
|
||||||
|
@ -824,7 +824,7 @@
|
||||||
- __teliva_timestamp:
|
- __teliva_timestamp:
|
||||||
>Wed Feb 9 08:25:05 2022
|
>Wed Feb 9 08:25:05 2022
|
||||||
editz:
|
editz:
|
||||||
>function editz()
|
>function editz(window)
|
||||||
> local old_menu = menu
|
> local old_menu = menu
|
||||||
> menu = { {'^e', 'back to browsing'},}
|
> menu = { {'^e', 'back to browsing'},}
|
||||||
> local top = (render_state.curr_h - 1) * (view_settings.height + view_settings.vmargin)
|
> local top = (render_state.curr_h - 1) * (view_settings.height + view_settings.vmargin)
|
||||||
|
@ -1378,8 +1378,8 @@
|
||||||
> current_zettel_id = zettels.root
|
> current_zettel_id = zettels.root
|
||||||
>
|
>
|
||||||
> while true do
|
> while true do
|
||||||
> render(window)
|
> render(Window)
|
||||||
> update(window)
|
> update(Window)
|
||||||
>
|
>
|
||||||
> -- save zettels, but hold on to previous state on disk
|
> -- save zettels, but hold on to previous state on disk
|
||||||
> -- until last possible second
|
> -- until last possible second
|
||||||
|
@ -1407,8 +1407,8 @@
|
||||||
> current_zettel_id = zettels.root
|
> current_zettel_id = zettels.root
|
||||||
>
|
>
|
||||||
> while true do
|
> while true do
|
||||||
> render(window)
|
> render(Window)
|
||||||
> update(window)
|
> update(Window)
|
||||||
>
|
>
|
||||||
> -- save zettels, but hold on to previous state on disk
|
> -- save zettels, but hold on to previous state on disk
|
||||||
> -- until last possible second
|
> -- until last possible second
|
||||||
|
@ -1938,8 +1938,8 @@
|
||||||
> view_settings.first_zettel = zettels.root -- start rendering here
|
> view_settings.first_zettel = zettels.root -- start rendering here
|
||||||
>
|
>
|
||||||
> while true do
|
> while true do
|
||||||
> render(window)
|
> render(Window)
|
||||||
> update(window)
|
> update(Window)
|
||||||
>
|
>
|
||||||
> -- save zettels, but hold on to previous state on disk
|
> -- save zettels, but hold on to previous state on disk
|
||||||
> -- until last possible second
|
> -- until last possible second
|
||||||
|
@ -2353,8 +2353,8 @@
|
||||||
> view_settings.first_zettel = zettels.root -- start rendering here
|
> view_settings.first_zettel = zettels.root -- start rendering here
|
||||||
>
|
>
|
||||||
> while true do
|
> while true do
|
||||||
> render(window)
|
> render(Window)
|
||||||
> update(window)
|
> update(Window)
|
||||||
>
|
>
|
||||||
> -- save zettels, but hold on to previous state on disk
|
> -- save zettels, but hold on to previous state on disk
|
||||||
> -- until last possible second
|
> -- until last possible second
|
||||||
|
@ -2554,7 +2554,7 @@
|
||||||
- __teliva_timestamp:
|
- __teliva_timestamp:
|
||||||
>Sat Feb 12 15:11:33 2022
|
>Sat Feb 12 15:11:33 2022
|
||||||
editz:
|
editz:
|
||||||
>function editz()
|
>function editz(window)
|
||||||
> local old_menu = menu
|
> local old_menu = menu
|
||||||
> menu = {
|
> menu = {
|
||||||
> {'^e', 'finish edit'},
|
> {'^e', 'finish edit'},
|
||||||
|
|
Loading…
Reference in New Issue