Hi again Aidan

Sorry I missed the second part of your question.
To start off, that is an excellent idea you put forward. I simply used to 
switch to text type when I need multiple line breaks, for sake of sheer 
laziness. What you propose is the solution, now I see it.

I can see where you went wrong. The wrap-lines function in TW-5 is a 
misnomer. It actually wraps the entire selection, and adds the prefix and 
suffix only once to the selection. Here is the difference between wrap-line 
and wrap-selection function in TW5.

Wrap-selection:: If you select a part of a line(for eg: a couple of lines 
in a sentence), wrap selection will add suffix and prefix to those few 
words only. This is used in toolbar buttons like bold, italics etc
Wrap-lines:: Even if you select a part of a line, it will wrap the entire 
line/lines and add suffix and prefix to the whole selection. That is to 
say, you cannot end selection in the middle of a line when you are using 
this function. This is used in quote-blocks and code-blocks.

In short, wrap-lines is not wrap-each-line, but wrap-all-lines-once.

Now since I want the functionality you proposed, I put together a plugin to 
do exactly what you want. It is a new text-edit-operation called 
suffix-lines. It is similar to prefix-lines, but adds suffix. If you have 
multiple lines in your selection, suffix will be added to each of those 
lines. Similar to prefix-lines, it also has a "count" parameter. So if you 
set the count as 2 or more, it will duplicate the suffix characters that 
many times.

For example, here is the text for editor toolbar button that will add 2 
linebreaks at the end of each lines in selection.

<$action-sendmessage
    $message="tm-edit-text-operation"
    $param="suffix-lines"
    character="<br/>"
    count="2"
/>


There is one functionality I left out in comparison to prefix-lines. Prefix 
lines will remove the prefix character if it is already present in the 
selection. It is convienient to have it, but I hardly ever use it, so I 
have not bothered.

I am attaching the plugin along with a couple of other tiddlers which will 
actually add the editor toolbar button to add line-breaks. The toolbar 
button is not a part of plugin. The plugin only provides suffix-lines.js 
which you may use in any number of editor toolbar buttons.

sincerely
Riz

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/62db6451-7fbf-40be-850e-6d3466fed00e%40googlegroups.com.

Attachment: suffix-lines.json
Description: application/json

Reply via email to