jEdit Community - Resources for users of the jEdit Text Editor
noob needs macro assistance..
Submitted by jdlx on Friday, 30 December, 2011 - 03:20
Hi,

i'd appreciate if someone could help me on this nobrainer.. (well not for me obviously Eye-wink :

I'd like to grab some selected text, or if none is selected, the content of the clipboard,
and then do some search/replace, add some text, and paste back to the textarea..
my approach so far:

var = textArea.getSelectedText();
if(var.length == 0){
// get text from clipboard & assign to var..
// Registers.cut(textArea,'$'); does get the clipboard, but i just don't know how to assign it to var..
}
esc_var = var.replaceAll("'", "\"");
textArea.setSelectedText("FB::log("+var+",'"+esc_var+"');");

cheers & thx..
jc
Comment viewing options
Select your preferred way to display the comments and click 'Save settings' to activate your changes.
Register
by Robert Schwenn on Sun, 08/01/2012 - 14:12
Hi,
this seems to work:

import org.gjt.sp.jedit.Registers;
import org.gjt.sp.jedit.Registers.ClipboardRegister;

ClipboardRegister reg = Registers.getRegister('$');
org.gjt.sp.jedit.Macros.message(view, reg.toString());

Robert
User login
Browse archives
« April 2024  
MoTuWeThFrSaSu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
 
Poll
Are you interested in language packs for jEdit?
Yes, and I could help maintain translations
26%
Yes, I'd like to have translations
32%
Indifferent
35%
No, that'd be bad (please comment)
7%
Total votes: 1093
Syndication
file   ver   dls
German Localization light   4.4.2.1   82348
Context Free Art (*.cfdg)   0.31   46055
JBuilder scheme   .001   18495
BBEdit scheme   1.0   18116
ColdFusion scheme   1.0   18024
R Edit Mode - extensive version   0.1   17473
Advanced HTML edit mode   1.0   16206
Matlab Edit Mode   1.0   16068
jEdit XP icons   1.0   15229
XP icons for jEdit   1.1   14293