Don't copy empty selected text.

This commit is contained in:
John Preston 2023-06-27 20:26:43 +04:00
parent b46659eb22
commit fda2f56fd8
2 changed files with 7 additions and 3 deletions

View File

@ -2341,7 +2341,8 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
const auto item = _dragStateItem;
const auto itemId = item ? item->fullId() : FullMsgId();
if (isUponSelected > 0) {
if (!hasCopyRestrictionForSelected()) {
if (!hasCopyRestrictionForSelected()
&& !getSelectedText().empty()) {
_menu->addAction(
(isUponSelected > 1
? tr::lng_context_copy_selected_items(tr::now)
@ -2442,7 +2443,8 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
: QString();
if (isUponSelected > 0) {
if (!hasCopyRestrictionForSelected()) {
if (!hasCopyRestrictionForSelected()
&& !getSelectedText().empty()) {
_menu->addAction(
((isUponSelected > 1)
? tr::lng_context_copy_selected_items(tr::now)

View File

@ -995,7 +995,9 @@ base::unique_qptr<Ui::PopupMenu> FillContextMenu(
list,
st::popupMenuWithIcons);
if (request.overSelection && !list->hasCopyRestrictionForSelected()) {
if (request.overSelection
&& !list->hasCopyRestrictionForSelected()
&& !list->getSelectedText().empty()) {
const auto text = request.selectedItems.empty()
? tr::lng_context_copy_selected(tr::now)
: tr::lng_context_copy_selected_items(tr::now);