There is no point in runner.sh depending on the generated Geany
executable, and this breaks running `make distcheck` before building
the sources, as the Geany executable doesn't exist yet.
When quitting, we still have to destroy the Scintilla widget to avoid
any possibility for us to receive signals from it after we destroyed
the associated editor and/or document (used in signal handlers).
I myself don't suffer from the issue, but it is theoretically possible
for Scintilla to emit signals anytime before it is destroyed, so it is
safer like this anyway. And an user on IRC suffered from crashes on
quit because of this issue, so it seems to actually happen in some
situations.
On Windows we need to change the working directory on startup to not
lock the directory Geany was started from (bug #2626124).
However we can't change the directory to late in the startup process
otherwise plugins maybe unable to load resources from the installation
directory.
Though we also can't change it too early otherwise opening files given
with relative paths in Geany from the command line won't work anymore
(bug #3613096).
This change should fix both issues by changing the working directory after
command line file handling happened and before plugins will be loaded.
Fix the bounds checking on included styles only to check for inclusion
actually defined styles, not to include random styles based on
uninitialized array indices.
A faulty bound checking resulted in reading a byte past the document
end, which resulted in Scintilla returning byte 0 because the position
was invalid. By adding this NUL byte to the string used to build the
body, the body was truncated after the last document byte (as C strings
are NUL-terminated), leading to any format structure after it to be
missing from the output.
This broke HTML and LaTeX export if the last line didn't end with a
newline, as the last line's style closing structure were missing.
We used to assume that if the selected text started with "0x" when
inserting a color, we had to replace exactly 6 bytes after the "0x"
prefix. Although this is generally the case as most color formats use
6 hexadecimal digits, it still would erase either too many or too few
characters if actually replacing something shorter (i.e. "0xfff") or
longer (i.e. "0xffffffffffff").
It could even partially override multi-byte characters if the 8th byte
after the selection start was in the middle of a character, as the
length was in bytes and not characters.
Fix this by honoring the actual selection end.