A recent commit broke the pattern editor popups for fin/replace and goto
line. The problem was cause by changes to the function that returns the
name of the currently focused subwindow using a function that only
updates when ImHex main window losses focus. The commit was aimed at
fixing evaluation of shortcuts in pattern data view and pattern editor
simultaneously but missed to fix some shortcuts like cut and paste.
The fix substitutes how the subwindow is first selected by using the
result of the subwindow selection used by imhex to insure that menus and
other ui components don't steal focus from views. The function that
returns the name of the current focused subwindow was changed to use
this value. This fixes both the window popups of pattern editor and all
the shortcut duplications.
When a project is loaded it is set to dirty without any changes so that
it goes through the steps that patterns with changes go through. The fix
uses a different starting step that doesn't set the dirty flags when
changing providers or loading projects.
<!--
Please provide as much information as possible about what your PR aims
to do.
PRs with no description will most likely be closed until more
information is provided.
If you're planing on changing fundamental behaviour or add big new
features, please open a GitHub Issue first before starting to work on
it.
If it's not something big and you still want to contact us about it,
feel free to do so !
-->
### Problem description
<!-- Describe the bug that you fixed/feature request that you
implemented, or link to an existing issue describing it -->
Hopefully this will help us debug the bugs that appear once ImHex
restarts a little easier.
### Screenshots
<!-- If your change is visual, take a screenshot showing it. Ideally,
make before/after sceenshots -->
<img width="372" height="182" alt="image"
src="https://github.com/user-attachments/assets/1f27443e-9eaa-465a-b545-c2bbf0b56ca4"
/>
``` rust
struct Rec : Rec {
};
```
Prevent infinite recursion in appendInheritances by erasing processed
inheritance entries during traversal, and safely iterate over
m_inheritances in appendInheritances to avoid
modification-during-iteration issues.
Co-authored-by: paxcut <53811119+paxcut@users.noreply.github.com>
The assumption that the number of lines of colors will be equal to the
number of lines in the input signal is incorrect. As issue #2594 shows,
erroneous input can cause the lexer to end processing the input file
prematurely thus being unable to create tokens past the line where the
error occurred which in turn implies that no colors can be found beyond
those lines.
To fix the crash (the underlying problem is user caused and can't be
fixed) is to use the size of the vectors containing the first token
index of each line since that size must be equal to the number of lines
stored in token sequence.
Fixes#2594
By creating copies of the required inputs on the main thread just before
the task is spawned. A;so if task is still running when new data can be
copied then the task is interrupted thus avoiding concurrency without
mutexes. Atomics are used to signal state information used to determine
what and when to spawn.
Also includes update to pattern editor library and some fixes to syntax
highlighting error when custom types defined inside namespaces were used
inside the namespaces without the full qualified name and other small
changes mostly to improve the current style.