Exemple #1
0
 /** Jumps to a specific line. */
 public void gotoLine() {
   final EditorArea edit = getEditor();
   final int ll = edit.last.length;
   final int cr = edit.getCaret();
   int l = 1;
   for (int e = 0; e < ll && e < cr; e += cl(edit.last, e)) {
     if (edit.last[e] == '\n') ++l;
   }
   final DialogLine dl = new DialogLine(gui, l);
   if (!dl.ok()) return;
   final int el = dl.line();
   int p = 0;
   l = 1;
   for (int e = 0; e < ll && l < el; e += cl(edit.last, e)) {
     if (edit.last[e] != '\n') continue;
     p = e + 1;
     ++l;
   }
   edit.setCaret(p);
   posCode.invokeLater();
 }
Exemple #2
0
 /** Jumps to a specific line. */
 private void gotoLine() {
   final byte[] last = editor.text();
   final int ll = last.length;
   final int cr = getCaret();
   int l = 1;
   for (int e = 0; e < ll && e < cr; e += cl(last, e)) {
     if (last[e] == '\n') ++l;
   }
   final DialogLine dl = new DialogLine(gui, l);
   if (!dl.ok()) return;
   final int el = dl.line();
   l = 1;
   int p = 0;
   for (int e = 0; e < ll && l < el; e += cl(last, e)) {
     if (last[e] != '\n') continue;
     p = e + 1;
     ++l;
   }
   setCaret(p);
   gui.editor.posCode.invokeLater();
 }