Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#17807 closed defect (fixed)

Incorrectly named constant values in wxSTC from upgrade to Scintilla 3.7.2

Reported by: NewPagodi Owned by: Artur Wieczorek <artwik@…>
Priority: normal Milestone:
Component: wxStyledText Version: dev-latest
Keywords: Cc:
Blocked By: Blocking:
Patch: yes

Description

Sorry about creating so many stc tickets lately, but while working on #17680, I noticed I missed one thing that should have been in #17705 (Upgrade Scintilla 3.7.2) and it's probably important that this be fixed as soon as possible.

When a Scintilla enum starts with 'SCXX_' instead of the 'SC_', the convention used in STC, is (usually) to cut off the 'SC' and just use the 'XX' part. I missed this with the new TabDrawMode enum which is used for setting how the tab character gets drawn. So 2 constants that should have been named wxSTC_TD_LONGARROW and wxSTC_TD_STRIKEOUT were instead named wxSTC_SCTD_LONGARROW and wxSTC_SCTD_STRIKEOUT.

This patch

  • makes 1 change to gen_iface.py to fix the naming
  • and adds a note to README.txt telling future upgraders to check that from now on.

Sorry! There's a lot of things to check when upgrading and I missed one.


I said "usually" above because this has happened twice before with with the KeyMod enum (so for example wxSTC_SCMOD_NORM should have been wxSTC_MOD_NORM) and with VirtualSpace enum (so for example wxSTC_SCVS_USERACCESSIBLE should have been wxSTC_VS_USERACCESSIBLE).

Should we fix those? It's much too late to just change the names without potentially breaking code, but maybe we do something like manually declare constants as they exist now in stc.h.in but also set gen_iface.py to generate the constants named consistently like all the other enum values in the iface file.

Attachments (1)

fixforstc372.patch download (2.0 KB) - added by NewPagodi 3 years ago.

Download all attachments as: .zip

Change History (3)

Changed 3 years ago by NewPagodi

comment:1 Changed 3 years ago by Artur Wieczorek <artwik@…>

  • Owner set to Artur Wieczorek <artwik@…>
  • Resolution set to fixed
  • Status changed from new to closed

In 98720ee7a45edab821a4175a54d8a4dd2494e7db/git-wxWidgets:

Fix names of newly introduced wxSTC constants

In 68888ca0a2d53772122dd452958e14cf270431a1 there were introduced new wxSTC constants representing Scintilla SCTD_* parameters. Unfortunately, their names don't conform to naming convention of other constants and therefore should be changed. For the sake of consistency, Scintilla SCTD_* names should be mapped to wxSTC_TD_* ones.

Closes #17807.

comment:2 in reply to: ↑ description Changed 3 years ago by awi

I said "usually" above because this has happened twice before with with the KeyMod enum (so for example wxSTC_SCMOD_NORM should have been wxSTC_MOD_NORM) and with VirtualSpace enum (so for example wxSTC_SCVS_USERACCESSIBLE should have been wxSTC_VS_USERACCESSIBLE).

Should we fix those? It's much too late to just change the names without potentially breaking code, but maybe we do something like manually declare constants as they exist now in stc.h.in but also set gen_iface.py to generate the constants named consistently like all the other enum values in the iface file.

I think, legacy constants with non-conformant names should be left in the header (commented as deprecated), but they shouldn't be referred in the documentation. As you proposed, constants with "right" names should be generated automatically, by the script.

Note: See TracTickets for help on using tickets.