View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0016177 | Scribus | Internal | public | 2020-07-19 13:58 | 2020-08-11 20:56 |
Reporter | ale | Assigned To | jghali | ||
Priority | normal | Severity | minor | Reproducibility | N/A |
Status | closed | Resolution | fixed | ||
Product Version | 1.5.6.svn | ||||
Fixed in Version | 1.5.6.svn | ||||
Summary | 0016177: Avoid a double check for HasSel | ||||
Description | ... and that early return looks suspicious to me... | ||||
Tags | No tags attached. | ||||
Patch | Yes | ||||
|
has-sel.diff (600 bytes)
diff --git a/scribus/scribus.cpp b/scribus/scribus.cpp index e71846162..84f6f7b19 100644 --- a/scribus/scribus.cpp +++ b/scribus/scribus.cpp @@ -4658,10 +4658,8 @@ void ScribusMainWindow::slotEditCut() cItem = currItem->asTable()->activeCell().textFrame(); else cItem = currItem->asTextFrame(); - if (cItem->HasSel) + if (cItem->HasSel && cItem->itemText.length() > 0 ) { - if ((cItem->itemText.length() == 0) || (!cItem->HasSel)) - return; StoryText itemText(doc); itemText.setDefaultStyle(cItem->itemText.defaultStyle()); itemText.insert(0, cItem->itemText, true); |
|
The patch is wrong as it would lead paste action to be incorrectly enabled in some cases. The early return is correct. In this case the second HasSel check has just to be removed. |
|
imo if there is a reason for returning early only for that specific case, then that should be mentioned in a commentary |
Date Modified | Username | Field | Change |
---|---|---|---|
2020-07-19 13:58 | ale | New Issue | |
2020-07-19 13:58 | ale | File Added: has-sel.diff | |
2020-07-20 08:53 | jghali | Category | General => Internal |
2020-07-20 09:00 | jghali | Assigned To | => jghali |
2020-07-20 09:00 | jghali | Status | new => resolved |
2020-07-20 09:00 | jghali | Resolution | open => fixed |
2020-07-20 09:00 | jghali | Fixed in Version | => 1.5.6.svn |
2020-07-20 09:00 | jghali | Note Added: 0047855 | |
2020-07-20 09:00 | jghali | Summary | PATCH: avoid a double check for HasSel => Avoid a double check for HasSel |
2020-07-20 10:39 | ale | Note Added: 0047856 | |
2020-08-11 20:56 | cbradney | Status | resolved => closed |