add 'edited' read-only textbox property
This commit is contained in:
@@ -141,10 +141,7 @@ namespace gui {
|
||||
auto action =
|
||||
std::make_unique<InputAction>(getTextBoxWeakptr(), pos, string);
|
||||
history.store(std::move(action), erasing);
|
||||
pos = -1;
|
||||
length = 0;
|
||||
ss = {};
|
||||
erasing = false;
|
||||
reset();
|
||||
}
|
||||
|
||||
void undo() {
|
||||
@@ -160,6 +157,17 @@ namespace gui {
|
||||
history.redo();
|
||||
locked = false;
|
||||
}
|
||||
|
||||
void reset() {
|
||||
pos = -1;
|
||||
length = 0;
|
||||
erasing = false;
|
||||
ss = {};
|
||||
}
|
||||
|
||||
bool isSynced() const {
|
||||
return length == 0;
|
||||
}
|
||||
private:
|
||||
TextBox& textBox;
|
||||
ActionsHistory& history;
|
||||
@@ -556,6 +564,10 @@ bool TextBox::isEditable() const {
|
||||
return editable;
|
||||
}
|
||||
|
||||
bool TextBox::isEdited() const {
|
||||
return history->size() != 0 || !historian->isSynced();
|
||||
}
|
||||
|
||||
size_t TextBox::getSelectionStart() const {
|
||||
return selectionStart;
|
||||
}
|
||||
@@ -986,6 +998,8 @@ const std::wstring& TextBox::getText() const {
|
||||
void TextBox::setText(const std::wstring& value) {
|
||||
this->input = value;
|
||||
input.erase(std::remove(input.begin(), input.end(), '\r'), input.end());
|
||||
historian->reset();
|
||||
history->clear();
|
||||
refreshSyntax();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user