Skip to content

Commit 4524361

Browse files
committed
CollectionInterface: make sure boolean autoCompletion resolves correctly
1 parent 9f55590 commit 4524361

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

src/Classes/CollectionInterfaceClass.cpp

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -274,12 +274,13 @@ bool CollectionInterface::getListsFromJson(void)
274274
for (const auto& item : jUdl["UDLs"].items()) {
275275
auto j = item.value();
276276
std::wstring ws_id_name = string2wstring(j["id-name"].get<std::string>());
277+
std::wstring ws_display_name = string2wstring(j["display-name"].get<std::string>());
277278
std::wstring udl_base = L"https://raw.githubusercontent.com/notepad-plus-plus/userDefinedLanguages/master/";
278279

279280
// Logic for UDL -> URL
280281
if (j.contains("repository")) {
281282
std::wstring sUDL = L"";
282-
if (j["repository"].is_boolean()) { // URL repo should never be boolean; but if it is, generate default URL
283+
if (j["repository"].is_boolean()) { // URL repo should never be boolean; but if it is, generate default URL (doesn't matter whether true or false, need a URL either way)
283284
sUDL = udl_base + L"UDLs/" + ws_id_name + L".xml";
284285
}
285286
if (j["repository"].is_string()) {
@@ -312,9 +313,12 @@ bool CollectionInterface::getListsFromJson(void)
312313
// Logic for functionList -> URL
313314
if (j.contains("functionList")) {
314315
std::wstring wsFuncList = L"";
316+
// if functionList boolean=True, generate filename from ID
315317
if (j["functionList"].is_boolean() && j["functionList"].get<bool>()) {
316318
wsFuncList = udl_base + L"functionList/" + ws_id_name + L".xml";
317319
}
320+
// if functionList boolean=False, don't need a wsFuncList entry, so leave as "" with no IF statement
321+
// if functionList is string, use that string for URL or filename, as appropriate.
318322
if (j["functionList"].is_string()) {
319323
std::wstring ws = string2wstring(j["functionList"].get<std::string>());
320324

@@ -335,9 +339,12 @@ bool CollectionInterface::getListsFromJson(void)
335339
// Logic for autoCompletion -> URL
336340
if (j.contains("autoCompletion")) {
337341
std::wstring wsAutoComp = L"";
338-
if (j["autoCompletion"].is_boolean()) {
339-
wsAutoComp = udl_base + L"autoCompletion/" + ws_id_name + L".xml";
342+
// if boolean=True, generate name from DISPLAY name
343+
if (j["autoCompletion"].is_boolean() && j["autoCompletion"].get<bool>()) {
344+
wsAutoComp = udl_base + L"autoCompletion/" + ws_display_name + L".xml";
340345
}
346+
// if boolean=False, don't need wsAutoComp defined at all..., so no IF needed
347+
// if string, extract the value and check for URL vs repo
341348
if (j["autoCompletion"].is_string()) {
342349
std::wstring ws = string2wstring(j["autoCompletion"].get<std::string>());
343350
if (ws.find(L"http") == 0) {

src/Dialogs/Version.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717
along with this program. If not, see <https://www.gnu.org/licenses/>.
1818
*/
1919

20-
#define VERSION_NUM 1,1,0,2
20+
#define VERSION_NUM 1,1,0,3
2121
#define VERSION_LINEAR 100
2222
#define VERSION_LINEAR_TEXT TEXT(VERSION_LINEAR)
2323
#define VERSION_STRING "1.1.0"
2424
// // VERSION_TEXT This must match the tag pushed on the server minus the "v"
2525
#define VERSION_TEXT TEXT(VERSION_STRING)
2626
// // VERSION_STAGE // "-alpha", "-beta", "-dev", ""
27-
#define VERSION_STAGE "-dev2"
27+
#define VERSION_STAGE "-dev3"
2828
#define VERSION_STAGE_WS TEXT(VERSION_STAGE)
2929
#define VERSION_NAME "CollectionInterface"
3030
#define VERSION_NAME_WS TEXT(VERSION_NAME)

0 commit comments

Comments
 (0)