From 8709e69bcc588b8a95844992c9b03478591925f9 Mon Sep 17 00:00:00 2001 From: cajun Date: Sat, 28 Sep 2024 14:23:46 -0500 Subject: [PATCH 1/2] prevent empty list crash on windows (fixes #93) (#94) Co-authored-by: cajun <12363371+CajunAvenger@users.noreply.github.com> --- src/gui/control/item_list.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/gui/control/item_list.cpp b/src/gui/control/item_list.cpp index 83dc0437..e3521003 100644 --- a/src/gui/control/item_list.cpp +++ b/src/gui/control/item_list.cpp @@ -180,10 +180,10 @@ void ItemList::refreshList(bool refresh_current_only) { // refresh // Note: Freeze/Thaw makes flicker worse long item_count = (long)sorted_list.size(); + SetItemCount(item_count); if (item_count == 0) { Refresh(); } else { - SetItemCount(item_count); // (re)select current item findSelectedItemPos(); focusNone(); From f3cfbd05941ef00d8e32fe1890484f302d156a67 Mon Sep 17 00:00:00 2001 From: cajun <12363371+CajunAvenger@users.noreply.github.com> Date: Sun, 29 Sep 2024 15:46:52 -0500 Subject: [PATCH 2/2] Update parser.cpp --- src/script/parser.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/script/parser.cpp b/src/script/parser.cpp index ea9a8e14..b47410c3 100644 --- a/src/script/parser.cpp +++ b/src/script/parser.cpp @@ -122,7 +122,7 @@ bool isOper (wxUniChar c) { return wxStrchr(_("+-*/!.@%^&:=<>;,"),c) != nullptr bool isLparen(wxUniChar c) { return c==_('(') || c==_('[') || c==_('{'); } bool isRparen(wxUniChar c) { return c==_(')') || c==_(']') || c==_('}'); } bool isDigitOrDot(wxUniChar c) { return isDigit(c) || c==_('.'); } -bool isLongOper(StringView s) { return s==_(":=") || s==_("==") || s==_("!=") || s==_("<=") || s==_(">="); } +bool isLongOper(StringView s) { return s==_(":=") || s==_("==") || s==_("!=") || s==_("<=") || s==_(">=") || s==_("->"); } // moveme // ----------------------------------------------------------------------------- : Tokenizing @@ -351,7 +351,7 @@ enum Precedence { PREC_ALL , PREC_NEWLINE // newline ; , PREC_SEQ // ; -, PREC_SET // := +, PREC_SET // := -> , PREC_AND // and or , PREC_CMP // == != < > <= >= , PREC_ADD // + - @@ -736,7 +736,7 @@ ExprType parseOper(TokenIterator& input, Script& script, Precedence minPrec, Ins } script.addInstruction(I_POP); // discard result of first expression type = parseOper(input, script, PREC_SET); - } else if (minPrec <= PREC_SET && token==_(":=")) { + } else if (minPrec <= PREC_SET && (token==_(":=") || token==_("->"))) { // We made a mistake, the part before the := should be a variable name, // not an expression. Remove that instruction. Instruction& instr = script.getInstructions().back();