Whoops: bit of a bug in that last one. If you weren't in a tag, or weren't 
in a span tag, it moves the insertion point.

Also note that it will not re-select text if you had a selection.

This one fixes the first bug, but not the second.

*tell* *application* "BBEdit"

*tell* *front* *window*

*set* cursorPos *to* characterOffset *of* selection

*balance tags*

*set* startPos *to* characterOffset *of* selection

*set* endPos *to* startPos + (length *of* selection)

*select* (*characters* (startPos - 6) *thru* (endPos + 6))

*set* selectedText *to* selection *as* *text*

*if* *characters* 1 *thru* 6 *of* selectedText *as* *text* *is* *equal 
to*"<span>" 
*then*

*set* replaceText *to* *characters* startPos *thru* (endPos - 1) *as* *text*

*set* selection *to* replaceText

*select* *insertion point* *before* *character* (cursorPos - 6)

*else*

*select* *insertion point* *before* *character* (cursorPos)

*end* *if*

*end* *tell*

*end* *tell*

-- 
You received this message because you are subscribed to the 
"BBEdit Talk" discussion group on Google Groups.
To post to this group, send email to bbedit@googlegroups.com
To unsubscribe from this group, send email to
bbedit+unsubscr...@googlegroups.com
For more options, visit this group at
<http://groups.google.com/group/bbedit?hl=en>
If you have a feature request or would like to report a problem, 
please email "supp...@barebones.com" rather than posting to the group.
Follow @bbedit on Twitter: <http://www.twitter.com/bbedit>

Reply via email to