TextWrangler 2.1 Release Notes

TextWrangler 2.1 is an update to TextWrangler 2.0 which includes numerous new features and enhancements, as well as fixes for various reported issues.

This page documents all feature enhancements and bug fixes included in the TextWrangler 2.1 release. For details on changes made in previous versions, please see the release notes archive. For complete information on TextWrangler’s features, please refer to the included PDF user manual, which you can access by choosing “TextWrangler User Manual” from the Help menu.

Requirements

NOTE: Keystrokes are no longer stored directly in the files themselves (among other reasons, because all users don’t have write access to the local domain files.) Existing keystrokes in files themselves are ignored – you’ll have to set your keystrokes once after upgrading to this version.

Additions

The following features and enhancements are new for TextWrangler 2.1:

open aFileList opening in <value>

As in previous releases, <value> may be a reference to an existing text window. New for this release, value may be one of: front_window, new_window, or separate_windows, which overrides whatever your document opening behavior is and does the following:

front_window

Files in aFileList are opened in the front text window (if it does not exist, a new one will be created).

new_window

A new text window will be created and all files in aFileList will be opened into it.

separate_windows

Each file in aFileList is opened into its own text window.

—front-window

opens the documents in the frontmost text window, creating one if necessary

—new-window

opens the documents in a new text window (1 for all arguments)

—separate-windows

opens each document in its own window

These flags are mutually exclusive – you should only specify one. The flags work when creating files and when piping to the tool, but are ignored for URL arguments.

tell application “TextWrangler” if (count of text windows) > 0 then select text window 1 repeat while (count of text windows) > 1 set ct to count documents oftext window 2 repeat with i from 1 to ct move document 1of text window 2to text window 1 end repeat end repeat else beep end if end tellp. (A copy of this sample script will be put in the default support folder for new installs.)

Go to Function Start
Go to Function End

and

Go to Previous Function
Go to Next Function

They all do pretty much what their names imply, but note that “function” as used in the command name is really a shorthand for “item that appears on the function popup”.

If you expect to use these commands frequently, consider assigning each a keyboard equivalent using the “Set Menu Keys” command on the application menu.

replace “foo” using “mumble” replacingString "foobargrumble"p. If “replacingString” is present, the modified form is returned upon completion of the event. If no occurrences of the search string are found, the input replacingString parameter is returned.

N.B. Previously we used Option to suggest that the window should be zoomed as big as possible. This conflicted with the system standard behavior of making Option mean “all”. The Command key can now be used to suggest that the window should be zoomed as big as possible.

Changes

The following items have changed in TextWrangler 2.1:

This provides a user experience identical to that with documents in separate windows (where window z-order provided the MRU-like behavior).

Previously, documents were indexed inside of multi-document windows by their display order in the Documents Drawer. This mean that document 1 of the application might not be the document that was being edited. This in turn required scripts to be revved for multi-document window awareness, and the introduction of the “active document of text window 1” construct.

The active document property is still supported, but it is no longer necessary. If a text window is frontmost,

document 1 of application “TextWrangler” document 1 of text window 1 of application “TextWrangler” active document of text window 1 of application "TextWrangler"p. now all refer to the same document. The side effect of this is that when accessing documents by index inside of a text window, a documents index is

  1. not its visual index in the Documents Drawer

is now either name order or creation order. It is controlled by the same preference which controls whether windows in the window menu/list are sorted by name or creation order.

If the previous operation was a paste, Paste Previous Clipboard will replace that paste with the contents of the previous clipboard. If the last operation was not a paste, it will be an ordinary paste of the previous clipboard.

Fixes

The following problems have been corrected in TextWrangler 2.1:

tell application “TextWrangler” set f to file of document 1 close document 1 open f end tell

tell application “TextWrangler” activate set fname to “newdoc” make new text document in window 1with properties {name:fname} end tell

TextWrangler123 * _NSAutoreleaseNoPool(): Object 0xc0d0e10 of class NSConcreteAttributedString autoreleased with no pool in place – just leaking

  1. inapplicable options were enabled in the text options dialog

These were a result of incorrect/ambiguous system documentation on NSSpellChecker. Thanks to Anton Leuski for helping to sort this out.

N.B. Basic checking/suggestions now work with cocoAspell. Because of how TextWrangler interacts with the spell checker, cocoAspell’s filtering (TeX, for example) presently does not work.

If you must open a file in the current directory whose name contains the string “+[decimal digits]”, you must give its local or full path, e.g.

edit ./+1234p. or

edit /full/path/to/+1234

tell application “TextWrangler” set l to line 1 of text window 2 tell text window 1 make new line at end with data l end tell end tell

the application would quit and discard unsaved changes in inactive documents in multi-document windows.

tell application “TextWrangler” tell container of selection delete startLine end tell end tellp. would cause the application to crash.

Literal ASCII 0×10 (as will arrive for multi-line strings from Script Editor 2) is translated to the native line end format; “\n” is always treated as a new line.

if number of windows = 0 then — do something end if

<?php /// DO NOT EDIT ///////////////////// ?>p. which at least one user does and PHP apparently likes.

XXX :: YYYp. to spaces before adding them to the function popup menu.