Use correct selection after editing cell properties

This commit is contained in:
JulianSmart
2016-10-17 12:40:25 +01:00
parent 7505ccfd6d
commit 682d53fdaa

View File

@@ -9931,11 +9931,14 @@ bool wxRichTextCell::EditProperties(wxWindow* parent, wxRichTextBuffer* buffer)
bool multipleCells = false; bool multipleCells = false;
wxRichTextAttr attr; wxRichTextAttr attr;
if (table && buffer && buffer->GetRichTextCtrl() && buffer->GetRichTextCtrl()->GetSelection().IsValid() && wxRichTextSelection sel;
buffer->GetRichTextCtrl()->GetSelection().GetContainer() == GetParent()) if (buffer->GetRichTextCtrl())
sel = buffer->GetRichTextCtrl()->GetSelection();
if (table && buffer && buffer->GetRichTextCtrl() && sel.IsValid() &&
sel.GetContainer() == GetParent())
{ {
wxRichTextAttr clashingAttr, absentAttr; wxRichTextAttr clashingAttr, absentAttr;
const wxRichTextSelection& sel = buffer->GetRichTextCtrl()->GetSelection();
size_t i; size_t i;
int selectedCellCount = 0; int selectedCellCount = 0;
for (i = 0; i < sel.GetCount(); i++) for (i = 0; i < sel.GetCount(); i++)
@@ -9984,7 +9987,6 @@ bool wxRichTextCell::EditProperties(wxWindow* parent, wxRichTextBuffer* buffer)
{ {
if (multipleCells) if (multipleCells)
{ {
const wxRichTextSelection& sel = buffer->GetRichTextCtrl()->GetSelection();
// Apply the style; we interpret indeterminate attributes as 'don't touch this attribute' // Apply the style; we interpret indeterminate attributes as 'don't touch this attribute'
// since it may represent clashing attributes across multiple objects. // since it may represent clashing attributes across multiple objects.
table->SetCellStyle(sel, attr); table->SetCellStyle(sel, attr);