Skip to content

Commit

Permalink
Only allow one of the data types (#753)
Browse files Browse the repository at this point in the history
On Linux I encountered the bug that a file path was treated both as
file path data object and as text object.
  • Loading branch information
tobiolo authored Nov 14, 2024
1 parent 2310b25 commit 7589517
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/document.h
Original file line number Diff line number Diff line change
Expand Up @@ -2036,7 +2036,6 @@ struct Document {
void PasteOrDrop(const wxTextDataObject &pdataobjt, const wxBitmapDataObject &pdataobji,
const wxFileDataObject &pdataobjf) {
wxBusyCursor wait;
bool wantsrefresh = false;

if (pdataobjf.GetFilenames().size() != 0) {
const wxArrayString &as = pdataobjf.GetFilenames();
Expand Down Expand Up @@ -2067,7 +2066,8 @@ struct Document {
c->AddUndo(this);
if (!LoadImageIntoCell(as[0], c, sys->frame->FromDIP(1.0)))
PasteSingleText(c, as[0]);
wantsrefresh = true;
Refresh();
return;
}
}

Expand All @@ -2078,7 +2078,6 @@ struct Document {
wxString s = pdataobjt.GetText();
if ((sys->clipboardcopy == s) && sys->cellclipboard) {
c->Paste(this, sys->cellclipboard.get(), selected);
wantsrefresh = true;
} else {
const wxArrayString &as = wxStringTokenize(s, LINE_SEPERATOR);
if (as.size()) {
Expand All @@ -2094,9 +2093,10 @@ struct Document {
if (!c->HasText())
c->grid->MergeWithParent(c->parent->grid, selected, this);
}
wantsrefresh = true;
}
}
Refresh();
return;
}

if (pdataobji.GetBitmap().GetRefData() != wxNullBitmap.GetRefData()) {
Expand All @@ -2105,10 +2105,9 @@ struct Document {
std::vector<uint8_t> idv = ConvertWxImageToBuffer(im, wxBITMAP_TYPE_PNG);
SetImageBM(c, std::move(idv), sys->frame->FromDIP(1.0));
c->Reset();
wantsrefresh = true;
Refresh();
return;
}

if (wantsrefresh) Refresh();
}

const wxChar *Sort(bool descending) {
Expand Down

0 comments on commit 7589517

Please sign in to comment.