A user complained that they imported a file by accident when they meant
to export it and as a result had trouble recovering the changes they
were trying to save. Auto-save saved the day but there is no reason for
not being able to undo changes after importing a pattern.
In fact, the previous implementation treated importing a pattern as a
reset on the editor instance which actually erased all previous undo
entries. Importing now is treated as a normal editing operation where
the entire file is replaced with the imported pattern.
Since all imports use AddText it was easy to add an undo entry to that
function while removing the part where the previous undo records were
being deleted.
Care is taken to add the preprocessed version of the imported file to
the undo buffer so that unwanted chars don't sneak in. A bug was found
in the handling of a tab char as well but hopefully it wont need to be
used anymore.
This change is to fix a bug reported in discord by berkus and Naheulf
about the console missing output lines. The bug was caused by using
SetText which replaces the existing text with the text in the argument.
To fix it use InsertText which puts the text at the current cursor
position that was already set to the end of the current contents.
Code was tested with pattern used to reproduce the bug and seemed to
work when evaluated repeatedly.
'Boost::regex' could not be found unless regex is specified explicitly
on some systems.
cf. https://github.com/AOSC-Dev/aosc-os-abbs/pull/9798
cc. @chenx97
### Problem description
> Target "libimhex" links to: Boost::regex but the target was not found.
when building ImHex with system Boost.
### Implementation description
Add `COMPONENETS regex` to require regex library explicitly.
Signed-off-by: xtex <xtex@aosc.io>
Co-authored-by: Henry Chen <chenx97@aosc.io>