java.lang.RuntimeException: Invalid screen line count: 0
Submitted by Tuesday, 29 August, 2006 - 20:16
on
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
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