about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--toot-toot.tlv62
1 files changed, 62 insertions, 0 deletions
diff --git a/toot-toot.tlv b/toot-toot.tlv
index 2c322a2..528b1b1 100644
--- a/toot-toot.tlv
+++ b/toot-toot.tlv
@@ -969,3 +969,65 @@
     >  {'^w', 'write to "toot"'},
     >  {'^f|^b', 'scroll'},
     >}
+- __teliva_timestamp:
+    >Thu Mar 31 08:42:19 2022
+  update:
+    >function update(window)
+    >  local key = window:getch()
+    >  local h, w = window:getmaxyx()
+    >  if key == curses.KEY_LEFT then
+    >    if cursor > 1 then
+    >      cursor = cursor-1
+    >    end
+    >  elseif key == curses.KEY_RIGHT then
+    >    if cursor <= #prose then
+    >      cursor = cursor+1
+    >    end
+    >  elseif key == curses.KEY_DOWN then
+    >    cursor = cursor_down(prose, cursor, w)
+    >  elseif key == curses.KEY_UP then
+    >    cursor = cursor_up(prose, cursor, w)
+    >  elseif key == curses.KEY_BACKSPACE or key == 8 or key == 127 then  -- ctrl-h, ctrl-?, delete
+    >    if cursor > 1 then
+    >      cursor = cursor-1
+    >      prose = prose:remove(cursor)
+    >    end
+    >  elseif key == 6 then  -- ctrl-f
+    >    first_toot = first_toot+1
+    >  elseif key == 2 then  -- ctrl-b
+    >    if first_toot > 1 then
+    >      first_toot = first_toot-1
+    >    end
+    >  elseif key == 23 then  -- ctrl-w
+    >    local out = io.open(next_toot(), 'w')
+    >    if out ~= nil then
+    >      out:write(prose, '\n')
+    >      out:close()
+    >    end
+    >  elseif key == 10 or (key >= 32 and key < 127) then
+    >    prose = prose:insert(string.char(key), cursor-1)
+    >    cursor = cursor+1
+    >  end
+    >end
+- __teliva_timestamp:
+    >Thu Mar 31 08:44:19 2022
+  next_toot:
+    >-- pick the first filename starting with 'toot' that doesn't exist yet
+    >function next_toot()
+    >  if not file_exists('toot') then return 'toot' end
+    >  local idx = 1
+    >  while true do
+    >    local curr = 'toot'..str(idx)
+    >    if not file_exists(curr) then
+    >      return curr
+    >    end
+    >    idx = idx+1
+    >  end
+    >end
+- __teliva_timestamp:
+    >Thu Mar 31 08:46:27 2022
+  file_exists:
+    >function file_exists(filename)
+    >  local f = io.open(filename, 'r')
+    >  return f ~= nil
+    >end
previous revision' href='/akspecs/ranger/blame/doc/pydoc/ranger.ext.command_parser.html?h=v1.4.2&id=2ca2e862e616eba862ac80f5ee0003d1aa984a32'>^
34a60763 ^
4c13e1f2 ^









34a60763 ^
4c13e1f2 ^






















1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68