aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2020-07-07 21:02:07 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2020-07-07 21:02:07 -0400
commit584e580c2213f91a17425be10d57aa5bd2f3d509 (patch)
treef47ca2ee2a85bcfba437ddd989b27284827c542c /src
parent021866de868fd074526fc63270639ec2f3ce9aa5 (diff)
downloadtextadept-584e580c2213f91a17425be10d57aa5bd2f3d509.tar.gz
textadept-584e580c2213f91a17425be10d57aa5bd2f3d509.zip
Added `lexer.colors` and `lexer.styles` and updated themes to utilize them.
This allows for a more Lua table-oriented approach to defining and using colors and styles, instead of manually manipulating Scintilla property strings. Themes are still backwards compatible, as the underlying mechanisms are still in place.
Diffstat (limited to 'src')
-rw-r--r--src/Makefile2
-rw-r--r--src/textadept.c16
2 files changed, 17 insertions, 1 deletions
diff --git a/src/Makefile b/src/Makefile
index 58fe53a5..232f097c 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -376,7 +376,7 @@ else
gtdialog_url = http://foicica.com/hg/gtdialog/archive/tip.zip
endif
-scintilla_zip = 1757848f5635.zip
+scintilla_zip = d51c7ec9ec78.zip
lua_tgz = lua-5.3.5.tar.gz
lpeg_tgz = lpeg-1.0.2.tar.gz
lfs_zip = v1_7_0_2.zip
diff --git a/src/textadept.c b/src/textadept.c
index 2afb1b59..9f4414a6 100644
--- a/src/textadept.c
+++ b/src/textadept.c
@@ -828,6 +828,21 @@ static int menu(lua_State *L) {
#endif
}
+/** `ui.update()` Lua function. */
+static int update_ui(lua_State *L) {
+#if GTK
+ while (gtk_events_pending()) gtk_main_iteration();
+#elif CURSES
+ struct timeval timeout = {0, 1e5}; // 0.1s
+ int nfds = os_spawn_pushfds(L);
+ fd_set *fds = (fd_set *)lua_touserdata(L, -1);
+ while (select(nfds, fds, NULL, NULL, &timeout) > 0)
+ if (os_spawn_readfds(L) >= 0) refresh_all();
+ lua_pop(L, 1); // fd_set
+#endif
+ return 0;
+}
+
/** `ui.__index` Lua metamethod. */
static int ui_index(lua_State *L) {
const char *key = lua_tostring(L, 2);
@@ -1590,6 +1605,7 @@ static int init_lua(lua_State *L, int argc, char **argv, int reinit) {
lua_pushcfunction(L, get_split_table), lua_setfield(L, -2, "get_split_table");
lua_pushcfunction(L, goto_view), lua_setfield(L, -2, "goto_view");
lua_pushcfunction(L, menu), lua_setfield(L, -2, "menu");
+ lua_pushcfunction(L, update_ui), lua_setfield(L, -2, "update");
set_metatable(L, -1, "ta_ui", ui_index, ui_newindex);
lua_setglobal(L, "ui");