aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authorGravatar mitchell <70453897+667e-11@users.noreply.github.com>2013-08-24 14:26:24 -0400
committerGravatar mitchell <70453897+667e-11@users.noreply.github.com>2013-08-24 14:26:24 -0400
commit2052c77111051972d8171d27c8d4c501803e70d6 (patch)
treea38f24f35a3a4dc06f32eb365f439fc2b3918ea7 /src
parent58e1d2b46d09b79ad9c43ae177057c8578294649 (diff)
Include Scintilla constants in `buffer`s.
Diffstat (limited to 'src')
-rw-r--r--src/textadept.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/textadept.c b/src/textadept.c
index e79e5509..3e150bd1 100644
--- a/src/textadept.c
+++ b/src/textadept.c
@@ -1293,6 +1293,14 @@ static int lbuf_property(lua_State *L) {
(!is_buffer || !newindex) ? 2 : 3);
} else lua_pop(L, 2); // non-table, ta_properties
+ // If the key is a Scintilla constant, return its value.
+ if (!newindex) {
+ lua_getfield(L, LUA_REGISTRYINDEX, "ta_constants");
+ lua_pushvalue(L, 2), lua_gettable(L, -2);
+ if (lua_isnumber(L, -1)) return 1;
+ lua_pop(L, 2); // non-number, ta_constants
+ }
+
!newindex ? lua_rawget(L, 1) : lua_rawset(L, 1);
return 1;
}