I had a script with n variable, wanted to switch to TOTAL Open replace window type n choose Whole word only
It will get '\n' too and IMHO I think it should SKIP new lines, because if Geany replace them, the text would be destroyed.
Closed #3875 as completed.
I wonder if this could be too specific? Maybe there are cases where it is legitimite to treat the 'n' in '\n' as whole word if the context does not know about escape sequences.
The behavior can be changed by adding '\' to the `wordchars` settings in `filetypes.common` and the filetype definition files for the various filetypes. For details, see https://geany.org/manual/#filetype-configuration.
To add to @eht16 comment, search replace does not understand the context of what it is editing, it does not see a programming language string in which `\n` means newline, it just sees text characters `` and `n`.
Agreed, whether `\n` in the file represents something specific or a `` followed by an `n` is kind of out of scope. One (imperfect) solution is a more complex regex, e.g. `((?<=[^\])|^)n` -- but note that this "simple" version won't handle `\n` correctly.
github-comments@lists.geany.org