diff options
| author | mitchell <unknown> | 2020-03-28 18:38:01 -0400 |
|---|---|---|
| committer | mitchell <unknown> | 2020-03-28 18:38:01 -0400 |
| commit | 7ffaae978a096dd2a922a0a7b227a02439753d43 (patch) | |
| tree | 3e8c28c673cb2591375c04cef9a3fd357c3e0705 /lexers | |
| parent | bd2dbf287be7144d4adc9b29a75f6e7c263e8ac4 (diff) | |
| download | scintilla-mirror-7ffaae978a096dd2a922a0a7b227a02439753d43.tar.gz | |
Switch to 1-based style numbers internally in Lua.
Diffstat (limited to 'lexers')
| -rw-r--r-- | lexers/LexLPeg.cxx | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lexers/LexLPeg.cxx b/lexers/LexLPeg.cxx index a4e2f1735..c73c2d3db 100644 --- a/lexers/LexLPeg.cxx +++ b/lexers/LexLPeg.cxx @@ -100,7 +100,7 @@ static int lexer_property_index(lua_State *L) { lua_getfield(L, 4, "_TOKENSTYLES"); lua_pushnil(L); while (lua_next(L, -2)) { - if (luaL_checkinteger(L, -1) == style) break; + if (luaL_checkinteger(L, -1) - 1 == style) break; lua_pop(L, 1); // value } lua_pop(L, 1); // style_num, leaving name on top @@ -416,10 +416,10 @@ class LexerLPeg : public DefaultLexer { lua_pushnil(L); while (lua_next(L, -2)) { if (lua_isstring(L, -2) && lua_isnumber(L, -1) && - lua_tointeger(L, -1) != STYLE_DEFAULT) { + lua_tointeger(L, -1) - 1 != STYLE_DEFAULT) { lua_pushstring(L, "style."), lua_pushvalue(L, -3), lua_concat(L, 2); expand_property(L); - SetStyle(lua_tointeger(L, -2), lua_tostring(L, -1)); + SetStyle(lua_tointeger(L, -2) - 1, lua_tostring(L, -1)); lua_pop(L, 1); // style } lua_pop(L, 1); // value @@ -693,7 +693,7 @@ public: for (int i = 1; i < len; i += 2) { style = STYLE_DEFAULT; if (lua_rawgeti(L, -2, i), lua_rawget(L, -2)) - style = lua_tointeger(L, -1); + style = lua_tointeger(L, -1) - 1; lua_pop(L, 1); // _TOKENSTYLES[token] lua_rawgeti(L, -2, i + 1); // pos unsigned int position = lua_tointeger(L, -1) - 1; @@ -779,7 +779,7 @@ public: lua_pushstring(L, key + 6); if (lua_rawget(L, -2) == LUA_TNUMBER) { lua_pushstring(L, key), expand_property(L); - int style_num = lua_tointeger(L, -2); + int style_num = lua_tointeger(L, -2) - 1; SetStyle(style_num, lua_tostring(L, -1)); if (style_num == STYLE_DEFAULT) // Assume a theme change, with the default style being set first. @@ -879,7 +879,7 @@ public: lua_getfield(L, -1, "_TOKENSTYLES"); lua_pushnil(L); while (lua_next(L, -2)) - if (lua_tointeger(L, -1) == style) { + if (lua_tointeger(L, -1) - 1 == style) { styleName = lua_tostring(L, -2); lua_pop(L, 2); // value and key break; |
