______________________________________________________________________I have other, simpler scripts that sort of work for this, but the grep-based approach is obviously the most effective. If only I could make it work...
______________________________________________________________________It seems to be working, but I'd appreciate it if you could have a quick look and let me know if there's anything that I've misunderstood or that might need to be adjusted.
I talked to Patrick at Bare Bones, and he says the backward find with extending selection not working issue is NOT a bug but a technical problem (read can-of-worms) that is unlikely to change in the near future. Therefore a workaround is the only viable solution at this time.
This line in my first script is unneeded (I didn't finish cleaning up after writing/testing the script):properties of foundObject
------------------------------------------------------------------------------------------------For finding forwards I think we can simplify quite a bit:------------------------------------------------------------------------------------------------tell application "BBEdit"tell text of front text windowfind "[^\\r]+" options {search mode:grep, starting at top:false, wrap around:false, backwards:false, case sensitive:false, match words:false, extend selection:true} with selecting matchend tellend tell
I should add: I use Keyboard Maestro for this because BBEdit does not allow me to assign the option-shift-Up and option-shift-Down shortcuts to scripts.
Okay. I'm glad you mentioned this, since it's very germane to the problem.This slightly modified script should fix the find-backwards problem.I assume you have the Keyboard Maestro shortcut set to 'Key Pressed' - yes?
------------------------------------------------------------------------------------------------tell application "BBEdit"tell text of front text windowif (characterOffset of selection) > 1 thenset endMarker to (characterOffset of selection) + (length of selection) - 1set fRec to find "[^\\r]+" options {search mode:grep, starting at top:false, wrap around:false, backwards:true, case sensitive:false, match words:false} with extend selectionset startmarker to characterOffset of fRec's found objectselect (characters startmarker thru endMarker)end ifend tellend tell------------------------------------------------------------------------------------------------