TextWrangler 3.1 Release Notes
This page documents all the new features, enhancements and visible changes included in the TextWrangler release.
For information about the changes included in any specific version of TextWrangler, please see the release notes archive.
For detailed information on using any of TextWrangler's features, please refer to the user manual (choose "User Manual" from TextWrangler's Help menu).
TextWrangler 3 requires Mac OS X 10.4 or later (10.4.11, 10.5.8, 10.6.7 or later recommended).
This version is a Universal application: it runs natively on both Intel-based and PowerPC-based Macs.
When scanning folders for various purposes (multi-file
search, Find differences, and others), SCM administrative
directories are specifically ignored, even if "Search Invisible
Folders" is turned on:
.bzr. This avoids
potential disasters that can result from indiscriminate search
and replace in such directories. If, however, you choose to live
dangerously, you can allow TextWrangler to see inside of these
defaults write com.barebones.textwrangler Misc:SkipSCMAdminDirsWhenScanningFolders -bool NO
Note that this behavior represents a change from previous versions, in which you could search inside of such directories by using "Search Invisible Folders".
The Enter key can optionally generate a CR (controlled in Editing:Keyboard)
When pasting into an editing view, TextWrangler will convert
non-breaking spaces (Unicode
0x00A0) in the pasted text to ASCII
0x0020). To disable this conversion:
defaults write com.barebones.textwrangler Clipboard:ConvertNonBreakingSpacesWhenPasting -bool NO
When running on Mac OS X 10.5 and later, there's a new item in the Open dialog: "Show hidden items". This controls whether the dialog box shows invisible files and folders. The setting you choose will persist across runs of the application.
FTP browsers get a "New..." button, which when clicked allows you to create a new file or folder in the location to which you're currently connected. Creating a new file will open it; creating a new folder will navigate into it.
You can now use the extended hex notation in literal
N is any hexadecimal digit. You
can use up to four hex digits; the following examples are
"Open Selection" and "Open File by Name" now use the front
document's default save location if one is available and the
document isn't saved to disk. This makes it useful in the case
of a file that will be implicitly created when saving but which
doesn't exist yet, as in
Search results now contain an additional property in the "Result Entry" scripting object type:
match_string (text) : for Grep search results, contains the text matched by the pattern
There is an interface to simplify the creation and editing of Attached Menu Scripts.
TextWrangler will now honor the "com.apple.TextEncoding" extended file attribute, if present and appropriate. (The attribute will not override a BOM, explicit encoding specification, or Apple Event parameter, but is used if the file is not valid UTF-8, not pure ASCII, and no other hints are available.)
When saving a text document, TextWrangler will now write the document's text encoding into a "com.apple.TextEncoding" extended file attribute, if the preferences allow it. (The factory default is to write extended attributes if the file system containing the file supports them, and not otherwise; see the Expert Preferences reference in TextWrangler Help for the details.)
On Mac OS X 10.5 and later, the contextual menu will contain "Unlearn Spelling" when appropriate so that you can remove learned words from your user spelling dictionary as necessary.
There's a new built-in language, "Software Package Notes". This is a hook on which to hang internal mappings for the sorts of files that are typically included as additional documentation in Unix software package distributions. There is no syntax coloring or function navigation, but files mapped to this language are recognized as text and thus openable and searchable when text files are filtered for processing or display.
There's a new command-line tool,
twfind. It provides a
command-line interface for running multifile searches. Here is a
quick summary of its usage and options:
twfind <options> <string> <path ...>
-h, --help print this help and exit
-v, --version print detailed version information and exit
-V, --short-version print abbreviated version information and exit
-n, --case-sensitive search case sensitive (default: case insensitive)
-g, --grep interprets "<string>" as a regular expression
-w, --match-words only return matches that fall on word boundaries
-R, --no-nested-folders suppress searching of nested folders
-I, --search-invisible-folders search invisible folders
--all-file-types search all file types (default: text files only)
--name-pattern only search files whose names match the given pattern (may be used multiple times)
--gui open a results window instead of returning results
-c, --count only print number of matches found
-Z, --null separate results lines with NUL instead of newline
-S, --suppress-context only print file path and line number of match
-E, --editor-commands print results in the form ofedit
-0 interpret input separated with NUL instead of newline
You can combine single-character switches. Thus,
twfind -ngw some-string ...
is equivalent to
twfind -n -g -w some-string ...
You can also use "--" to end the parsing of switches, in cases where you need to specify a search string or file path that begins with two hyphens:
twfind some-string -- --name-of-some-file
It is possible to search more than one folder at a time
by specifying multiple "path" arguments. Apart from the
special case of using "--", the first non-hyphenated
argument is interpreted as the search string (or
-g is specified) and all others are file
paths. So, you could write:
twfind error /var/log /Library/Logs/
and this will cause
twfind to search for the string "error" in
two different folders.
If no search paths are specified on the command line,
twfind will attempt to read them from standard input. This
makes it an attractive target for the output of other tools such
find. For example:
find . -name "*.py" -print | twfind blah
takes the paths printed by
find and searches those files.
The input is expected to be separated by Unix newlines (
In cases where standard input is generated programmatically and
the paths are separated with a
NUL, you can pass a
-0 on the
command line. Again using
find as an example input source:
find . -name "*.py" -print0 | twfind blah -0
--name-pattern option is available for filtering
files by name in the directory(ies) being searched. The
wildcard syntax is the same as that used by the "Matches
Wildcard" file filter term:
'?' matches any single character;
'#' matches any digit;
'*' matches any run of characters;
'\' is used to escape the next character (for matching literal '
#', or '
twfind foo . --name-pattern "*.py" will search for the
foo in the current working directory, in every file
whose name ends in
Ordinarily, twfind returns results in this form:
where "NN" is the line number containing the match, and "
is the text of the line where the match occurred. You can modify
the output in a few different was:
-S will suppress the line,
which is a prerequisite if you want to use the output of
twfind as input to another tool (like
If you like, you can have twfind generate output in the form of
edit commands, each of which can be executed to open the
file and select the line. Use
-E. (Note that that this implies
-S and will suppress the context.)
Whether or not you use
-Z switch modifies the output
by using a
NUL (ASCII 0) character to separate the lines of
output, rather than a newline (ASCII 10). This can be useful for
programmatically parsing the output, or running it through
-c will suppress all of the output, and simply return
the total number of matches that were found.
It's also possible to use
twfind as a front end for the GUI
multi-file search. Add
--gui to the command line, and the
search will start and present a Search Results window, rather
than returning any text results to the tool. (This option causes
the tool to exit as soon as the search is started.)
Note also that using
-v will cause the tool to
exit immediately without performing a search, even if there are
valid search string and options provided.
The Find and Multi-File Search windows now show tooltips when you hover over various option switches and buttons. Each tooltip shows the keyboard equivalent for the item; as before you can adjust the equivalents using the Menus preferences.
Prefix/Suffix lines remembers recent choices. Prefix and Suffix keep separate histories, currently capped at 10 unique items.
For the convenience of user scripts (run from the shebang menu) TextWrangler sets some runtime environment variables to reflect the front-document state as it is when the script is about to be run:
BB_DOC_LANGUAGE Name of the document's current language (not set if language is "none")
BB_DOC_MODE Emacs mode of the document's current language
BB_DOC_NAME name of the document
BB_DOC_PATH path of the document (not set if doc is unsaved)
BB_DOC_SELEND (zero-based) end of the selection range (not set if not text document)
BB_DOC_SELEND_COLUMN (one-based) de-tabbed column number of BB_DOC_SELEND
BB_DOC_SELEND_LINE (one-based) line number of BB_DOC_SELEND
BB_DOC_SELSTART (zero-based) start of the selection range (not set if not text document)
BB_DOC_SELSTART_COLUMN (one-based) de-tabbed column number of BB_DOC_SELSTART
BB_DOC_SELSTART_LINE (one-based) line number of BB_DOC_SELSTART
NB: selection ranges and other offsets are expressed in characters, not bytes.
The popup menus in the Find Differences dialog (for quick access to open and recent documents/folders) have been retooled. This also fixes a reported cosmetic glitch.
The preferences key to control whether TextWrangler ignores RCS
keyword variances when comparing is now
Diff:IgnoreRCSKeywords, as in:
# pay attention to changes in RCS keywords when comparing files
defaults write com.barebones.textwrangler Diff:IgnoreRCSKeywords -bool NO
The "Smart Quotes" option has been renamed to "Use Typographer’s Quotes" where it appears in the preferences (Editor Defaults, Languages -> options), and editing controls (options menu in the toolbar, "Text Options" command).
When saving a text document, TextWrangler will look for a mismatch between the text encoding setting in the status bar, and any explicit encoding specification in the document's contents (HTML/XML meta tag or PI, or an Emacs variable). If a mismatch is found, an alert is presented so that you can avoid saving the document in this condition.
The warning includes an option to compare the open document against what's on disk, in cases where you are saving a text document.
Super Get Info is retired, and so is the preference to display its icon in the toolbar.
The "Color Grep patterns in Find dialog" setting has been removed from the Text Search preferences. The Expert Prefs help has been updated with the secret formula for changing this setting.
The "Show document icons" FTP/SFTP preference never got hooked up; so the switch has been removed from the "FTP" preferences. The remaining switch has been renamed to "Listings include files starting with “.”."
Support for non-bundled plug-ins has been removed. If you have a plug-in which no longer appears in the Tools menu after updating to TextWrangler 3.1, please contact the developer of that plug-in for assistance.
MARK" callout for comments now generates the same function
entry type as a
#pragma mark or
bbmark directive elsewhere
Closing a multi-file Find Differences result window will now prompt you to confirm, if you have applied any differences.
Fixed a bug where the Find Multiple window did not honor color preferences for grep search/replace strings
Fixed regression in which the End key didn't jump to the end of files with more than (32K - 1) lines.
Resetting language specific preferences also resets the general settings.
"Recent Items" shows up in the preferences search drawer.
Fixed a bug where we would install a new
edit tool in
/usr/bin, instead of upgrading one in an alternate location.
Fixed bug in which dragging text into one of the fields of the Find (or Multi-File Search) window would cause the other field to reset to the previous global state of the Find settings.
man pages are installed in
/usr/local/share/man/man1/ if the
tool is located in a directory which contains the path segment
Before performing any authenticated operations, TextWrangler ensures that the auth helper tool is current.
Adjusted the authentication prompt string when installing the auth helper tool on Mac OS X 10.6 and later
Using the font panel to change a document's font/size/tab width will now dirty the document's state.
Deleted a stray line from the CSS keyword list.
Fixed regression in which "Move to Trash" for an item on a server volume would report a -120 error instead of asking you to delete the item immediately.
results windows created through the scripting interface no longer get created with a prefs key, to avoid filling the prefs with settings for arbitrarily named windows.
Fixed bug in which an auto-saved document's line break setting was not restored correctly when reloading it.
Fixed disk browser bug in which safe-saving the file behind the displayed document from another application would cause the display to be cleared and reset to "No Editor".
Fixed suspected cause of a crash while resolving script object accesses to the Find window.
Fixed terminology error that made it difficult to access the Find or Multi-File Search windows via the scripting interface.
"Replace" and "Replace & Find Next" now update the search history.
Some per-language overrides were not applied when a document was reopened. Fixed.
Some per-language overrides were not applied when a document's language was changed (when saving, or choosing the language from the menu).
Returned tooltips to the Open Recent menu.
If the remote server drops the SFTP connection (or it's broken for some other undetermined reason), the FTP browser or dialog will now alert you and invite you to reconnect.
Eliminated unnecessary computation, resulting in a 2x speedup when opening a large, soft-wrapped document.
Keyboard focus is now forced to the file listing when an FTP browser window gets created.
The warning shown when trying to close a results browser with items removed is no longer shown if you've deleted all the items.
Fixed bug in which printing a document without making any changes to its print settings would disconnect it from the preferences, so future preferences changes would have no effect on the document's print settings until the document had been closed and reopened.
Fixed bug in which changes to the default text printing font preference didn't stick.
Gruber's [REDACTED] "url-like" links are recognized and launched.
When opening a file located on a remote (file, NOT ftp/sftp) server, TextWrangler will now listen to the document's parent folder for changes, rather than the document's file. This resolves a -61 error reported when attempting to save a file that had been opened from an AFP server by client on two different computers.
Fixed bug in which the listing in the FTP Browser/save dialog would not correctly scroll to the top of the list when displaying items not returned in something close to alphabetical order by the server.
Fixed bug in which "Save to FTP/SFTP Server" would report a -1728 error if the front FTP browser window was not connected to a server (and never had been).
It is now possible to scroll (horizontally) to the end of a line that's more than 65536 pixels long.
Fixed crash which would occur when reading certain gzip files.
Made changes to reduce the file system overhead involved in opening a document.
If a file is pure ASCII, it is now read using the default encoding for new documents, rather than allowing the fallback mechanics to take effect. In practice with factory default prefs, this means that pure ASCII documents will load as UTF-8 (no BOM), which is preferable to the previous behavior (reading them as Mac Roman).
Fixed bug in which hard wrapping a paragraph would cause the text view to scroll inappropriately.
Fixed crash which would occur if events ended up dispatched to a window which was in the process of being closed. (This tended to be irregular and hard to reproduce for some, not so much for others.)
When manually showing or hiding the Dock, TextWrangler no longer resizes any windows, even if they would overlap the dock. (This is consistent with the standard application behavior.)
Fixed bug in TextWrangler wouldn't come to the front when opening files from an FTP browser by click-through.
Adjusted the file filtering for folder comparisons so that files which cannot be compared are still allowed to appear in the lists of results if "Text Files Only" is turned off.
Fixed a bug in which supplying UTF-8 data from a text view to a drag receiver would fail.
Worked around a crash in
ClearDeadKeyInlineSession where AppKit
inappropriately handled a TSM event destined for one of TextWrangler's
Fixed a bug in the command line tool where open/print errors returned from TextWrangler weren't reported to the user.
When calculating completions in a case-insensitive language document, we no longer allow any built-in symbols (keywords or predefined names) to override tokens found by examining the document, unless the case is an exact match.
Application state saves (autorecovery) now include the drawer state (open or closed) and the drawer width.
Fixed bug in which Hard Wrap using "Page Guide" as the limit would calculate line break points incorrectly.
Fixed bug in which some commands in the disk browser's action menu were enabled inappropriately after the volume under the disk browser had been ejected.
Fixed bug in which application state would fail to save if it included a disk browser whose backing disk had been ejected.
Long path names now extend to the width of the list in the Multi-File Search window, rather than being cut off at 64 characters.
Fixed bug in which deleting remembered items from the source list in the modal Find dialog or the Text Factory run window would fail to remove the item from the appropriate recent items list.
Fixed bug in generation of summary text in the modal Find dialog when "Exclude Matches" was turned on.
Fixed a bug in which opening a file from an FTP/SFTP browser
didn't correctly use the browser's connection to the server.
This would occasionally cause problems with servers running
Pure-FTPd whose admins blindly followed the example in the
server software's man page, and started the server with "
to limit client connections to two per IP address.
Fixed a bug where choosing "Learn Spelling" or "Ignore Spelling" left the spelling ranges in a state where they could not subsequently be updated.
Fixed bug in which invisibles placeholders drawn with "Show Invisibles" and "Show Spaces" active were drawn in the wrong font, which would in turn cause misaligned columns.
Fixed bug in which language-specific text wrap preferences were not applied when opening an existing document.
Update the recent menu on inspection events so that it isn't blank when accessed by spotlight for menus.
When doing a "Use Selection for Find" (with grep turned off),
we now escape literal
FF in the selected text.
public.utf8-plain-text to the UTF-16 based
variants when reading data from the pasteboard or placing text
This is the native type provided by Cocoa applications. By using it in preference to the UTF-16 variants we avoid getting a translated version of the rich text data which is also on the pasteboard. In certain situations, this can result in data which differs by more than just the encoding. (For example, when copying from Safari, WebKit places non-breaking space translated plain-text on the pasteboard, and tab-delimited data for any selected tables. But the translation of the rich text data results in something quite different.)
Fixed bug in which un-splitting an editing view would cause non-US text entry to fail, if the bottom pane had focus before the view was un-split.
Removed the hard-wired limit on the number of items representable in a menu that is backed by a folder (Scripts, Stationery, Text Factories, Unix scripts/filters).
Fixed bug in which
<style> tags in XML (vs. HTML) were
incorrectly treated as CSS.
Fixed broken wording for tool installer authorization when running on system versions prior to Mac OS X 10.6.
Fixed bug in which the "Text Files Only" setting in the Open dialog incorrectly disabled folders.
Corrected passive FTP expert prefs in help.
Fixed bug in which opening files with non-ASCII names from the disk browser would fail.
Fixed crash which would occur randomly at some point after bringing up the Multi-File Search window.
Fixed bug in the C/C++ scanner in which it would crash instead of bailing when encountering excessively nested parens and/or braces. This typically happened when setting the default language to C++ or similar and then opening files which were most assuredly not.
Marked additional columns in the source control dialogs as sortable.
Fixed a bug which caused split windows to draw the top pane as if it were scrolled to the top if a replace all was performed in the bottom pane (the scrollbar was actually left in the correct position, but the content was incorrect).
Added fix for the documents drawer not updating after a Save All.
Added SUHelpAnchor keys to TextWrangler's plist, and created help pages for the software update checker dialog
Fixed bug in which closing a document and requesting a save to an explicit location would ignore the save location and prompt. This construction now works correctly:
tell application "TextWrangler" to close text document 1 saving yes saving in file "Boom Box:Users:siegel:Desktop:text.txt"
Fixed bug in which using Save As to change the encoding or line break type of an unmodified document (by saving over itself) wouldn't work.
Made changes so that automatic saving of application state only takes place when something has changed.
Fixed a bug which caused updates to man pages to succeed, but new installs of man pages to fail.
Fixed bug in which identifier names containing language keywords would confuse the Pascal parser and cause it to generate wacky fold points for procedures and functions.
Corrected capitalization of control titles in the Text Printing section of the print dialog.
When doing an Open Counterpart, TextWrangler first checks to see if the document in which you're working is in the active Xcode project, before asking Xcode for the counterparts. In this way, we avoid opening inappropriate counterparts when the file happens to have the same name as one in the project.
Adjusted the behavior of Open Selection/Open File by Name to match that of Open Counterpart: if the front document exists on disk and is not in the active Xcode project, we don't ask Xcode for anything, to avoid possibly opening the wrong file with the same name.
Fixed bug in which changing a document's language would not cause the associated preview window to refresh when it should have.
Fixed bug in which some commands were inappropriately enabled for the editing fields in the Find and Multi-File Search windows.
Fixed bug in which closing a multi-document window in which at least one of the documents had been opened from an FTP/SFTP server would cause an attempt to save those documents back to the server, even if they hadn't been modified.
Added missing resources, whose absence caused a -4960 error to be reported in TextWrangler when using the "Stop Recording" script menu item.
Changed wording of the alert which appears when you try "Move to Trash" on an item and no trash folder is available.
Fixed a crash in the Java function scanner which would occur when encountering a package class.
Fixed a bug which prevented the installation of an updated Application Support folder.
twdiff man pages to reflect the positional
significance of the file arguments.
Fixed authorization dialog wording.
Fixed bug in which "Save Default Window" was not enabled for FTP browsers as it should have been.
Fixed crash which would occur when closing the Multi-File Search window with certain search sources selected.