Changeset 532
- Timestamp:
- 01/21/10 22:12:36 (3 years ago)
- Location:
- trunk/src/sce
- Files:
-
- 4 modified
-
codehelper/CodeHelperPane.java (modified) (1 diff)
-
component/SCEDocument.java (modified) (2 diffs)
-
component/SCEPaneUI.java (modified) (1 diff)
-
component/SCESearch.java (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/sce/codehelper/CodeHelperPane.java
r407 r532 414 414 } 415 415 416 // begin... end completion 417 if(e.getKeyChar() == '}') { 418 String begin = "\\begin"; 419 420 int index = column-1; 421 String rowString = document.getRow(row); 422 while(index > 0) { 423 char c = rowString.charAt(index); 424 if(c == '{') break; 425 if(!Character.isLetterOrDigit(c)) return; 426 index--; 427 } 428 String environment = rowString.substring(index+1, column); 429 430 int beginIndex = index - begin.length(); 431 if(beginIndex < 0) return; 432 if(rowString.substring(beginIndex, index).equals(begin)) { 433 String indentation = spaces.substring(0, beginIndex); 434 pane.setFreezeCaret(true); 435 document.insert("\n" + indentation + "\\end{" + environment + "}", row, column); 436 pane.setFreezeCaret(false); 437 } 438 e.consume(); 439 return; 440 } 441 416 442 // tab completion 417 443 if(e.getKeyCode() == KeyEvent.VK_TAB){ -
trunk/src/sce/component/SCEDocument.java
r527 r532 145 145 */ 146 146 public void setText(String text){ 147 // treat Windows line breaks 148 if(text.indexOf((char) 0x0D) != -1) { 149 StringBuilder builder = new StringBuilder(text.length()); 150 int lastIndex = 0, index = -1; 151 while((index = text.indexOf((char) 0x0D, index+1)) != -1) { 152 builder.append(text.substring(lastIndex, index)); 153 lastIndex = index + 1; 154 } 155 builder.append(text.substring(lastIndex)); 156 text = builder.toString(); 157 } 158 147 159 clear(); 148 160 boolean editable_ = editable; … … 817 829 * @param listener the listener 818 830 */ 819 public void removeSCE DocumentListener(SCESelectionListener listener){831 public void removeSCESelectionListener(SCESelectionListener listener){ 820 832 selectionListeners.remove(listener); 821 833 } -
trunk/src/sce/component/SCEPaneUI.java
r510 r532 35 35 "äöüÄÖÜß" + 36 36 "1234567890" + 37 "^<>|+*~'#,;.:-_!\"§$%&/()=?`´\\{[]} ";37 "^<>|+*~'#,;.:-_!\"§$%&/()=?`´\\{[]}@ "; 38 38 39 39 public SCEPaneUI(SCEPane pane){ -
trunk/src/sce/component/SCESearch.java
r528 r532 2 2 3 3 import javax.swing.*; 4 import javax.swing.text.Document;5 4 import java.awt.*; 6 5 import java.awt.event.ActionEvent; … … 144 143 .addGap(2); 145 144 146 SCEPane pane = editor.getTextPane();147 pane.addKeyListener(this);148 pane.getDocument().addSCEDocumentListener(this);149 pane.getDocument().addSCESelectionListener(this);150 151 145 layout.setHorizontalGroup(groupHorizontal); 152 146 layout.setVerticalGroup(groupVertical); 147 148 SCEPane pane = editor.getTextPane(); 149 SCEDocument document = pane.getDocument(); 150 pane.addKeyListener(this); 151 document.addSCEDocumentListener(this); 152 document.addSCESelectionListener(this); 153 153 154 154 updateThread = new UpdateThread(); … … 181 181 } 182 182 183 public void close() { 184 setVisible(false); 185 clearHighlights(); 183 public void setVisible(boolean visibility) { 184 if(visibility) { 185 input.setText(""); 186 } else { 187 clearHighlights(); 188 } 189 super.setVisible(visibility); 186 190 } 187 191 … … 227 231 228 232 public void actionPerformed(ActionEvent e) { 229 if(e.getSource() == buttonClose) close();233 if(e.getSource() == buttonClose) setVisible(false); 230 234 if(e.getSource() == caseSensitive) { 231 235 updateThread.documentChanged(); … … 274 278 public void keyPressed(KeyEvent e) { 275 279 if(e.getKeyCode() == KeyEvent.VK_ESCAPE){ 276 close();280 setVisible(false); 277 281 e.consume(); 278 282 } … … 320 324 public synchronized void searchChanged() { 321 325 searchChanged = true; 326 if(!isVisible()) return; 322 327 notify(); 323 328 } … … 325 330 public synchronized void documentChanged() { 326 331 documentChanged = true; 332 if(!isVisible()) return; 327 333 notify(); 328 334 } … … 441 447 } 442 448 if(!searchChanged && !documentChanged) continue; 449 if(!isVisible()) continue; 443 450 444 451 // update document information
![(please configure the [header_logo] section in trac.ini)](http://jlatexeditor.endrullis.de/chrome/site/logo.png)