Last Call for 2.3 Translations

I intend to release Programmer’s Notepad 2.3 as the new stable release towards the end of this week. One late bug fix has added a new string, so all translations need at least this one minor update. Some haven’t been updated in a while, so need a larger update.

Currently 2.3 will ship with the following languages in the installer/portable package:

  • Simplified-Chinese

  • British English

  • Hungarian

  • Romanian

  • German

  • Russian

  • Spanish

All translation files are stored in the Programmer’s Notepad Translations project, using a Mercurial repository.

My thanks to those who have already contributed to the translations in the 2.3 release!

Help Wanted Want to help with updating any of these, or perhaps adding a new language? Follow the steps in the Translating Programmer’s Notepad guide on the docs wiki.

I’m also looking for someone who’d like to contribute to PN by looking after the translations, doing something like the following:

  • Keep a mailing list going for translators to ask questions/be notified of updates

  • Publish the status of translations (i.e. identify those that need work)

  • Update the translation kit and instructions as required

  • Help with the translation issues on the tracker

  • Help to keep the translations project up to date (not everyone can use Mercurial)

If you’re interested, send me a mail (s.steele at this domain) or get in touch via the forums/issue tracker.

Thanks to Glyssec

Just wanted to say a quick word of thanks to Tara from Glyssec who reported a SQL Injection vulnerability in some scripts on pnotepad.org earlier this year. My thanks for making a responsible disclosure on discovering the problem, it’s appreciated!

Regular Expressions and Scripts - Worked Example

Programmer’s Notepad has great support for Regular Expressions baked in, supporting much more than the restricted syntax that many Scintilla-based editors provide. For example, did you know that you can use negative lookarounds to find text that doesn’t contain a pattern? This regular expression matches any line that doesn’t contain “not here”:

^((?!not here).)*$

Sometimes I find myself repeating the same set of Search/Replace operations in order to format text. If I’m going to do this more than a couple of times, I record a script using PyPN to make things easier for myself. Today I was turning text like this:

[sourcecode language=”java”] LogStep(“Do something”); MyClass.DoReallyCleverStuff(); MyClass.VerifySomethingAwesome();

LogStep("Do another thing");
MyClass.DoSomethingLessClever();
MyClass.VerifySomethingBad(); [/sourcecode]

Into text like this:

Do something Do another thing

There are many ways to do something like this, and I could have written a PyPN script by hand to do it. However, combining Regular Expressions and Script Recording means I can do this without a lot of manual code effort. Here’s what I did:

  1. Tools > Record Script

  2. Replace All: ^((?!LogStep).)*$ with (nothing)

  3. Replace All: (\r\n){2,} with \r\n

  4. Replace All: \s*LogStep\("([^"]+)"\); with \1

  5. Tools > Stop Recording

At the end of this Programmer’s Notepad added a script to the Scripts window (Recorded\New Script) and placed the code for that script in a new editor window. Because I wanted to keep the script for future use, I changed it’s name and saved it to C:\Program Files\Programmer’s Notepad\Scripts. Here’s the script (which I reduced slightly for posting here):

[sourcecode language=”python”] import pn, scintilla

@script(“Clean Up Log Steps”, “Testing”) def CleanUpLogSteps(): doc = pn.CurrentDoc() sci = scintilla.Scintilla(doc) opt = pn.GetUserSearchOptions() opt.FindText = u’^((?!LogStep).)*$’ opt.MatchWholeWord = False opt.MatchCase = False opt.UseRegExp = True opt.SearchBackwards = False opt.LoopOK = True opt.UseSlashes = False opt.ReplaceText = u’’ opt.ReplaceInSelection = False doc.ReplaceAll(opt) # When recording, the result of this operation was: pn.FindNextResult(37)

opt.FindText = u'(\\r\\n\\r\\n){2,}'
opt.ReplaceText = u'\\r\\n'
doc.ReplaceAll(opt)
# When recording, the result of this operation was: pn.FindNextResult(16)

opt.FindText = u'\\s*LogStep\\("([^"]+)"\\);'
opt.ReplaceText = u'\\1'
doc.ReplaceAll(opt)
# When recording, the result of this operation was: pn.FindNextResult(10) [/sourcecode]

If I was going to use this script a lot, I could bind it to a shortcut key in Tools > Options > Keyboard.

Programmer's Notepad 2.3 RC Released

I’m happy to announce a new testing release, Programmer’s Notepad 2.3 RC, has been released to the Google Code page. This version includes a bunch of bug fixes, some minor changes and various changes under the hood.

Changes of interest in 2.3:

  1. Jump dialog now filters results as you type.

  2. Custom scheme is now implemented as a PN extension.

  3. Double-click on tab bar (not on tab) starts a new doc.

  4. 3 types of block comment supported in custom schemes (schemedef).

  5. Tags only auto-closed in the correct state in HTML/XML, hr br and img not auto-closed.

  6. Miscellaneous updates to schemes to improve highlighting (including HTML5 elements and attributes).

  7. RTF export reworked, background colours now working better.

  8. Properties scheme folding.

  9. Crash issues with split views fixed.

  10. Chinese Windows XP menu issues fixed.

  11. Portable edition translations issues fixed.

  12. Some autocomplete fixes

Downloads: Download 2.3 RC Installer Download 2.3 RC Portable Download 2.3 RC Multi-Language

You may also like to add the following updated extensions to your 2.3 RC install:

PyPN to get support for scripting/macros with Python: PyPN 1.0 RC TextUtil for miscellaneous extra text helpers: TextUtil 0.2

Thanks to all contributors, translators and testers for their help with this release.

p.s. this release has been available for a while, I just haven’t had time to write it up. A new family member has been keeping me very busy!

Updated Pascal Scheme for 2.2

Some large changes in the Pascal lexer that comes with Scintilla caused the Pascal support in version 2.2 to be, well, pretty broken. I’ve just fixed up a Scheme that works with the new lexer, and you can download it here:

Download Updated Pascal Scheme

Instructions:

  1. Download Pascal.scheme file

  2. Copy Pascal.scheme to PN\Schemes directory, overwriting existing file

  3. Restart Programmer’s Notepad