diff --git a/pgadmin/ctl/ctlSQLBox.cpp b/pgadmin/ctl/ctlSQLBox.cpp index a45bb5e..0f8bdb2 100644 --- a/pgadmin/ctl/ctlSQLBox.cpp +++ b/pgadmin/ctl/ctlSQLBox.cpp @@ -796,7 +796,7 @@ void ctlSQLBox::OnPositionStc(wxStyledTextEvent &event) } // Roll back through the doc and highlight any unmatched braces - while ((pos--) >= 0) + while ((pos--) >= PositionFromPoint(wxPoint(0, 0))) { ch = GetCharAt(pos); st = GetStyleAt(pos); diff --git a/pgadmin/frm/frmQuery.cpp b/pgadmin/frm/frmQuery.cpp index 067b2d5..cc3056e 100644 --- a/pgadmin/frm/frmQuery.cpp +++ b/pgadmin/frm/frmQuery.cpp @@ -1435,6 +1435,13 @@ bool frmQuery::relatesToWindow(wxWindow *which, wxWindow *related) void frmQuery::updateMenu(bool allowUpdateModelSize) { + // This function can get called a lot, and getting settings is expensive + static wxString favouritesFile; + if (favouritesFile.IsEmpty()) + { + favouritesFile = settings->GetFavouritesFile(); + } + bool canCut = false; bool canCopy = false; bool canPaste = false; @@ -1480,8 +1487,8 @@ void frmQuery::updateMenu(bool allowUpdateModelSize) canRedo = sqlQuery->CanRedo(); canPaste = sqlQuery->CanPaste(); canFind = true; - canAddFavourite = (sqlQuery->GetLength() > 0) && (settings->GetFavouritesFile().Length() > 0); - canManageFavourite = (settings->GetFavouritesFile().Length() > 0); + canAddFavourite = (sqlQuery->GetLength() > 0) && (favouritesFile.Length() > 0); + canManageFavourite = (favouritesFile.Length() > 0); } else if (relatesToWindow(wnd, scratchPad)) {