Skip to content

[BUG] SQL Backslash Escape pref doesn't work immediately #16244

@pryrt

Description

@pryrt

Is there an existing issue for this?

  • I have searched the existing issues

Description of the Issue

When you toggle Settings > Preferences > Language > Treat Backslash as escape character for SQL, since the UI doesn't say otherwise, the general expectation is that it will take immediate effect. It does not. (update: This was revealed by @alankilborn in this Community post, which is what prompted this bug report.)

The actual behavior depends on version (see StR)

Steps To Reproduce

using the file escape.sql:

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;

older behavior

  1. Start with fresh portable v8.7.5 or earlier, and open license.txt
  2. open escape.sql and ensure it's in the normal Language > S > SQL
  3. set Settings > Preferences > Language > Treat Backslash ... to be checkmarked (if it's not already)
  4. switch to license.txt and back to escape.sql and confirm that \ is being treated as escape (the string on line 3 doesn't end)
    Image
  5. uncheck Treat Backslash... option
    • Expectation: SQL should re-render, either immediately or when preferences are closed, with the string on ending because \ is no longer an escape
    • Reality: SQL doesn't re-render yet, so the string continues beyond that line
  6. Switch to license.txt and back to escape.sql:
    • Reality: now the SQL re-renders, so the string ends on line 3:
      Image

newer behavior

  1. Start with fresh portable v8.7.5 or earlier, and open license.txt
  2. open escape.sql and ensure it's in the normal Language > S > SQL
  3. set Settings > Preferences > Language > Treat Backslash ... to be checkmarked (if it's not already)
  4. switch to license.txt and back to escape.sql and confirm that \ is being treated as escape (the string on line 3 doesn't end)
    Image
  5. uncheck Treat Backslash... option
    • Expectation: SQL should re-render, either immediately or when preferences are closed, with the string on ending because \ is no longer an escape
    • Reality: SQL doesn't re-render yet, so the string continues beyond that line
  6. Switch to license.txt and back to escape.sql:
    • Expectation: SQL should re-render
    • Reality: SQL still doesn't re-render
  7. Close escape.sql and use Ctrl+Shift+T or equivalent to re-open
    • Behavior: SQL finally shows the string ending on line 3
      Image

Current Behavior

In v8.7.5 and earlier, after you toggle the preference, you must switch away from the SQL file tab to something else, and then back, to see the preference change take effect.

In v8.7.6 and newer, after you toggle the preference, you must close the SQL file and re-open it to see the preference change take effect

Expected Behavior

You should be able to immediately see the rendering of SQL change immediately when you toggle the preference on or off.

Debug Information

Notepad++ v8.7.5   (64-bit)
Build time : Dec 21 2024 - 05:13:03
Path : C:\usr\local\apps\npp\npp.8.7.5.portable.x64\notepad++.exe
Command Line : escape.sql
Admin mode : OFF
Local Conf mode : ON
Cloud Config : OFF
Periodic Backup : ON
Placeholders : OFF
DirectWrite : ON
Multi-instance Mode : monoInst
File Status Auto-Detection : cdEnabledNew (for current file/tab only)
Dark Mode : OFF
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.6   (64-bit)
Build time : Jan 24 2025 - 08:27:33
Path : C:\usr\local\apps\npp\npp.8.7.6.portable.x64\notepad++.exe
Command Line : escape.sql
Admin mode : OFF
Local Conf mode : ON
Cloud Config : OFF
Periodic Backup : ON
Placeholders : OFF
DirectWrite : ON
Multi-instance Mode : monoInst
File Status Auto-Detection : cdEnabledNew (for current file/tab only)
Dark Mode : OFF
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.8   (64-bit)
Build time : Feb 27 2025 - 21:10:34
Path : C:\usr\local\apps\npp\npp.8.7.8-RC2.portable.x64\notepad++.exe
Command Line : escape.sql
Admin mode : OFF
Local Conf mode : ON
Cloud Config : OFF
Periodic Backup : ON
Placeholders : OFF
Scintilla Rendering Mode : SC_TECHNOLOGY_DIRECTWRITE (1)
Multi-instance Mode : monoInst
File Status Auto-Detection : cdEnabledNew (for current file/tab only)
Dark Mode : OFF
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?

raw lexilla behavior
If I use PythonScript plugin to set the lexilla property ( editor.setProperty('sql.backslash.escapes', '0') or editor.setProperty('sql.backslash.escapes', '1') ), it immediately toggles the rendering, so the problem is not on the lexilla side of things.

Metadata

Metadata

Assignees

No one assigned

    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