[qlipper] breaks copying from emacs #35

Closed
RalfJung opened this Issue Apr 19, 2016 · 6 comments

Comments

Projects
None yet
4 participants
@RalfJung

RalfJung commented Apr 19, 2016

Steps to reproduce

  • Start qlipper
  • In emacs, select some text and hit M-w to copy it to the yank ring
  • In some other application like Firefox, hit Ctrl-V to paste

Actual behavior

  • Nothing happens, or I get the previous content of the clipboard

Expected behavior:
The text I copied in emacs should be pasted. If I quit qlipper, and do this all again, I see the expected behavior.

Further information:
emacs shows an error when I do M-w while qlipper is running:

Selection owner couldn't convert: MULTIPLE

I don't know what that means, but maybe it is helpful...

@ufleisch

This comment has been minimized.

Show comment
Hide comment
@ufleisch

ufleisch May 10, 2016

Contributor

I can confirm this.
To fix it, you could add in QlipperItem::QlipperItem(QClipboard::Mode mode)

if (format != "MULTIPLE")
    m_content[format] = mimeData->data(format);

However, this could be further improved. There are still useless binary entries in the clipboard history, because Emacs has a lot of strange (probably internal) formats in its clipboard entries ("TIMESTAMP", "MULTIPLE", "text/plain", "COMPOUND_TEXT", "TARGETS", "LENGTH", "DELETE", "FILE_NAME", "CHARACTER_POSITION", "LINE_NUMBER", "COLUMN_NUMBER", "OWNER_OS", "HOST_NAME", "USER", "CLASS", "NAME", "ATOM", "INTEGER", "SAVE_TARGETS"
"text/plain;charset=utf-8" for a simple copied text). Maybe it would be better to restrict the saved content to "real" MIME data, e.g. using something like this:

if (format.contains(QLatin1Char('/')))
    m_content[format] = mimeData->data(format);

or only store the basic data types provided by QMimeData (text(), html(), urls(), imageData(), colorData()).

Contributor

ufleisch commented May 10, 2016

I can confirm this.
To fix it, you could add in QlipperItem::QlipperItem(QClipboard::Mode mode)

if (format != "MULTIPLE")
    m_content[format] = mimeData->data(format);

However, this could be further improved. There are still useless binary entries in the clipboard history, because Emacs has a lot of strange (probably internal) formats in its clipboard entries ("TIMESTAMP", "MULTIPLE", "text/plain", "COMPOUND_TEXT", "TARGETS", "LENGTH", "DELETE", "FILE_NAME", "CHARACTER_POSITION", "LINE_NUMBER", "COLUMN_NUMBER", "OWNER_OS", "HOST_NAME", "USER", "CLASS", "NAME", "ATOM", "INTEGER", "SAVE_TARGETS"
"text/plain;charset=utf-8" for a simple copied text). Maybe it would be better to restrict the saved content to "real" MIME data, e.g. using something like this:

if (format.contains(QLatin1Char('/')))
    m_content[format] = mimeData->data(format);

or only store the basic data types provided by QMimeData (text(), html(), urls(), imageData(), colorData()).

@RalfJung

This comment has been minimized.

Show comment
Hide comment
@RalfJung

RalfJung May 26, 2016

That sounds good. Any chance some patch like this could get in? Is qlipper maintained?

That sounds good. Any chance some patch like this could get in? Is qlipper maintained?

@agaida

This comment has been minimized.

Show comment
Hide comment
@agaida

agaida May 26, 2016

Contributor

just make a PR i would suggest :)

Contributor

agaida commented May 26, 2016

just make a PR i would suggest :)

@RalfJung

This comment has been minimized.

Show comment
Hide comment
@RalfJung

RalfJung May 26, 2016

I patched it locally, and will see whether I notice any breakage.

I patched it locally, and will see whether I notice any breakage.

@ufleisch

This comment has been minimized.

Show comment
Hide comment
@ufleisch

ufleisch May 27, 2016

Contributor

Just made a PR.

Contributor

ufleisch commented May 27, 2016

Just made a PR.

pvanek added a commit that referenced this issue Sep 19, 2016

Merge pull request #37 from ufleisch/emacs
Do not prevent Emacs from using clipboard, only store mime data, #35.
@palinek

This comment has been minimized.

Show comment
Hide comment
@palinek

palinek Sep 19, 2016

Collaborator

fixed in #37

Collaborator

palinek commented Sep 19, 2016

fixed in #37

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment