📄 next_char.bsh
字号:
/* * Next_char.bsh - a BeanShell macro script for the * jEdit text editor - finds next occurence of character on * current line * Copyright (C) 2001 John Gellene * jgellene@nyc.rr.com * http://community.jedit.org * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with the jEdit program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * $Id: Next_Char.bsh,v 1.1 2001/11/24 03:33:01 jgellene Exp $ * * Checked for jEdit 4.0 API * */void nextChar(){ script = new StringBuffer(512); script.append( "start = textArea.getCaretPosition();" ); script.append( "line = textArea.getCaretLine();" ); script.append( "end = textArea.getLineEndOffset(line) + 1;" ); script.append( "text = buffer.getText(start, end - start)" ); script.append( "match = text.indexOf(__char__, 1);" ); script.append( "if(match != -1) {" ); script.append( "if(__char__ != '\\n') ++match;" ); script.append( "textArea.select(start, start + match - 1);}" ); view.getInputHandler().readNextChar("Enter a character",script.toString());}nextChar();/* Macro index data (in DocBook format)<listitem> <para><filename>Next_Char.bsh</filename></para> <abstract><para> Finds next occurence of character on current line. </para></abstract> <para> The macro takes the next character typed after macro execution as the character being searched. That character is not displayed. If the character does not appear in the balance of the current line, no action occurs. </para> <para> This macro illustrates the use of <function>InputHandler.readNextChar()</function> as a means of obtaining user input. <!-- See <xref linkend="macro-tips-single-char" --> />. </para> </listitem>*/// end Next_char.bsh
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -