文字列を「」で囲む@マクロ
C:\Program Files\jEdit\macros\Test
などに保存すれば、メニューのマクロから使える。
ショートカットキーを割り当てると、すごく使えるようになる。
この他に、testxx.bsh シリーズを作成した。""、()、「」、『』など。
※「"」 は「\"」
// beginning of test16.bsh (半角空白を挿入)// import statements
import javax.swing.border.*;
import java.lang.Integer;// main routine
void prefixSuffixDialog(View view)
{
this.view = view;int selectionStart = textArea.getSelectionStart();
int selectionEnd = textArea.getSelectionEnd();
textArea.setCaretPosition(selectionStart);
int startLine = textArea.getCaretLine();
textArea.setCaretPosition(selectionEnd);
int endLine = textArea.getCaretLine();
String text = textArea.getText(); //選択までの全体
String lineText = text.substring(selectionStart, selectionEnd); //選択したテキストif( lineText.length() == 0 )
{
textArea.setSelectedText(" ");
textArea.setSelectedText(" ");
textArea.setCaretPosition(selectionEnd+1);
}
else
{
textArea.setCaretPosition(selectionStart);//キャレットを選択範囲の先頭に戻す
textArea.setSelectedText(" ");
textArea.setCaretPosition(selectionEnd+1);//キャレットを選択範囲の末尾に
textArea.setSelectedText(" ");
}
}// this single line of code is the script's main routine
// it calls the methods and exits
if(buffer.isReadOnly())
Macros.error(view, "Buffer is read-only.");
else
prefixSuffixDialog(view);// end Test.bsh