Make the clipboard size limit configurable

Fixes #3937
This commit is contained in:
Kovid Goyal
2021-08-16 17:29:36 +05:30
parent 56cb628ee8
commit c00e945f6e
5 changed files with 19 additions and 2 deletions

View File

@@ -791,7 +791,8 @@ class Window:
self.clipboard_pending = ClipboardPending(where, text)
else:
self.clipboard_pending = self.clipboard_pending._replace(data=self.clipboard_pending[1] + text)
if len(self.clipboard_pending.data) > 8 * 1024 * 1024:
limit = get_options().clipboard_max_size
if limit and len(self.clipboard_pending.data) > limit * 1024 * 1024:
log_error('Discarding part of too large OSC 52 paste request')
self.clipboard_pending = self.clipboard_pending._replace(data='', truncated=True)
return