mirror of https://github.com/buggins/dlangui.git
support SelectAll by Ctrl+A in editors
This commit is contained in:
parent
08fb2f27d3
commit
354095fa8f
|
|
@ -578,6 +578,8 @@ enum EditorActions {
|
||||||
/// Tab (unindent text, or remove whitespace before cursor, usually Shift+Tab)
|
/// Tab (unindent text, or remove whitespace before cursor, usually Shift+Tab)
|
||||||
BackTab,
|
BackTab,
|
||||||
|
|
||||||
|
/// Select whole content (usually, Ctrl+A)
|
||||||
|
SelectAll,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// base for all editor widgets
|
/// base for all editor widgets
|
||||||
|
|
@ -664,6 +666,7 @@ class EditWidgetBase : WidgetGroup, EditableContentListener {
|
||||||
new Action(EditorActions.BackTab, KeyCode.TAB, KeyFlag.Shift),
|
new Action(EditorActions.BackTab, KeyCode.TAB, KeyFlag.Shift),
|
||||||
|
|
||||||
new Action(EditorActions.ToggleReplaceMode, KeyCode.INS, 0),
|
new Action(EditorActions.ToggleReplaceMode, KeyCode.INS, 0),
|
||||||
|
new Action(EditorActions.SelectAll, KeyCode.KEY_A, KeyFlag.Control),
|
||||||
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
@ -1189,6 +1192,13 @@ class EditWidgetBase : WidgetGroup, EditableContentListener {
|
||||||
return true;
|
return true;
|
||||||
case EditorActions.ToggleReplaceMode:
|
case EditorActions.ToggleReplaceMode:
|
||||||
replaceMode = !replaceMode;
|
replaceMode = !replaceMode;
|
||||||
|
return true;
|
||||||
|
case EditorActions.SelectAll:
|
||||||
|
_selectionRange.start.line = 0;
|
||||||
|
_selectionRange.start.pos = 0;
|
||||||
|
_selectionRange.end = _content.lineEnd(_content.length - 1);
|
||||||
|
_caretPos = _selectionRange.end;
|
||||||
|
ensureCaretVisible();
|
||||||
return true;
|
return true;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
@ -1815,9 +1825,9 @@ class EditBox : EditWidgetBase, OnScrollHandler {
|
||||||
updateMaxLineWidth();
|
updateMaxLineWidth();
|
||||||
|
|
||||||
Point textSz = measureVisibleText();
|
Point textSz = measureVisibleText();
|
||||||
//int maxy = _lineHeight * 10; // limit measured height
|
int maxy = _lineHeight * 5; // limit measured height
|
||||||
//if (textSz.y > maxy)
|
if (textSz.y > maxy)
|
||||||
// textSz.y = maxy;
|
textSz.y = maxy;
|
||||||
measuredContent(parentWidth, parentHeight, textSz.x + vsbwidth, textSz.y + hsbheight);
|
measuredContent(parentWidth, parentHeight, textSz.x + vsbwidth, textSz.y + hsbheight);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue