Which text gets passed ot a text-factory

2013-03-01 Thread LuKreme
Text factories, as far as I can tell in my limited use of them, either act on 
all the text in the document, or on the selected text. Is there any way to make 
a text-factory behave like the Hard Wrap menu item? That is to say, operate on 
the current line/paragraph if nothing is selected?

If BBEdit did not have a Hard Wrap function and you had to recreate it via a 
text factory, would it be possible?

Also, is it the case that to attach a script to a menu item it must be an 
AppleScript? Reading page 290 never states this, but all the following examples 
are AppleScripts, even the one that calls `do shell script`.

-- 
I told you...BLAM BLAM BLAM BLAM Don't call me Junior.

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
BBEdit Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Which text gets passed ot a text-factory

2013-03-01 Thread Patrick Woolsey
At 12:45 -0700 03/01/2013, LuKreme wrote:
Text factories, as far as I can tell in my limited use of them, either
act on all the text in the document, or on the selected text.

If you mean employing a text factory as a _text filter_[1], that's correct,
and these same conditions apply to every type of text filter and to all
Text menu commands (other than Hard Wrap).


[1: Please refer to this post for some additional background:
https://groups.google.com/group/bbedit/msg/d5ac144d340bdd8a?hl=en ]


Is there any way to make a text-factory behave like the Hard Wrap menu
item? That is to say, operate on the current line/paragraph if nothing
is selected?

There is not, since BBEdit will send only the selected text to it.


If BBEdit did not have a Hard Wrap function and you had to recreate it
via a text factory, would it be possible?

Not with a text filter, though one could do this with a suitable script.


 Also, is it the case that to attach a script to a menu item it must be
 an AppleScript? Reading page 290 never states this, but all the following
 examples are AppleScripts, even the one that calls `do shell script`.

Yes; attached scripts must be AppleScripts. (Though that's all the parent
chapter deals with, I can see how this may not be apparent in local context
and will clarify same in the next turn of the manual.)


Regards,

 Patrick Woolsey
==
Bare Bones Software, Inc. http://www.barebones.com/

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
BBEdit Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Which text gets passed ot a text-factory

2013-03-01 Thread John Delacour

On 01/03/2013 21:06, Patrick Woolsey wrote:

At 12:45 -0700 03/01/2013, LuKreme wrote:

If BBEdit did not have a Hard Wrap function and you had to recreate it
via a text factory, would it be possible?

Not with a text filter, though one could do this with a suitable script.

No, Patrick, this can be done with a text filter.  For example:


#!/usr/bin/perl
use strict;
use Text::Wrap;
$Text::Wrap::columns = 72;
my @text;
while () { push @text, $_ }
print wrap('', '', @text);

JD




--
--
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

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Which text gets passed ot a text-factory

2013-03-01 Thread John Delacour

On 01/03/2013 22:03, I wrote:


No, Patrick, this can be done with a text filter.  For example:


#!/usr/bin/perl
use strict;
use Text::Wrap;
$Text::Wrap::columns = 72;
my @text;
while () { push @text, $_ }
print wrap('', '', @text);


or more simply

#!/usr/bin/perl
use strict;
use Text::Wrap;
$Text::Wrap::columns = 72;
print wrap('', '', );

JD


--
--
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

--- 
You received this message because you are subscribed to the Google Groups BBEdit Talk group.

To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Which text gets passed ot a text-factory

2013-03-01 Thread Patrick Woolsey
At 22:03 + 03/01/2013, John Delacour wrote:
On 01/03/2013 21:06, Patrick Woolsey wrote:
 At 12:45 -0700 03/01/2013, LuKreme wrote:
 If BBEdit did not have a Hard Wrap function and you had to recreate it
 via a text factory, would it be possible?

 Not with a text filter, though one could do this with a suitable script.

No, Patrick, this can be done with a text filter.  For example:

 [...code elided...]


I know this is splitting hairs :-) but I did not mean one can't wrap text
with a text filter (since as you observe this is certainly possible); I
meant that a filter cannot change the scope of the text it receives, while
a script can choose text arbitrarily.


Regards,

 Patrick Woolsey
==
Bare Bones Software, Inc. http://www.barebones.com/

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
BBEdit Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Which text gets passed ot a text-factory

2013-03-01 Thread Maarten Sneep

On 1 mrt. 2013, at 20:45, LuKreme krem...@kreme.com wrote:

 Text factories, as far as I can tell in my limited use of them, either act on 
 all the text in the document, or on the selected text. Is there any way to 
 make a text-factory behave like the Hard Wrap menu item? That is to say, 
 operate on the current line/paragraph if nothing is selected?

Does the Hard Wrap command work in this way? As far as I can tell it acts on 
the whole document if nothing is selected, and strictly on the selection if 
there is one. Much like a text filter (yes, I know you're asking for text 
factories here, but it seems that that in itself is not the limitation).

Best,

Maarten Sneep
-- 
This led some to the conclusion that on the left side of the balance sheet 
there is nothing right and on the right side of the balance sheet there is 
nothing left.

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
BBEdit Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Which text gets passed ot a text-factory

2013-03-01 Thread LuKreme
In our previous episode (Friday, 01-Mar-2013), Maarten Sneep said:
 Does the Hard Wrap command work in this way? As far as I can tell it acts on 
 the whole document if nothing is selected, and strictly on the selection if 
 there is one. Much like a text filter (yes, I know you're asking for text 
 factories here, but it seems that that in itself is not the limitation).

I use Hard Wrap (via option-Command-') many times a day. It acts on the current 
line if there is not a selection, and otherwise on the selection.

This is in 10.5.2.

-- 
'Witches just aren't like that,' said Magrat. 'We live in harmony with
the great cycles of Nature, and do no harm to anyone, and it's wicked of
them to say we don't. We ought to fill their bones with hot lead.'

-- 
-- 
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

--- 
You received this message because you are subscribed to the Google Groups 
BBEdit Talk group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to bbedit+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.