jEdit Community - Resources for users of the jEdit Text Editor
java.lang.RuntimeException: Invalid screen line count: 0
Submitted by oimara475 on Tuesday, 29 August, 2006 - 20:16
Hi,

I am trying to run a very simple macro, which should find duplicated lines and delete the second one.


textArea.goToBufferStart(false);
SearchAndReplace.setSearchString("(^  LK-\\d+)(.+$\\n)([\\w\\W]*?)(^  LK-\\d+)\\2");
SearchAndReplace.setAutoWrapAround(true);
SearchAndReplace.setReverseSearch(false);
SearchAndReplace.setIgnoreCase(false);
SearchAndReplace.setRegexp(true);
SearchAndReplace.setSearchFileSet(new CurrentBufferSet());
SearchAndReplace.setReplaceString("$1$2$3");
SearchAndReplace.setBeanShellReplace(false);
while (SearchAndReplace.find(view) == true)
{
textArea.goToBufferStart(false);
SearchAndReplace.replaceAll(view);
}


While the macro is executing, the following error occurs, several times.

java.lang.RuntimeException: Invalid screen line count: 0
at org.gjt.sp.jedit.textarea.DisplayManager.getScreenLineCount(DisplayManager.java:187)
at org.gjt.sp.jedit.textarea.FirstLine.physDown(FirstLine.java:167)
at org.gjt.sp.jedit.textarea.DisplayManager.setFirstPhysicalLine(DisplayManager.java:621)
at org.gjt.sp.jedit.textarea.JEditTextArea.setFirstPhysicalLine(JEditTextArea.java:545)
at org.gjt.sp.jedit.textarea.JEditTextArea.scrollTo(JEditTextArea.java:767)
at org.gjt.sp.jedit.textarea.JEditTextArea.scrollTo(JEditTextArea.java:673)
at org.gjt.sp.jedit.search.SearchAndReplace.find(SearchAndReplace.java:641)
at org.gjt.sp.jedit.search.SearchAndReplace.find(SearchAndReplace.java:498)
at sun.reflect.GeneratedMethodAccessor18.invoke(Unknown Source)
(...)

The same problem with this macro:

textArea.goToBufferStart(false);
SearchAndReplace.setSearchString("^(  LK-)(\\d+)");
SearchAndReplace.setAutoWrapAround(false);
SearchAndReplace.setReverseSearch(false);
SearchAndReplace.setIgnoreCase(false);
SearchAndReplace.setRegexp(true);
SearchAndReplace.setSearchFileSet(new CurrentBufferSet());
SearchAndReplace.setBeanShellReplace(true);
SearchAndReplace.setReplaceString("_1 + (textArea.getSelectionStartLine() - 2)");

var n = textArea.getLineCount();
for (i = 0; i <= n - 2; i++)
{
SearchAndReplace.find(view);
SearchAndReplace.replace(view);
}

Has anybody got a hint, what the problem might be?

Martin
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