espanso icon indicating copy to clipboard operation
espanso copied to clipboard

remove 2048 byte clipboard limit for macOS

Open woerndl opened this issue 1 year ago • 2 comments

This resolves #1612 and #2051 on macOS, similar to the attempt #2085 on Windows.

The fix has been tested with multi-byte characters and large clipboard contents, even exceeding 10 MB. There is a caveat regarding memory management on macOS: Real and private memory are released as expected after copying large clipboard contents, but virtual memory still gradually increases over time. This PR doesn't resolve Espanso's general memory release issues on macOS, but it doesn't worsen them either. But it simplifies debugging by allowing tests with clipboard contents larger than 2 bytes.

Before this is released, it would be great if someone with more experience than I have to review not only this PR but also the overall memory management of Espanso (#1675). Especially since Espanso doesn't use ARC, I suspect there are parts of the code that could lead to leaks under certain circumstances. Probably in addition to the block Federico already identified in #1675.

The coding style in these files wasn't very consistent yet, so I maintained alignment on a per-file basis. Comments were added in a manner similar to those in the code for Windows.

woerndl avatar Oct 05 '24 16:10 woerndl

I just noticed that I completely overlooked #2087 because it wasn't reflected in the issue the last time I checked. As I needed a fix, Espanso was bordering on being unusable for me due to this problem. Perhaps Kroum can use some of this. Otherwise, feel free to close. Thanks to everyone involved for trying to fix this.

woerndl avatar Oct 05 '24 16:10 woerndl

Thank you! Don't worry, I still appreciate the effort you took in making this PR 😄 . I'll keep this open until one of the prs is merged and verified 💯

AucaCoyan avatar Oct 06 '24 20:10 AucaCoyan

Finally I could test this approach and it passed every test 🚀 . Merging!

AucaCoyan avatar Mar 06 '25 12:03 AucaCoyan

Thank you very much for your work! ❤️

PAPAMICA avatar Mar 06 '25 12:03 PAPAMICA

Thank you for your efforts. Please excuse my ignorance here - do I have to wait for this to be packaged in a release or is there documentation somewhere for installing from the dev branch? I see the last release was in 2023 - do we anticipate this being included in a release anytime soon?

marijuanatech avatar Mar 21 '25 13:03 marijuanatech

We're working on a Release, but the certification for macOS is a hurdle. In the meantime, you'd have to compile from the repo, following the instructions in the documentation, in order to take advantage of the new feature (and others, awaiting documentation).

smeech avatar Mar 21 '25 16:03 smeech