Skip to content

[BUG] SQL Backslash Escape pref not correct at startup #16249

@pryrt

Description

@pryrt

Is there an existing issue for this?

  • I have searched the existing issues

Description of the Issue

There was an unnoticed regression in v8.7 (that has persisted even through v8.7.8-RC2) compared to v8.6.9. When v8.7 or newer first loads, no matter what the saved setting was for Settings > Preferences > Language > Treat Backslash as escape character for SQL, when you start Notepad++, it will syntax highlight as if backslash is the escape, but the preference shows no checkmark.

This is slightly different than #16244, thought it was spawned from the same Community Forum conversation. And my Steps to Reproduce in that other issue had to gloss over the fact that it wasn't in the right mode at startup {see step 3 in that issue's StR} because I didn't want to clutter that issue with this.

To be clear, this was a change in behavior between v8.6.9 and v8.7, where it no longer works correctly -- the preference checkbox always shows up as unchecked when you restart Notepad++, but it will render as if the checkbox is checkmarked.

Steps To Reproduce

create the escape.sql file:

select 'ABCDE' from dual where 1=1;
select 'AB\CDE' from dual where 1=1;
select 'ABCDE\' from dual where 1=1;
select 'ABCDE' from dual where 1=1;
select 'AB\CDE' from dual where 1=1;
  1. Fresh portable unzip of v8.7 (or newer), delete config.xml , and open escape.sql ⇒ Rendering proves it defaults to treating \ as escape
  2. Check Settings > Preferences > Language > Treat Backslash as escape character for SQL ⇒ is not checkmarked, even though the behavior obviously shows it is treating it as escape ⇒ this is the BUG
  3. Toggle the option on.
  4. Ctrl+W then Ctrl+Shift+T to reload/re-render the file ⇒ no change in rendering
  5. Toggle the option off
  6. Ctrl+W then Ctrl+Shift+T to reload/re-render the file ⇒ now the rendering changes and matches the preference, so it is now treating \ as normal character, like it should.
  7. Exit Notepad++ (it should save the preference state)
  8. Relaunch Notepad++ with the same file ⇒ now it has the right state when launched.
  9. Turn the option back on.
  10. Ctrl+W then Ctrl+Shift+T to reload/re-render the file ⇒ the rendering changes and matches the preference to treat \ as escape
  11. Exit Notepad++ (it should save the preference state)
  12. Relaunch Notepad++ with the same file ⇒ it's treating \ as escape
  13. Check Settings > Preferences > Language > Treat Backslash… and notice that like in step 2, it’s showing as unchecked, even though the preference state was saved as checked, and it’s behaving as if it’s checked

screenshots to show how to interpret the two different renderings that the preference should toggle between:

state screenshot desc
\ is escape char Image \' will not end the string, so the string continues beyond line 3
\ is normal char Image \' will end the string, so the string ends before the from on line 3

(The close and re-open in steps 4, 6, and 10 are required because of the long-standing bug described in #16244)

Current Behavior

There is a mismatch between the syntax highlighting of the SQL and the preference checkmark state when Notepad++ is started, and the checkmark doesn't persist to the next time Notepad++ is run.

Expected Behavior

The SQL escape preference when Notepad++ is exited normally should persist to both the checkbox and the actual syntax highlighting when Notepad++ is run the next time.

if you want the exact steps, with the slightly modified results, for when it worked right in v8.6.9:

  1. Fresh portable unzip of v8.6.9, delete config.xml , and open escape.sql ⇒ Defaults to treating \ as escape
  2. Check Settings > Preferences > Language > Treat Backslash as escape character for SQL ⇒ it is checkmarked by default ⇒ this is the expected/good behavior, because the syntax highlighting matches the preference state
  3. Toggle that option off
  4. Ctrl+W then Ctrl+Shift+T to reload/re-render the file
  5. Now it’s treating \ as normal character
  6. With the option off, exit Notepad++, and restart Notepad++, opening the same file
  7. This time, it renders \ as normal character, and Settings > Preferences > Language > Treat Backslash… is not checkmarked, as expected ⇒ this is the expected/good behavior, because the syntax highlighting matches the setting

Debug Information

Notepad++ v8.6.9   (64-bit)
Build time : Jul 12 2024 - 05:09:25
Path : C:\usr\local\apps\npp\npp.8.6.9.portable.x64\notepad++.exe
Command Line : escape.sql
Admin mode : OFF
Local Conf mode : ON
Cloud Config : OFF
Periodic Backup : ON
OS Name : Windows 11 Home (64-bit)
OS Version : 24H2
OS Build : 26100.3194
Current ANSI codepage : 1252
Plugins : 
    mimeTools (3.1)
    NppConverter (4.6)
    NppExport (0.4)

=====

Notepad++ v8.7   (64-bit)
Build time : Sep 17 2024 - 17:06:31
Path : C:\usr\local\apps\npp\npp.8.7.portable.x64\notepad++.exe
Command Line : escape.sql
Admin mode : OFF
Local Conf mode : ON
Cloud Config : OFF
Periodic Backup : ON
OS Name : Windows 11 Home (64-bit)
OS Version : 24H2
OS Build : 26100.3194
Current ANSI codepage : 1252
Plugins : 
    mimeTools (3.1)
    NppConverter (4.6)
    NppExport (0.4)

Anything else?

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions