fix: code folding was not restored when loading projects or opening/importing patterns

This commit is contained in:
paxcut
2026-01-28 08:04:35 -07:00
committed by paxcut
parent 219f588cbe
commit 77eff651ed
8 changed files with 72 additions and 90 deletions

View File

@@ -23,7 +23,7 @@ namespace hex::plugin::builtin {
std::string& get(prv::Provider *provider);
[[nodiscard]] bool hasProviderSpecificSource(prv::Provider *provider) const;
bool isSynced() const;
[[nodiscard]] bool isSynced() const;
void enableSync(bool enabled);
private:
@@ -41,18 +41,9 @@ namespace hex::plugin::builtin {
void drawAlwaysVisibleContent() override;
std::unique_ptr<pl::PatternLanguage> *getPatternLanguage() { return &m_editorRuntime; }
ui::TextEditor *getTextEditor();
u32 getRunningParsers () const { return m_runningParsers;}
u32 getRunningEvaluators () const { return m_runningEvaluators;}
u32 getRunningHighlighters () const { return m_runningHighlighters;}
void incrementRunningParsers( i32 amount) { m_runningParsers += amount; }
void incrementRunningEvaluators( i32 amount) { m_runningEvaluators += amount; }
void incrementRunningHighlighters( i32 amount) { m_runningHighlighters += amount; }
bool hasUnevaluatedChanges(prv::Provider *provider) const;
void setChangesWereParsed(bool changesWereParsed) { m_changesWereParsed = changesWereParsed;}
void setChangesWereColored(bool changesWereColored) { m_changesWereColored = changesWereColored; }
void drawContent() override;
void setPopupWindowHeight(u32 height) { m_popupWindowHeight = height; }
u32 getPopupWindowHeight() const { return m_popupWindowHeight; }
enum class DangerousFunctionPerms : u8 { Ask, Allow, Deny };
void drawHelpText() override;
@@ -64,14 +55,14 @@ namespace hex::plugin::builtin {
class PopupAcceptPattern;
struct PatternVariable {
bool inVariable;
bool outVariable;
bool inVariable{};
bool outVariable{};
pl::core::Token::ValueType type;
pl::core::Token::ValueType type{};
pl::core::Token::Literal value;
};
enum class EnvVarType
enum class EnvVarType : u8
{
Integer,
Float,
@@ -137,15 +128,8 @@ namespace hex::plugin::builtin {
std::mutex m_logMutex;
PerProvider<ui::TextEditor::Coordinates> m_cursorPosition;
PerProvider<ImVec2> m_scroll;
PerProvider<ImVec2> m_consoleScroll;
PerProvider<ui::TextEditor::CodeFoldState> m_codeFoldState;
PerProvider<ui::TextEditor::Coordinates> m_consoleCursorPosition;
PerProvider<ui::TextEditor::Range> m_selection;
PerProvider<ui::TextEditor::Range> m_consoleSelection;
PerProvider<size_t> m_consoleLongestLineLength;
PerProvider<ui::TextEditor::Breakpoints> m_breakpoints;
PerProvider<std::optional<pl::core::err::PatternLanguageError>> m_lastEvaluationError;
PerProvider<std::vector<pl::core::err::CompileError>> m_lastCompileError;
PerProvider<const std::vector<pl::core::Evaluator::StackTrace>*> m_callStack;
@@ -168,7 +152,6 @@ namespace hex::plugin::builtin {
ContentRegistry::Settings::SettingsVariable<bool, "hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.pattern_parent_highlighting"> m_parentHighlightingEnabled = false; bool m_replaceMode = false;
bool m_openFindReplacePopUp = false;
bool m_openGotoLinePopUp = false;
bool m_patternEvaluating = false;
std::map<std::fs::path, std::string> m_patternNames;
PerProvider<wolv::io::ChangeTracker> m_changeTracker;
PerProvider<bool> m_ignoreNextChangeEvent;