On 26 Oct 2008, at 10:05, Piero D'Ancona wrote:
[...] I have an additional question. My trivial routine to get the text is
def get_test_in_scope(the_scope) TextMate.exit_discard unless ENV["TM_SCOPE"].split(" ")\ .include?(the_scope) the_text = STDIN.read return the_text end
If the goal is to act only when the fallback (of scope) is given as input, it is more robust to do something like:
TextMate.exit_discard if ENV.has_key?('TM_SELECTED_TEXT')
What if two nested scopes are applicable in the same caret position and I need to capture all the text belonging to the larger scope?
When selecting a scope, TM applies the scope selector to the scopes to the left/right of the caret, and stos as soon as the scope selector does not match.
So for nested scopes, you get all the scopes, which sounds like what you want.