correct cursor movement after typing

git-svn-id: svn://svn.code.sf.net/p/magicseteditor/code/trunk@110 0fc631ac-6414-0410-93d0-97cfa31319b6
This commit is contained in:
twanvl
2006-12-11 00:15:23 +00:00
parent 0a69db594e
commit 725d3a536f
4 changed files with 26 additions and 11 deletions
+11 -3
View File
@@ -224,7 +224,15 @@ void TextValueEditor::onMenu(wxCommandEvent& ev) {
void TextValueEditor::draw(RotatedDC& dc) {
TextValueViewer::draw(dc);
v.drawSelection(dc, style(), selection_start, selection_end);
if (isCurrent()) {
v.drawSelection(dc, style(), selection_start, selection_end);
// show caret, onAction() would be a better place
// but it has to be done after the viewer has updated the TextViewer
// we could do that ourselfs, but we need a dc for that
fixSelection();
showCaret();
}
// DEBUG, TODO: REMOVEME
Rotater r(dc, style().getRotation());
/*dc.SetPen(*wxRED_PEN);
@@ -269,8 +277,6 @@ void TextValueEditor::onAction(const ValueAction& action, bool undone) {
TYPE_CASE(action, TextValueAction) {
selection_start = action.selection_start;
selection_end = action.selection_end;
fixSelection();
if (isCurrent()) showCaret();
}
}
@@ -437,6 +443,8 @@ void TextValueEditor::replaceSelection(const String& replacement, const String&
moveSelection(selection_start);
return;
}
// perform the action
// NOTE: this calls our onAction, invalidating the text viewer and moving the selection around the new text
getSet().actions.add(action);
// move cursor
if (field().move_cursor_with_sort && replacement.size() == 1) {