/*
* This is simple jEdit beanshell macro to convert selected lines HTML table rows (
|
)
*
* charset: UTF-8
*
* (c) TAAT Digital Technologies 2006
* Tomasz P�szor
* info at taat dot pl
* http://taat.pl/jedit/
*/
void process(){
if (textArea.getSelectedText()==null) {
mcp=textArea.getCaretPosition();
textArea.selectLine();
sn=true;
}
prefix = "";
suffix = " |
";
buffer.beginCompoundEdit();
selectedLines = textArea.getSelectedLines();
for(i = 0; i < selectedLines.length; ++i)
{
offsetBOL = textArea.getLineStartOffset(selectedLines[i]);
textArea.setCaretPosition(offsetBOL);
textArea.goToStartOfWhiteSpace(false);
textArea.goToEndOfWhiteSpace(true);
text = textArea.getSelectedText();
if(text == null) text = "";
textArea.setSelectedText(prefix + text + suffix);
}
if (sn==true) {
textArea.selectNone();
len=buffer.getLength();
if (mcp>len) mcp=len;
textArea.setCaretPosition(mcp);
}
buffer.endCompoundEdit();
}
// main
if(buffer.isReadOnly())
Macros.error(view, "Buffer is read-only.");
else process();
/*
Macro index entry (in DocBook XML)
Lines_to_TR.bsh
This is simple jEdit beanshell macro to convert selected lines HTML table rows ( |
)
(c) TAAT Digital Technologies 2006
*/