Now it properly fails if libmagic is not installed in the system.
The error message would look like:
```
CMake Error at cmake/modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find Magic (missing: LIBMAGIC_LIBRARY LIBMAGIC_INCLUDE_DIR)
(Required is at least version "5.39")
Call Stack (most recent call first):
cmake/modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
cmake/modules/FindMagic.cmake:5 (find_package_handle_standard_args)
cmake/build_helpers.cmake:971 (find_package)
CMakeLists.txt:81 (addBundledLibraries)
```
### Problem description
The current `FindMagic.cmake` module doesn't properly report failure
about absent libmagic libs and #includes. This behavior leads to the
compile errors on the build stage (possibly after some time, which will
be simply wasted). This Find module should set the `Magic_FOUND`
variable and handle all required variables( LIBMAGIC_INCLUDE_DIR and
LIBMAGIC_LIBRARY) to present.
But the current module sets the `libmagic_FOUND` variable, so the CMake
assumes that it is found something. This behaviour should also be
handled by `find_package_handle_standard_args()` ("FPHSA"), and it is
actually handled, but as we requested the `Magic` package to be
required, the former function ("FPHSA") didn't stop the configure
process.
### Implementation description
- Clean up the unused ifs, as "FPHSA" already done it better.
- Use the proper name for "FPHSA" so it could set the proper
`Magic_FOUND` and could make sure that the requested package is
`REQUIRED`.
### Screenshots
Before:
```
-- Could NOT find libmagic (missing: LIBMAGIC_LIBRARY LIBMAGIC_INCLUDE_DIR)
```
<img width="1005" height="24" alt="изображение"
src="https://github.com/user-attachments/assets/082e2842-ff94-4418-8f86-86021c7dd23d"
/>
After:
```
CMake Error at cmake/modules/FindPackageHandleStandardArgs.cmake:230 (message):
Could NOT find Magic (missing: LIBMAGIC_LIBRARY LIBMAGIC_INCLUDE_DIR)
(Required is at least version "5.39")
Call Stack (most recent call first):
cmake/modules/FindPackageHandleStandardArgs.cmake:600 (_FPHSA_FAILURE_MESSAGE)
cmake/modules/FindMagic.cmake:5 (find_package_handle_standard_args)
cmake/build_helpers.cmake:971 (find_package)
CMakeLists.txt:81 (addBundledLibraries)
```
### Additional things
Closes#2244 .
``` 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