Skip to content

Commit 83a2550

Browse files
committed
Add npp.UniMode
Closes dail8859#74
1 parent 294d97c commit 83a2550

File tree

2 files changed

+38
-0
lines changed

2 files changed

+38
-0
lines changed

src/LuaConsole.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
// Extra helper functions not from the IFace tables
3131
static const std::vector<std::string> moreSciFuncs = { "append", "findtext", "match", "remove", "set_text_direction", "textrange" };
3232
static const std::vector<std::string> moreNppFuncs = { "AddEventHandler", "AddShortcut", "ClearConsole", "ConstantName", "RemoveAllEventHandlers", "RemoveEventHandler", "SendEditor", "StartTimer", "StopTimer", "WriteError" };
33+
static const std::vector<std::string> moreNppProps = { "UniMode" };
3334

3435
// Copied from Scintilla
3536
inline int MakeUpperCase(int ch) {
@@ -191,6 +192,7 @@ LuaConsole::LuaConsole(HWND hNotepad) : mp_consoleDlg(new ConsoleDialog()), m_hN
191192
// Notepad++ properties
192193
auto nppPropNames = NppIFaceTable.GetAllPropertyNames();
193194
nppPropNames.insert(nppPropNames.end(), moreNppFuncs.begin(), moreNppFuncs.end());
195+
nppPropNames.insert(nppPropNames.end(), moreNppProps.begin(), moreNppProps.end());
194196
nppProperties = join(sortCaseInsensitive(nppPropNames), ' ');
195197

196198
// Notepad++ functions

src/SciTE/LuaExtension.cpp

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,6 +1561,42 @@ static bool InitGlobalScope() {
15611561

15621562
lua_pushcfunction(luaState, cf_npp_stoptimer);
15631563
lua_setfield(luaState, -2, "StopTimer");
1564+
1565+
lua_createtable(luaState, 0, 8);
1566+
1567+
lua_pushstring(luaState, "ANSI");
1568+
lua_pushinteger(luaState, 0);
1569+
lua_settable(luaState, -3);
1570+
1571+
lua_pushstring(luaState, "UTF8_BOM");
1572+
lua_pushinteger(luaState, 1);
1573+
lua_settable(luaState, -3);
1574+
1575+
lua_pushstring(luaState, "UTF16BE_BOM");
1576+
lua_pushinteger(luaState, 2);
1577+
lua_settable(luaState, -3);
1578+
1579+
lua_pushstring(luaState, "UTF16LE_BOM");
1580+
lua_pushinteger(luaState, 3);
1581+
lua_settable(luaState, -3);
1582+
1583+
lua_pushstring(luaState, "UTF8");
1584+
lua_pushinteger(luaState, 4);
1585+
lua_settable(luaState, -3);
1586+
1587+
lua_pushstring(luaState, "ASCII");
1588+
lua_pushinteger(luaState, 5);
1589+
lua_settable(luaState, -3);
1590+
1591+
lua_pushstring(luaState, "UTF16BE");
1592+
lua_pushinteger(luaState, 6);
1593+
lua_settable(luaState, -3);
1594+
1595+
lua_pushstring(luaState, "UTF16LE");
1596+
lua_pushinteger(luaState, 7);
1597+
lua_settable(luaState, -3);
1598+
1599+
lua_setfield(luaState, -2, "UniMode");
15641600
}
15651601
lua_setmetatable(luaState, -2);
15661602

0 commit comments

Comments
 (0)