Mercurial > hg > RemoteEditor > Eclipse
changeset 48:039451639710
*** empty log message ***
author | pin |
---|---|
date | Fri, 06 Apr 2007 05:09:48 +0900 |
parents | 8b82c0392826 |
children | cd196794b07f |
files | bin/remoteeditor/editors/RemoteEditor.class src/remoteeditor/editors/RemoteEditor.java |
diffstat | 2 files changed, 22 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/remoteeditor/editors/RemoteEditor.java Fri Apr 06 04:56:48 2007 +0900 +++ b/src/remoteeditor/editors/RemoteEditor.java Fri Apr 06 05:09:48 2007 +0900 @@ -129,7 +129,7 @@ if(numberOfLinesNew > numberOfLinesOld){ //insert, delete, replace ‚ð s”‚Å”»’f cmd = REP.REP_INSERT_CMD; - lineText += "\n"; + lineText = "\n"; //line += 1; }else if(numberOfLinesNew == numberOfLinesOld){ cmd = REP.REP_REPLACE_CMD; @@ -209,7 +209,7 @@ break; case REP.REP_INSERT_CMD: try { - changeText(command.cmd, command.lineno, command.len, command.string); + textInsert(command.lineno, command.len, command.string); } catch (Exception e) { e.printStackTrace(); } @@ -231,6 +231,26 @@ } } + private void textInsert(int lineNo, int j, String text) throws BadLocationException { + final int offset = document.getLineOffset(lineNo - 1); + final String changedText = text; + + //final int replaceLength = document.getLineLength(lineNo); + + viewer.getTextWidget().getDisplay().syncExec(new Runnable() { + public void run() { + try { + lock = true; + //document.replace(offset, replaceLength, changedText); + document.replace(offset, 0, changedText); + lock = false; + } catch (BadLocationException e) { + e.printStackTrace(); + } + } + }); + } + private void receiveReadCMD() throws BadLocationException { for(int i = 0; i < document.getNumberOfLines(); i++){ int offset = document.getLineOffset(i);