fix for bug #349 with selection chars, more normalization of key commands

This commit is contained in:
benfry
2006-11-10 16:20:49 +00:00
parent a2aa3db784
commit c3c044d295
2 changed files with 43 additions and 19 deletions

View File

@@ -747,11 +747,17 @@ public abstract class InputHandler extends KeyAdapter
return;
}
if(select)
textArea.select(textArea.getMarkPosition(),
caret + 1);
else
textArea.setCaretPosition(caret + 1);
if (select) {
textArea.select(textArea.getMarkPosition(), caret+1);
} else {
int start = textArea.getSelectionStart();
int end = textArea.getSelectionEnd();
if (start != end) {
textArea.select(end, end);
} else {
textArea.setCaretPosition(caret + 1);
}
}
}
}
@@ -899,11 +905,17 @@ public abstract class InputHandler extends KeyAdapter
return;
}
if(select)
textArea.select(textArea.getMarkPosition(),
caret - 1);
else
textArea.setCaretPosition(caret - 1);
if (select) {
textArea.select(textArea.getMarkPosition(), caret-1);
} else {
int start = textArea.getSelectionStart();
int end = textArea.getSelectionEnd();
if (start != end) {
textArea.select(start, start);
} else {
textArea.setCaretPosition(caret - 1);
}
}
}
}