comparison lisp/term/x-win.el @ 4246:af9d2ade78ed

(x-select-text): Always set the cut buffer, but sometimes set it to nothing. Don't put large strings in clipboard.
author Richard M. Stallman <rms@gnu.org>
date Fri, 23 Jul 1993 17:24:45 +0000
parents 8e14db210975
children 79dc5c3370f8
comparison
equal deleted inserted replaced
4245:5988aab467cc 4246:af9d2ade78ed
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 ;;; It is said that overlarge strings are slow to put into the cut buffer,
495 ;;; and would crash the clipboard.
494 (defvar x-cut-buffer-max 20000 496 (defvar x-cut-buffer-max 20000
495 "Max number of characters to put in the cut buffer.") 497 "Max number of characters to put in the cut buffer or clipboard.")
496 498
497 ;;; Make TEXT, a string, the primary and clipboard X selections. 499 ;;; Make TEXT, a string, the primary and clipboard X selections.
498 ;;; If you are running xclipboard, this means you can effectively 500 ;;; If you are running xclipboard, this means you can effectively
499 ;;; have a window on a copy of the kill-ring. 501 ;;; have a window on a copy of the kill-ring.
500 ;;; Also, set the value of X cut buffer 0, for backward compatibility 502 ;;; Also, set the value of X cut buffer 0, for backward compatibility
501 ;;; with older X applications. 503 ;;; with older X applications.
502 (defun x-select-text (text &optional push) 504 (defun x-select-text (text &optional push)
503 ;; Don't send the cut buffer too much text. 505 ;; Don't send the cut buffer too much text.
504 ;; It becomes slow, and if really big it causes errors. 506 ;; It becomes slow, and if really big it causes errors.
505 (if (< (length text) x-cut-buffer-max) 507 (if (< (length text) x-cut-buffer-max)
506 (x-set-cut-buffer text push)) 508 (progn
507 (x-set-selection 'CLIPBOARD text) 509 (x-set-cut-buffer text push)
510 (x-set-selection 'CLIPBOARD text))
511 (x-set-cut-buffer "" push))
508 (x-set-selection 'PRIMARY text) 512 (x-set-selection 'PRIMARY text)
509 (setq x-last-selected-text text)) 513 (setq x-last-selected-text text))
510 514
511 ;;; Return the value of the current X selection. For compatibility 515 ;;; Return the value of the current X selection. For compatibility
512 ;;; with older X applications, this checks cut buffer 0 before 516 ;;; with older X applications, this checks cut buffer 0 before