…attern selection popup when pattern is already open
This PR does two things. Most importantly, it fixes a segfault that can
be caused by opening a recent file with pattern sync enabled.
Secondly, it makes it so that the pattern selection popup does not
appear if you already have text in the pattern editor for a given
provider (due to CLI args, a project file, pattern sync, etc.). If you
open a file normally, that text field is empty and the popup will appear
so you can select a pre-made pattern like usual.
Added the ui namespace and broke the main rendering function into a set
of smaller functions. Reorganized the header code separating functions
into rough groups that eventually will be in separate files.
Also fixes two bugs:
1) error messages not staying visible
2) uncaught exception when struct name is duplicated.
A lot of the code using coordinates for start and end has been moved to
use Selections instead. Created more string manipulation code that uses
utf8 indices aka Coordinates directly. This makes implementing editing
functions easier by not having to go back and forth from string indices
to char indices and back. Currently, the substring, erase and []
operator support coordinates and str indices.
The error was caused when the search for the closing delimiter extended
past the last token in the sequence, which happened because the initial
increments before the loop starts were not being accounted for in the
loop ending condition. This was fixed by decrementing the limit of
possible steps to account for the initial steps taken.
The problem was that imported files didn't have token sequences to
obtain the UDT variables. The fix was to create maps from the file name
to the token sequence and then process each imported file to obtain all
the variables needed. Function variables are skipped since they can be
part of the code.
There are also some minor code style corrections and a fix in the text
editor where the last line of a selection was not being deleted.
Users can now synchronize the content of the pattern editor with a file
on disk when exporting a pattern. Any modifications made in the pattern
editor are automatically saved to the file and when the pattern editor
gains focus it will automatically load any changes to the file on disk.
This feature is brand new and can have unforeseen problems so test it
fully before risking losing work.
Added major changes to how the text editor handles utf8 characters with
the added ability to obtain them using the [] operator and column
coordinates as indices. Sanitize coordinates was renamed to Set
Coordinates and can be used instead of the constructor to guarantee no
out of range asserts and/or exceptions. Improved move left and right
readability and cursor accuracy when clicking. Fixed single character
selection by double-clicking it. Deleted old and unused code and other
changes that I can't remember about atm.
These changes are part of an effort aimed at removing tabs from ImHex
that started some time ago. Here text preprocessing is removed from all
the places were it was done before and moved to the places where files
are read that go in the pattern editor with two notable exceptions.
1) Pattern import reads patterns in order to present a list that can be
filtered.That can safely ignore preprocessing since only needs to get
information needed to filter.
2) The pattern editor can incorporate text from the clipboard so that
needs to be preprocessed as well.
find/replace is unable to add tabs or carriage returns so this should
cover all angles.
allows the ability to assign colors to global placed and non-placed
variables, pattern, local and calculated pointer variables, template
arguments, function variables and arguments, etc etc etc. It
accomplishes this using the parser and the token sequence generated by
the lexer. It still uses the original colorizing code but the underlying
data holding the pattern has been updated to be easier to use and to
debug. The changes are too numerous to cite here.It is a big but
necessary step to bring the pattern editor to a somewhat useful state.
There may be one commit in the pattern language repo needed to be able
to run this code