changeset 15048:1f316fa0e840

(x-select-text): Remember selected text. (x-get-selection-value): Return nil if the clipboard data is is the same as the remembered selected text.
author Richard M. Stallman <rms@gnu.org>
date Fri, 19 Apr 1996 02:40:44 +0000
parents 4dfe98bde444
children 61ee56ae39ef
files lisp/term/w32-win.el
diffstat 1 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/term/w32-win.el	Thu Apr 18 19:36:33 1996 +0000
+++ b/lisp/term/w32-win.el	Fri Apr 19 02:40:44 1996 +0000
@@ -488,7 +488,8 @@
 
 (defun x-select-text (text &optional push)
   (if x-select-enable-clipboard 
-      (win32-set-clipboard-data text)))
+      (win32-set-clipboard-data text))
+  (setq x-last-selected-text text))
     
 ;;; Return the value of the current selection.
 ;;; Consult the selection, then the cut buffer.  Treat empty strings
@@ -501,7 +502,15 @@
 	    (setq text (win32-get-clipboard-data))
 	  (error (message "win32-get-clipboard-data:%s" c)))
 	(if (string= text "") (setq text nil))
-	text)))
+	(cond
+	 ((not text) nil)
+	 ((eq text x-last-selected-text) nil)
+	 ((string= text x-last-selected-text)
+	  ;; Record the newer string, so subsequent calls can use the 'eq' test.
+	  (setq x-last-selected-text text)
+	  nil)
+	 (t
+	  (setq x-last-selected-text text))))))
 
 ;;; Do the actual Windows setup here; the above code just defines
 ;;; functions and variables that we use now.