comparison lisp/term/x-win.el @ 4236:8e14db210975

(x-select-text): Limit size of text sent to cut buffer.
author Richard M. Stallman <rms@gnu.org>
date Fri, 23 Jul 1993 01:43:39 +0000
parents e0345afdf64e
children af9d2ade78ed
comparison
equal deleted inserted replaced
4235:55182207415d 4236:8e14db210975
489 ;;; We keep track of the last text selected here, so we can check the 489 ;;; We keep track of the last text selected here, so we can check the
490 ;;; current selection against it, and avoid passing back our own text 490 ;;; current selection against it, and avoid passing back our own text
491 ;;; from x-cut-buffer-or-selection-value. 491 ;;; from x-cut-buffer-or-selection-value.
492 (defvar x-last-selected-text nil) 492 (defvar x-last-selected-text nil)
493 493
494 (defvar x-cut-buffer-max 20000
495 "Max number of characters to put in the cut buffer.")
496
494 ;;; Make TEXT, a string, the primary and clipboard X selections. 497 ;;; Make TEXT, a string, the primary and clipboard X selections.
495 ;;; If you are running xclipboard, this means you can effectively 498 ;;; If you are running xclipboard, this means you can effectively
496 ;;; have a window on a copy of the kill-ring. 499 ;;; have a window on a copy of the kill-ring.
497 ;;; Also, set the value of X cut buffer 0, for backward compatibility 500 ;;; Also, set the value of X cut buffer 0, for backward compatibility
498 ;;; with older X applications. 501 ;;; with older X applications.
499 (defun x-select-text (text &optional push) 502 (defun x-select-text (text &optional push)
500 (x-set-cut-buffer text push) 503 ;; Don't send the cut buffer too much text.
504 ;; It becomes slow, and if really big it causes errors.
505 (if (< (length text) x-cut-buffer-max)
506 (x-set-cut-buffer text push))
501 (x-set-selection 'CLIPBOARD text) 507 (x-set-selection 'CLIPBOARD text)
502 (x-set-selection 'PRIMARY text) 508 (x-set-selection 'PRIMARY text)
503 (setq x-last-selected-text text)) 509 (setq x-last-selected-text text))
504 510
505 ;;; Return the value of the current X selection. For compatibility 511 ;;; Return the value of the current X selection. For compatibility