TextWrangler 3.5 Release Notes

This page documents all feature enhancements and additions included in the TextWrangler 3.5 update.

For detailed information on using any of TextWrangler's features, please refer to the user manual (choose "User Manual" from TextWrangler's Help menu).

Requirements

TextWrangler 3.5 requires Mac OS X 10.5 or later (10.5.8 or later recommended).

This version is a Universal application: it runs natively on both Intel-based and PowerPC-based Macs.

Additions

  • The Quick Search window is gone, and has been replaced by an in-window Live Search bar. Choosing the "Live Search" menu command on the Search menu will open this bar.

    As you type in the search field, matches for the string get highlighted in the window's editing view. The search is always literal and case-insensitive. The "previous" and "next" arrows to the left of the field are useful for navigation; you can also type Return or Shift-Return in the search field to go forward or backward.

    The Emacs key bindings ctl-S and ctl-R will open the live search bar if necessary; if the search bar is already open, ctl-S will search forward, ctl-R will search backward (assuming that something is entered in the search field; and also that the Emacs keybinding support is turned on in the preferences).

  • Made the regex for detecting python #! lines more precise.

  • Added support for swipe to navigate between documents to MDI windows and the documents drawer.

  • TextWrangler gets text folding, including automatically generated fold points and the relevant commands on the "View" menu.

  • Services clean-up for Snow Leopard:

    Renamed certain services to provide better context in the services menu, contextual menu, and configuration interface on Snow Leopard.

    Provided NSRequiredContext in the service specification so that a) services are enabled by default and b) non-file path text selections are excluded from the open file service.

  • When you drop a tarball (a ".tar" file) on TextWrangler, or double-click on such a file in a disk browser, TextWrangler will now browse into the tarball instead of opening its raw contents in an editing window.

    If for some reason you prefer the old behavior:

    defaults write com.barebones.textwrangler Misc:OpenDiskBrowserForTarballs -bool NO

  • The window scripting object class now has a property: "live search bar visible", which indicates whether the Live Search bar is currently displayed in that window.

  • TextWrangler can now browse Zip archives (in the format created by the Finder's "Compress", or by using ditto -k from the command line). Drop a Zip archive on TextWrangler to see it in action.

  • Added support for enums to the Java language module. Enums now receive auto-fold points and are enumerated in the function popup.

  • When you first save a file which begins with a shebang line, TextWrangler will now make that file executable (a+x, as modified by the umask).

  • The "search here" command (third on the Search menu, after "Multi-File Search") is now enabled when a text document is active and exists on disk.

  • Edit -> Insert gets a new command: "Emacs Variable Block". This brings up a sheet for confirming the insertion of Emacs variables describing the option settings for the current document. (Using all of the options can result in a pretty verbose result; so you may find it useful to prune the resulting text as desired.) These variables are honored and have precedence over saved document state when TextWrangler opens the document. (Inserting the explicit settings can be useful when sharing the document with others.)

  • ObjectiveC 2.0 @property declarations now appear in the function menu.

  • When setting up ~/Library/Application Support/TextWrangler/ for the first time, the folder skeleton contains a "Read Me.txt" file at the top level, with helpful information and pointers.

  • TextWrangler now offers enhanced script attachability. In addition to adding scripts to menu commands as has been possible for a long time, you can now attach scripts to certain application and document events.

    The attachment points (corresponding to the function names in your attachment scripts) are listed below. Except as noted, all of them share the following characteristics:

    • Every function takes a single argument, which is a reference to the object in question: the application for application entry points, or the document being opened/closed/saved/etc for document entry points.

    • Any attachment point whose name contains should is expected to return a Boolean result: true or false. If it returns true, the operation will continue. If it returns false or throws an error (see below) then the operation will be cancelled. So, for example, applicationShouldQuit returning true will allow the application to quit; returning false will not.

    • If an attachment script causes a scripting error and does not handle it within the script itself, TextWrangler will report the error. In the case of functions which are used to allow a should action, this will prevent the action from occurring.

.
applicationDidFinishLaunching called when the application has completed startup
applicationShouldQuit called when the user has chosen "Quit" (or the application receives a quit event for some other reason
applicationDidQuit called when the application has finished shutting down and is about to exit
documentDidOpen called when a document has been opened and is ready for use. Note that TextWrangler supports multiple types of documents, and so you should be prepared for the argument to be a document of any type.
documentShouldClose called when the application is preparing to close a document.
documentDidClose called when the application has closed a document.
documentShouldSave called when the application is trying to determine whether a given document should be saved.
documentWillSave called when the application is about to begin saving a document. note that this will only be called after a successful return from a documentShouldSave.
documentDidSave called after a document has been saved successfully.
documentWillUnlock called when TextWrangler is going to make a document writeable (as when the pencil is clicked to unlock)
documentDidUnlock called when TextWrangler has successfully made a document writeable
documentWillLock called when TextWrangler is going to make a document read-only
documentDidLock called when TextWrangler has successfully made a document read-only

There's a new folder in the TextWrangler application support folder, "Attachment Scripts", which contains the script(s) to implement your custom event handlers. You can write one script to handle each attachment point, or you can write one script to handle the attachment points for an entire class of objects, or you can write one script to handle all of the attachment points for the entire application.

It's also possible to mix and match to specialize: for example, one script to implement a particular attachment point for documents, and one to handle the rest of them.

TextWrangler handles the association of scripts to attachment points by means of the script's file name. There are three ways to specify a script's role:

  • <ObjectClass>.<entryPoint>
  • <ObjectClass>
  • <ApplicationName>

The first form is the most specific: the ObjectClass may be one of the following:

  • Document
  • Application

The entryPoint is one of the attachment points described above appropriate to the object class. So, for example, a script which implemented only the documentDidSave attachment point would have the file name Document.documentDidSave.scpt and contain a subroutine named documentDidSave, thus:

on documentDidSave

    --   do something useful and appropriate

end documentDidSave

Note that the file name suffix .scpt is not mandatory, but you should follow the current OS conventions as suggested when saving the script in the Apple script editor (or another script editor, such as the excellent Script Debugger).

The second form allows you to implement all of the attachment points for a single object class in a single script file, if desired. So, for the application (for example), create a script named Application.scpt, and it can contain subroutines for as many of the attachment points as you wish:

on applicationDidFinishLaunching

    -- do something relevant

end applicationDidFinishLaunching

on applicationDidWakeFromSleep

    -- do something useful

end applicationDidWakeFromSleep

on applicationShouldQuit

    -- hello world

    return (current date as string contains "day")

end applicationShouldQuit

To implement all of the attachment points for the Document class, you'd create a script named Document.scpt, and put subroutines in it for the document attachment points:

on documentDidSave

    ...

end documentDidSave

on documentWillClose

    ...

end documentWillClose

Finally, you can write one all-encompassing script which contains subroutines for all of the attachment points in the application. To do this, name the script TextWrangler.scpt and put whatever subroutines in it you wish to implement:

on applicationShouldQuit

    -- hello world

    return (current date as string contains "day")

end applicationShouldQuit

on documentWillClose

    ...

end documentWillClose

When figuring out which script to run, TextWrangler will first look for a script whose name exactly matches the attachment point, e.g. Document.documentShouldSave.scpt. If it is not found, TextWrangler will then look for a script whose name matches the object class at the attachment point; e.g. Document.scpt. Finally, if neither an exact or a class match is found, TextWrangler will look for an application-wide script: TextWrangler.scpt.

Note that you do not have to implement attachment subroutines for all attachment points, or for all classes -- only the ones you need. If there is no attachment script or subroutine, TextWrangler proceeds normally.

Changes

  • The internal format of saved document state has been reworked, as well as the behaviors for saving and loading it. The most important visible changes are as follows:

    • When saving state, TextWrangler captures only those settings which are fundamental to the document (window position, selection range, folds, splitter setting), or settings which vary from the global preferences. The latter ensures that changes to the global preferences are never inappropriately overridden by document state.

      So, for example, if the default document font is Consolas when you save the document, and the document uses that font, but you change the global preference to Menlo before the next time you open that same document, the document's font will be set to Menlo. (Note that this behavior applies to any document setting which takes its default from the prefs; the font is used only to illustrate.)

      This change should resolve lots of confusion surrounding the question of "I changed my prefs, how come my document settings don't reflect that?"

    The internal data format of the state has changed to accommodate this new behavior. Documents with existing saved state will exhibit the old behavior when they are opened; this is not a bug. TextWrangler will write out the new state format the next time you save the document.

    Note that the new format is not backward-compatible; so if you open the document with an older version of TextWrangler, the new format state will be ignored.

    Also:

    • If you are using the expert preference to save state in the document's resource fork (rather than in a central location), please note that the new format state data is not actually saved in a resource anymore - it is now written into an extended attribute, which you can verify from the command line using xattr -l /path/to/some/file.

    And finally:

    • A new "Normalize Options" command is available on the Edit menu. This command will reset the front document's display and editing options to the current defaults established by your preferences (including any language-specific overrides), and clear the document's saved state. This can be useful in situations where previously saved state is restored and contains undesired variances from your preferences.
  • The following UI changes have been made to text encoding selection:

    • "Unicode (UTF-8, no BOM)" has been renamed to "Unicode (UTF-8)".

    • "Unicode (UTF-8)" has been renamed to "Unicode (UTF-8, with BOM)".

    • The text encodings menu (as used in the status bar, preferences, and other locations) has been rearranged so that the most commonly used Unicode variants (UTF-8 and UTF-16-BE+BOM) are at the top of the menu, with a separator between them and the rest.

  • A fresh install of TextWrangler will no longer populate the Application Support/TextWrangler folder; instead it will simply create empty placeholder folders so that you know where stuff goes.

  • The "Open Hidden" command has been removed from the File menu, since the "Show Hidden Items" check box is available on all supported systems now (and it works).

  • When saving a document to a mounted file system (not FTP/SFTP), the application now does a "safe save" so that the existing data on disk is not replaced until the new document data has successfully been written.

  • "Replace All" text factory operations no longer generate a results entry so a results window should no longer appear at the end of a factory run containing Replace All actions, unless errors occurred.

  • Reworded scary confirmation text when deleting items from the Multi-File Search sources list.

  • The GUI switch to use the old Find dialog has been removed from the Text Search preferences. The preference is still supported, so if you previously changed it, the change remains in effect.

    The expert preference for controlling use of the old Find dialog is:

    defaults write com.barebones.textwrangler FindDialog:UseOldSk00lFindDialog -bool YES

  • The --gui option to bbfind now brings the application to the front when starting the search. To suppress this, add -b or --background to the command line.

  • The on-disk storage format for file filters has been changed to something more future-friendly; the saved filters are now located in "File Filters.filefilters" in ~/Library/Preferences/com.barebones.textwrangler.PreferenceData/. (Note that although the file is readily human-readable, the internal structure is undocumented and subject to change; modifications made without using the application's UI are not supported...)

    Existing filters will be converted (nondestructively) to the new format. Note that the new format cannot be used with older versions of the application.

  • When browsing a Zip archive or tarball, if there is only one top-level item and it's a folder, the rest of the items are hoisted (and the top-level item is not shown).

  • If a window contains multiple documents, its submenu on the Window menu will contain diamond indicators as appropriate for any documents with unsaved changes or state.

  • If a file changes on disk and the copy open in TextWrangler has unsaved changes, you now have the option to ignore future changes to that file (for as long as the document remains open in TextWrangler; closing and reopening will cause the behavior to reset).

  • The expert pref for controlling whether or not temporary files area eligible for the Open Recent has been changed. The new invocation to do so is:

    defaults write com.barebones.textwrangler RecentItems:RememberTempFiles -bool YES

  • Iä! Iä! Birdies fhtagn!

  • If you Select All in a Find Differences results window, the Apply buttons will then copy the entire document in the indicated direction. (Note that it is not currently possible to selectively apply a subset of more than one diff - you can apply one, or all, and nothing in between.)

  • The application has undergone extensive internal rework, in order to improve performance, remove some longstanding limitations, and pave the way for new features. By and large, the internal changes should be invisible, but the following top-level changes deserve mention:

    • Support for BBXT plug-ins has been removed. This means that the "Plug-Ins" window is gone from the Palettes menu, the plug-in summaries are gone from the About box, and the Tools menu is gone (if you didn't see it before, you won't notice any difference). If you drop a BBXT plug-in on the application, you'll get an alert to the effect that plug-ins aren't supported.

    • Automatic import of pre-8.0 format Grep pattern data is no longer supported. (If you have such a file, please write to support for assistance.)

    • It is now possible to open files significantly larger than before; the ceiling isn't unlimited, but it is no longer limited by the previously extant constraints in the OS.

    • The following large-scale text transformations are significantly faster and/or require less transient memory:

      • Multi-file search (and replace)
      • single-file Find All
      • Process Lines Containing
      • Sort Lines
      • Process Duplicate lines
      • Prefix/Suffix Lines
  • For text documents whose size exceeds a certain threshold (expressed in bytes, factory default 1MB), TextWrangler will ignore the Soft Wrap Text preference and leave wrapping off in order to improve the performance of opening very large files. The threshold may be adjusted if desired:

    defaults write com.barebones.textwrangler Editor:SoftWrapLengthThreshold -int 1048576

    If you set the limit to zero, TextWrangler will always honor the Soft Wrap Text preference, even in situations where soft-wrapping a large file may cause it to take a very long time to open.

  • Since "Find All Misspelled Words" is pretty much pointless on files over a certain size, the maximum amount of text checked by this command is now limited to 1M (1024 squared) characters. This may be adjusted with an expert preference:

    defaults write com.barebones.textwrangler Editor:SpellCheckLengthLimit -int NN

    where "NN" is some decimal value. Use -int 0 to suppress the limit check altogether.

  • The "Don't Process" (or equivalent) buttons have been removed from the following commands' dialog boxes:

    • Add/Remove Line Numbers
    • Change Case
    • Find and Mark All
    • Hard Wrap
    • Hex Dump
    • Prefix/Suffix Lines
    • Process Duplicate Lines
    • Process Lines Containing
    • Rewrap Quoted Text
    • Sort Lines
    • Zap Gremlins
  • Adjusted the terminology and keyboard equivalents in the Add/Remove Line Numbers sheet to be a little more consistent with expectations.

  • The software update checker will provide notifications when the machine has been idle for 30 minutes, in addition to at launch and after manual check.

  • When creating results windows from the scripting interface, the name is no longer mandatory -- if absent, the application will generate one.

  • When creating results windows from the scripting interface, the application will use narrow list items if none of the results items have a "message" or "match_string" property.

  • When creating results windows from the scripting interface, the "result_kind" may be omitted from the item records; if absent the kind is assumed to be "note_kind".

  • When you are backspacing with an insertion point, TextWrangler will delete a tab stop's worth of spaces if there are only spaces (and tabs) between the insertion point and the start of the line on which you're editing. This may be disabled by an expert preference if desired:

    defaults write com.barebones.textwrangler Editor:DeleteIndentationWhitespaceToTabStop -bool NO

  • Holding down the Shift key when starting the application no longer suppresses the #! menu.

  • If a hierarchical results list entry is collapsed, and one or more children are error entries, the collapsed entry text is drawn in red.

  • The "Use Unicode line breaks" preference and document settings have been consigned to the dustbin of history.

  • If a document has an explicit encoding declaration, but the declared encoding doesn't map to anything known, you'll get an alert when saving. (The document will be saved in whatever encoding is displayed in the status area at the bottom of the window.)

  • Cache files for FTP/SFTP are now kept in ~/Library/Caches/<bundle id>/FTPTemp/, rather than ~/Library/Caches/<app name FTP Temp/.

  • There is now an expert pref available, for those who prefer their multi-file search results lists to be flat rather than hierarchical by file:

    defaults write com.barebones.textwrangler Search:AlwaysFlattenSearchResultsLists -bool YES

  • Added JSON language support (syntax coloring and "function" navigation).

fin