about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--src/Makefile4
-rw-r--r--toot-toot.tlv96
2 files changed, 98 insertions, 2 deletions
diff --git a/src/Makefile b/src/Makefile
index d9ef9b1..1d6cd13 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -8,7 +8,7 @@
 PLAT= none
 
 CC= gcc
-CFLAGS= -g -O2 -std=c99 -Wall -Wshadow $(MYCFLAGS)
+CFLAGS= -g -O2 -std=c99 -Wall -Wshadow $(MYCFLAGS) -fsanitize=address
 AR= ar rc
 RANLIB= ranlib
 RM= rm -f
@@ -50,7 +50,7 @@ $(LUA_A): $(CORE_O) $(LIB_O)
 	$(RANLIB) $@
 
 $(LUA_T): $(LUA_O) $(LUA_A) lcurses/curses.o luasocket/socket.a luasocket/mime.a luasec/ssl.a
-	$(CC) -o $@ $(MYLDFLAGS) $(LUA_O) $(LUA_A) lcurses/curses.o luasocket/socket.a luasocket/mime.a luasec/ssl.a $(LIBS)
+	$(CC) -o $@ -fsanitize=address -static-libasan $(MYLDFLAGS) $(LUA_O) $(LUA_A) lcurses/curses.o luasocket/socket.a luasocket/mime.a luasec/ssl.a $(LIBS)
 
 clean:
 	$(RM) lcurses/curses.o
diff --git a/toot-toot.tlv b/toot-toot.tlv
index 6c73c45..6e08d07 100644
--- a/toot-toot.tlv
+++ b/toot-toot.tlv
@@ -9133,3 +9133,99 @@
     >  end
     >  return newpos
     >end
+- update:
+    >function update(window)
+    >  local key = curses.getch()
+    >  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)
+    >  elseif key == curses.KEY_UP then
+    >    cursor = cursor_up(prose, cursor)
+    >  elseif key == curses.KEY_BACKSPACE then
+    >    if cursor > 1 then
+    >      cursor = cursor-1
+    >      prose = prose:remove(cursor)
+    >    end
+    >  elseif key == 21 then  -- ctrl-u
+    >    prose = ''
+    >    cursor = 1
+    >  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:
+    >Fri Dec 17 23:12:03 2021
+- update:
+    >function update(window)
+    >  local key = curses.getch()
+    >  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)
+    >  elseif key == curses.KEY_UP then
+    >    cursor = cursor_up(prose, cursor)
+    >  elseif key == curses.KEY_BACKSPACE then
+    >    if cursor > 1 then
+    >      cursor = cursor-1
+    >      prose = prose:remove(cursor)
+    >    end
+    >  elseif key == 21 then  -- ctrl-u
+    >    prose = ''
+    >    cursor = 1
+    >  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:
+    >Fri Dec 17 23:12:07 2021
+- update:
+    >function update(window)
+    >  local key = curses.getch()
+    >  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)
+    >  elseif key == curses.KEY_UP then
+    >    cursor = cursor_up(prose, cursor)
+    >  elseif key == curses.KEY_BACKSPACE then
+    >    if cursor > 1 then
+    >      cursor = cursor-1
+    >      prose = prose:remove(cursor)
+    >    end
+    >  elseif key == 21 then  -- ctrl-u
+    >    prose = ''
+    >    cursor = 1
+    >  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:
+    >Fri Dec 17 23:12:14 2021
+- menu:
+    >menu = {}
+    >menu['^u'] = 'clear'
+  __teliva_timestamp:
+    >Fri Dec 17 23:13:04 2021