jEdit Community - Resources for users of the jEdit Text Editor
Find Highlighted
Submitted by abc123 on Monday, 17 September, 2007 - 15:51
Does anyone know how to find the currently highlighted text in Jedit? What I mean is:

1. Highlight a word
2. Execute a key stroke that then finds that word immediately

I can kind of get this to work if I use the Incremental Search Bar but it requires a keystroke to get the highlighted characters into the Incremental Search Bar and then another keystroke to find whatever was copied into the Incremental Search bar. I'd like to be able to do this with one keystroke. Hypersearch is good but I don't always want to open another window.
Comment viewing options
Select your preferred way to display the comments and click 'Save settings' to activate your changes.
Do you mean select when you w
by Redoute on Mon, 17/09/2007 - 19:36
Do you mean select when you write highlight? And you want to search for the next occurence of the selected word/text?

There is an action Incremental Search for Word with default shortcut A+COMMA (don't know how to type this, I am only able to get A+,). It invokes incremental search with the selected text, or with the word at cursor position if there is no selection. If you bind it for example to F3, then F3, Enter will take you to the next occurence.

As far as I understand, the plugin Shortcut Saver should allow to combine several actions (quick-search-word find-next) to a single keystroke, but I didn't get this to work.

(using/learning jEdit 4.3pre10)
 
Your suggestion on Shortcut S
by abc123 on Wed, 19/09/2007 - 14:57
Your suggestion on Shortcut Saver is exactly what I'd like to do but I couldn't get it to work either. Although it does seem to work as long as it's not assigned to a keyboard shortcut.....
 
OK, here is my very first try
by Redoute on Wed, 19/09/2007 - 18:15
OK, here is my very first try with Beanshell:

C:\Dokumente und Einstellungen\User\.jedit\macros\Next_Occurence.bsh:
-----
if (textArea.getSelectedText() == null) {
textArea.selectWord();
}
x = textArea.getSelectedText();
SearchAndReplace.setSearchString(x);
SearchAndReplace.setAutoWrapAround(false);
SearchAndReplace.setReverseSearch(false);
SearchAndReplace.setIgnoreCase(false);
SearchAndReplace.setRegexp(false);
SearchAndReplace.setSearchFileSet(new CurrentBufferSet());
SearchAndReplace.find(view);
textArea.moveCaretPosition(textArea.getSelection(0).getStart());
-----

... and bind this to a shortcut. Smiling)
 
Hi Redoute, I tried this b
by abc123 on Fri, 21/09/2007 - 15:39
Hi Redoute,

I tried this but I got back an error from Beanshell saying

Sourced file: /home/me/.jedit/macros/next_occurence.bsh : Error in method invocation: Method getSelection( int ) not found in class'org.gjt.sp.jedit.textarea.JEditTextArea' : at Line: 12 : in file: /home/me/.jedit3/macros/next_occurence.bsh : textArea .getSelection ( 0 )

Am I missing some packages or something?
 
According to the API docs the
by Redoute on Fri, 21/09/2007 - 17:23
According to the API docs the method getSelection(int) is implemented since jEdit 4.3pre1. If you are using an older version (which probably does not support multiple selections), it may work without the zero, then the last line is:
textArea.moveCaretPosition(textArea.getSelection().getStart());
Without this command the caret (cursor) was set to the end of the text, and the search couldn't be easy continued.
 
I tried leaving out the '0' b
by abc123 on Tue, 25/09/2007 - 12:58
I tried leaving out the '0' but it gave me some other errors (4.2final). So I tried it with 4.3pre9 and it worked! Cool! Thanks very much for your help with this. I might even try doing a few of these .bsh scripts in future!
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