Skip to content

Commit

Permalink
Fix regression causing older versions of NotePad++ to crash (#13382)
Browse files Browse the repository at this point in the history
Fixes regression caused by #13364
Closes #13397

Summary of the issue:
The version matching to apply the new NP++ 8.3+ behavior was incorrect, as it doesn't work for versions like 8.2.1 and 8.1.9.2.

Description of how this pull request fixes the issue:
Only match against the first character of the minor version.

Testing strategy:
Tested on version 8.1.9.2, 8.2.1, 8.3 and 8.3.1 of NP++
  • Loading branch information
LeonarddeR committed Feb 28, 2022
1 parent 618bfb6 commit 4c3a67b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion source/appModules/notepadPlusPlus.py
Expand Up @@ -46,7 +46,12 @@ class NppEdit(ScintillaBase.Scintilla):
def _get_TextInfo(self):
if self.appModule.is64BitProcess:
appVerMajor, appVerMinor, *__ = self.appModule.productVersion.split(".")
if int(appVerMajor) >= 8 and int(appVerMinor) >= 3:
# When retrieving the version, Notepad++ concatenates
# minor, patch, build in major.minor.patch.build to the form of major.minor
# https://github.com/notepad-plus-plus/npp-usermanual/blob/master/content/docs/plugin-communication.md#nppm_getnppversion
# e.g. '8.3' for '8.3', '8.21' for '8.2.1' and '8.192' for '8.1.9.2'.
# Therefore, only use the first digit of the minor version to match against version 8.3 or later.
if int(appVerMajor) >= 8 and int(appVerMinor[0]) >= 3:
return ScintillaTextInfoNpp83
return super().TextInfo

Expand Down

0 comments on commit 4c3a67b

Please sign in to comment.