diff --git a/library/tedit/TEDIT-WINDOW b/library/tedit/TEDIT-WINDOW
index 04d9cf75..562b849b 100644
--- a/library/tedit/TEDIT-WINDOW
+++ b/library/tedit/TEDIT-WINDOW
@@ -1,10 +1,11 @@
 (DEFINE-FILE-INFO :PACKAGE "INTERLISP" :READTABLE "INTERLISP" :BASE 10)
 
-(FILECREATED "13-May-2026 09:38:48" {MEDLEY}<library>tedit>TEDIT-WINDOW.;900 235247 
+(FILECREATED "14-May-2026 23:20:59" {MEDLEY}<library>TEDIT>TEDIT-WINDOW.;904 236190 
 
       :EDIT-BY rmk
 
-      :CHANGES-TO (FNS \TEDIT.BUTTONEVENTFN)
+      :CHANGES-TO (FNS \TEDIT.BUTTONEVENTFN \TEDIT.CURSORINFN \TEDIT.MINIMAL.WINDOW.SETUP)
+                  (VARS TEDIT-WINDOWCOMS)
 
       :PREVIOUS-DATE "10-May-2026 18:05:02" {MEDLEY}<library>tedit>TEDIT-WINDOW.;899)
 
@@ -26,9 +27,10 @@
         (FNS TEDIT.DEFER.UPDATES)
         (FNS \TEDIT.WINDOW.CREATE \TEDIT.WINDOW.GETREGION \TEDIT.WINDOW.SETUP 
              \TEDIT.MINIMAL.WINDOW.SETUP \TEDIT.CLEARPANE \TEDIT.FILL.PANES)
-        (FNS \TEDIT.CURSORMOVEDFN \TEDIT.CURSOROUTFN \TEDIT.ACTIVE.WINDOWP \TEDIT.EXPANDFN 
-             \TEDIT.MAINW \TEDIT.MAINSTREAM \TEDIT.PRIMARYPANE \TEDIT.PANELIST \TEDIT.NEWREGIONFN 
-             \TEDIT.SET.WINDOW.EXTENT \TEDIT.SHRINK.ICONCREATE \TEDIT.SHRINKFN \TEDIT.PANEREGION)
+        (FNS \TEDIT.CURSORMOVEDFN \TEDIT.CURSOROUTFN \TEDIT.CURSORINFN \TEDIT.ACTIVE.WINDOWP 
+             \TEDIT.EXPANDFN \TEDIT.MAINW \TEDIT.MAINSTREAM \TEDIT.PRIMARYPANE \TEDIT.PANELIST 
+             \TEDIT.NEWREGIONFN \TEDIT.SET.WINDOW.EXTENT \TEDIT.SHRINK.ICONCREATE \TEDIT.SHRINKFN 
+             \TEDIT.PANEREGION)
         
         (* ;; "Button events")
 
@@ -620,7 +622,8 @@
           (\TEDIT.SET.WINDOW.EXTENT TEXTOBJ PANE])
 
 (\TEDIT.MINIMAL.WINDOW.SETUP
-  [LAMBDA (PANEWINDOW TSTREAM PROPS)                         (* ; "Edited 23-Dec-2025 23:41 by rmk")
+  [LAMBDA (PANEWINDOW TSTREAM PROPS)                         (* ; "Edited 14-May-2026 17:30 by rmk")
+                                                             (* ; "Edited 23-Dec-2025 23:41 by rmk")
                                                              (* ; "Edited 20-Dec-2025 23:04 by rmk")
                                                              (* ; "Edited 19-Oct-2025 14:55 by rmk")
                                                              (* ; "Edited 20-Apr-2025 15:19 by rmk")
@@ -633,14 +636,15 @@
                                                              (* ; "Edited 30-Jun-2024 08:55 by rmk")
                                                              (* ; "Edited 25-Jun-2024 00:04 by rmk")
                                                              (* ; "Edited 13-Jun-2024 21:51 by rmk")
-                                                             (* ; "Edited 20-Mar-2024 11:22 by rmk")
-                                                             (* ; "Edited 22-Feb-2024 23:14 by rmk")
-                                                             (* ; "Edited 26-Jan-2024 13:14 by rmk")
-                                                             (* ; "Edited  2-Jan-2024 17:27 by rmk")
-                                                             (* ; "Edited 21-Dec-2023 17:19 by rmk")
-                                                             (* ; "Edited 20-Nov-2023 10:40 by rmk")
-                                                             (* ; "Edited  4-Oct-2023 09:48 by rmk")
-                                                             (* ; "Edited 18-Sep-2023 23:44 by rmk")
+                                                             (* ; "Edited 20-Mar-2024 11:22 by rmk")
+                                                             (* ; 
+                                                            "CURSORINEdited 22-Feb-2024 23:14 by rmk")
+                                                             (* ; "Edited 26-Jan-2024 13:14 by rmk")
+                                                             (* ; "Edited  2-Jan-2024 17:27 by rmk")
+                                                             (* ; "Edited 21-Dec-2023 17:19 by rmk")
+                                                             (* ; "Edited 20-Nov-2023 10:40 by rmk")
+                                                             (* ; "Edited  4-Oct-2023 09:48 by rmk")
+                                                             (* ; "Edited 18-Sep-2023 23:44 by rmk")
                                                              (* ; "Edited 30-May-91 23:33 by jds")
 
     (* ;; "Do the minimum setup so that the window PANEWINDOW becomes the window of a pane of TSTREAM and TSTREAM and PANE know about each other.  Does NOT include mouse interface or scrolling/lines.")
@@ -699,6 +703,7 @@
 
          (WINDOWPROP PANEWINDOW 'CURSORMOVEDFN (FUNCTION \TEDIT.CURSORMOVEDFN))
          (WINDOWPROP PANEWINDOW 'CURSOROUTFN (FUNCTION \TEDIT.CURSOROUTFN))
+         (WINDOWPROP PANEWINDOW 'CURSORINFN (FUNCTION \TEDIT.CURSORINFN))
          (WINDOWPROP PANEWINDOW 'BUTTONEVENTFN (FUNCTION \TEDIT.BUTTONEVENTFN))
          (WINDOWPROP PANEWINDOW 'RIGHTBUTTONFN (FUNCTION \TEDIT.BUTTONEVENTFN))
          (WINDOWPROP PANEWINDOW 'IMAGETYPE 'TEDIT)           (* ; "For hardcopy")
@@ -879,6 +884,21 @@
                MOUSEREGION
                'TEXT))])
 
+(\TEDIT.CURSORINFN
+  [LAMBDA (PANE)                                             (* ; "Edited 14-May-2026 22:47 by rmk")
+
+    (* ;; "This runs when the mouse comes into a Tedit window from outside.  The mouse may have gone outside while it was being tracked by \TEDIT.BUTTONEVENTFN while there was a secondary selection in the stream and on the screen.  If the window still has (or somehow regained) the TTY (because it wasn't given to anybody else when the mouse was outside) and the mode keys are the same (or were regained) for that secondary selection, then we want to set things up so the mouse tracker is in the state it was when it exited.  But if those conditions don't hold, we at least consistently flush that secondary selection and wait for a click to tell us what to do.")
+
+    (LET ((TEXTOBJ (PANETEXTOBJ PANE))
+          SECSEL)
+         (if [AND (EQ (WINDOWPROP PANE 'PROCESS)
+                      (TTY.PROCESS))
+                  (SETQ SECSEL (FGETTOBJ TEXTOBJ SECONDARYSEL))
+                  (EQ (GETSEL SECSEL SELOPERATION)
+                      (\TEDIT.BUTTONEVENTFN.GETOPERATION (FGETTOBJ TEXTOBJ TXTREADONLY]
+             then (\TEDIT.BUTTONEVENTFN PANE)
+           else (\TEDIT.SECONDARYSEL.OFF (PANETEXTSTREAM PANE])
+
 (\TEDIT.ACTIVE.WINDOWP
   [LAMBDA (W)                                                (* ; "Edited 27-Apr-2025 13:07 by rmk")
                                                              (* ; "Edited 20-Mar-2024 09:38 by rmk")
@@ -1157,7 +1177,8 @@
 (DEFINEQ
 
 (\TEDIT.BUTTONEVENTFN
-  [LAMBDA (PANE)                                             (* ; "Edited 13-May-2026 09:32 by rmk")
+  [LAMBDA (PANE)                                             (* ; "Edited 14-May-2026 23:20 by rmk")
+                                                             (* ; "Edited 13-May-2026 13:26 by rmk")
                                                              (* ; "Edited 15-Jan-2026 00:39 by rmk")
                                                              (* ; "Edited 11-Jan-2026 08:30 by rmk")
                                                              (* ; "Edited  6-May-2025 20:35 by rmk")
@@ -1186,165 +1207,156 @@
     (* ;; "Handle mouse buttons that are clicked in a TEdit pane.  ")
 
     (TOTOPW PANE)
-    (CL:WHEN (MOUSESTATE (OR LEFT MIDDLE RIGHT))
-
-        (* ;; "If no button is down, we got control on button-up transition, so ignore it.")
-
-        (RESETLST                                            (* ; 
-                                                      "Getting TTYPROC here allows HELP in debugging")
-            (bind (TTYPROC _ (TTY.PROCESS))
-                  (TSTREAM _ (PANETEXTSTREAM PANE))
-                  (X _ (LASTMOUSEX PANE))
-                  (Y _ (LASTMOUSEY PANE))
-                  (DS _ (WINDOWPROP PANE 'DSP))
-                  (OLDX _ MIN.SMALLP)
-                  (OLDY _ MIN.SMALLP)
-                  (PREG _ (PANEREGION PANE))
-                  TEXTOBJ CURSEL NEWSEL CUROPERATION NEWOPERATION PENDINGDEL READONLY SECSEL
-               declare (SPECVARS CURSEL) first 
+    (RESETLST                                                (* ; 
+                             "Getting TTYPROC here allows HELP in debugging.  It's the Tedit process")
+        (bind (TTYPROC _ (TTY.PROCESS))
+              (TSTREAM _ (PANETEXTSTREAM PANE))
+              (X _ (LASTMOUSEX PANE))
+              (Y _ (LASTMOUSEY PANE))
+              (DS _ (WINDOWPROP PANE 'DSP))
+              (OLDX _ MIN.SMALLP)
+              (OLDY _ MIN.SMALLP)
+              (PREG _ (PANEREGION PANE))
+              TEXTOBJ CURSEL NEWSEL CUROPERATION NEWOPERATION PENDINGDEL READONLY SECSEL
+           declare (SPECVARS CURSEL) first 
 
                                       (* ;; "Pick off and return from a bunch of peripheral situations, then fall through to the complexities of normal text selection.")
 
-                                               (CL:UNLESS TSTREAM (RETURN))
-                                               (SETQ TEXTOBJ (TEXTOBJ! (FGETTSTR TSTREAM TEXTOBJ)))
-                                               (CL:WHEN (OR (\TEDIT.BUTTONEVENTFN.INTITLE Y PANE 
-                                                                   TEXTOBJ)
-                                                            (\TEDIT.BUTTONEVENTFN.INACTIVE TEXTOBJ 
-                                                                   PANE)
-                                                            (\TEDIT.PANE.SPLIT TEXTOBJ PANE))
-                                                      (RETURN)) 
+                                           (CL:UNLESS TSTREAM (RETURN))
+                                           (SETQ TEXTOBJ (TEXTOBJ! (FGETTSTR TSTREAM TEXTOBJ)))
+                                           (CL:WHEN (OR (\TEDIT.BUTTONEVENTFN.INTITLE Y PANE TEXTOBJ)
+                                                        (\TEDIT.BUTTONEVENTFN.INACTIVE TEXTOBJ PANE)
+                                                        (\TEDIT.PANE.SPLIT TEXTOBJ PANE))
+                                                  (RETURN)) 
 
-                                               (* ;; "")
+                                           (* ;; "")
 
-                                               (* ;; 
+                                           (* ;; 
               "The usual case -- a valid click in this pane.  And there's nothing else going on now.")
 
                                          (* ;; "Make sure the caret isn't being displayed, then change to the special tall one so it is easier to see during typein")
 
-                                               (\CARET.DOWN)
-                                               [RESETSAVE (\TEDIT.CARET TEXTOBJ BXHICARET)
-                                                      `(\TEDIT.CARET ,TEXTOBJ ,BXCARET] 
+                                           (\CARET.DOWN)
+                                           [RESETSAVE (\TEDIT.CARET TEXTOBJ BXHICARET)
+                                                  `(\TEDIT.CARET ,TEXTOBJ ,BXCARET] 
 
-                                               (* ;; "")
+                                           (* ;; "")
 
-                                               (SETQ READONLY (FGETTOBJ TEXTOBJ TXTREADONLY))
-                                               (SETQ NEWOPERATION (\TEDIT.BUTTONEVENTFN.GETOPERATION
-                                                                   READONLY NIL)) 
+                                           (SETQ READONLY (FGETTOBJ TEXTOBJ TXTREADONLY))
+                                           (SETQ NEWOPERATION (\TEDIT.BUTTONEVENTFN.GETOPERATION
+                                                               READONLY NIL)) 
 
-                                               (* ;; "")
+                                           (* ;; "")
 
-                                               (if (SETQ CURSEL (FGETTOBJ TEXTOBJ SECONDARYSEL))
-                                                   then      (* ; 
+                                           (if (SETQ CURSEL (FGETTOBJ TEXTOBJ SECONDARYSEL))
+                                               then          (* ; 
                                                        "Mouse moved out and came back...and clicked.")
-                                                        (SETQ CUROPERATION (FGETSEL CURSEL 
-                                                                                  SELOPERATION)) 
+                                                    (SETQ CUROPERATION (FGETSEL CURSEL SELOPERATION))
                                                              (* ; "Shift keys of secondary selection")
-                                                        (SETQ PENDINGDEL (EQ CUROPERATION
-                                                                             'PENDINGDEL))
-                                                        (CL:UNLESS (EQ NEWOPERATION CUROPERATION)
+                                                    (SETQ PENDINGDEL (EQ CUROPERATION 'PENDINGDEL))
+                                                    (CL:UNLESS (EQ NEWOPERATION CUROPERATION)
                                                              (* ; 
                                                  "If shift keys have changed, turn off old secondary")
-                                                            (\TEDIT.SECONDARYSEL.OFF TSTREAM))
-                                                        (CL:WHEN (EQ NEWOPERATION 'NORMAL)
-                                                             (* ; "")
-                                                            (CL:UNLESS (SETQ CURSEL (
+                                                        (\TEDIT.SECONDARYSEL.OFF TSTREAM))
+                                                    (CL:WHEN (EQ NEWOPERATION 'NORMAL)
+                                                             (* ; "Go back to normalpicik FILES?")
+                                                        (CL:UNLESS (SETQ CURSEL (
                                                                      \TEDIT.BUTTONEVENTFN.CURSEL.INIT
-                                                                                     NEWOPERATION 
-                                                                                     TSTREAM))
-                                                                   (RETURN)))
-                                                 elseif (SETQ CURSEL (
-                                                                     \TEDIT.BUTTONEVENTFN.CURSEL.INIT
-                                                                      NEWOPERATION TSTREAM))
-                                                   then (SETQ CUROPERATION 'NORMAL)
-                                                 else (RETURN))
-                                               (SETQ NEWSEL (\TEDIT.COPYSEL CURSEL)) 
+                                                                                 'NORMAL TSTREAM))
+                                                               (RETURN)))
+                                             elseif (SETQ CURSEL (\TEDIT.BUTTONEVENTFN.CURSEL.INIT
+                                                                  NEWOPERATION TSTREAM))
+                                               then (SETQ CUROPERATION (FGETSEL CURSEL SELOPERATION))
+                                             else (RETURN))
+                                           (SETQ NEWSEL (\TEDIT.COPYSEL CURSEL)) 
                                                              (* ; 
                                                       "Gets line-chains and consistent initial looks")
-                                               (FSETTOBJ TEXTOBJ LASTARROWX NIL)
-               eachtime (BLOCK)                              (* ; "Give other processes a chance")
-                     (GETMOUSESTATE)                         (* ; 
+                                           (FSETTOBJ TEXTOBJ LASTARROWX NIL)
+           eachtime (BLOCK)                                  (* ; "Give other processes a chance")
+                 (GETMOUSESTATE)                             (* ; 
                                                              "And get the new mouse and key info")
-                     (\TEDIT.CURSORMOVEDFN PANE)
-                     (SETQ NEWOPERATION (\TEDIT.BUTTONEVENTFN.GETOPERATION READONLY CUROPERATION))
-                     (FSETTOBJ TEXTOBJ SECONDARYSEL CURSEL) 
+                 (\TEDIT.CURSORMOVEDFN PANE)
+                 (SETQ NEWOPERATION (\TEDIT.BUTTONEVENTFN.GETOPERATION READONLY CUROPERATION))
+                 (FSETTOBJ TEXTOBJ SECONDARYSEL CURSEL) 
 
-                     (* ;; "We're done if keys and buttons are up")
+                 (* ;; "We're done if keys and buttons are up")
  until (AND (EQ NEWOPERATION 'NORMAL)
             (ALLBUTTONSUP)) unless (AND (IEQP OLDX (SETQ X (LASTMOUSEX DS)))
                                         (IEQP OLDY (SETQ Y (LASTMOUSEY DS)))
                                         (EQ CUROPERATION NEWOPERATION))
-               do (CL:UNLESS (INSIDEP (PANEREGION PANE PREG)
-                                    X Y)                     (* ; 
+           do (CL:UNLESS (INSIDEP (PANEREGION PANE PREG)
+                                X Y)                         (* ; 
                                                      "Left the window, stay in the loop if scrolling")
-                      (CL:UNLESS (IN/SCROLL/BAR? PANE LASTMOUSEX LASTMOUSEY)
-                             (RETURN))
-                      (SCROLL.HANDLER PANE)) 
+                  (CL:UNLESS (IN/SCROLL/BAR? PANE LASTMOUSEX LASTMOUSEY)
+                                                             (* ; 
+    "Stay in the loop if scrolling, otherwise leave but perhaps come back to the same configuration.")
+                      (RETURN))
+                  (SCROLL.HANDLER PANE)) 
 
-                  (* ;; "")
+              (* ;; "")
 
-                  (* ;; "Polling loop, track the mouse until the buttons and modifier keys come up, i.e. NORMAL Nothing to do until the mouse moves or the operation changes. .")
+              (* ;; "Polling loop, track the mouse until the buttons and modifier keys come up, i.e. NORMAL Nothing to do until the mouse moves or the operation changes. .")
 
-                  (* ;; "First and always: CURSEL is ON at this point and matches the display. NEWSEL may not be well-defined.")
+              (* ;; "First and always: CURSEL is ON at this point and matches the display. NEWSEL may not be well-defined.")
 
-                  (* ;; "Ready to track the selection.")
+              (* ;; "Ready to track the selection.")
 
-                  (SETQ OLDX X)
-                  (SETQ OLDY Y)
-                  (CL:UNLESS (EQ NEWOPERATION CUROPERATION)  (* ; "Keys changed ")
-                      (\TEDIT.SEL.OFF TSTREAM CURSEL)        (* ; "Switch to new highlighting")
-                      (\TEDIT.SET.SEL.LOOKS CURSEL NEWOPERATION)
-                      (\TEDIT.SET.SEL.LOOKS NEWSEL NEWOPERATION)
-                      (CL:WHEN (EQ NEWOPERATION 'NORMAL)
+              (SETQ OLDX X)
+              (SETQ OLDY Y)
+              (CL:UNLESS (EQ NEWOPERATION CUROPERATION)      (* ; "Keys changed ")
+                  (\TEDIT.SEL.OFF TSTREAM CURSEL)            (* ; "Switch to new highlighting")
+                  (\TEDIT.SET.SEL.LOOKS CURSEL NEWOPERATION)
+                  (\TEDIT.SET.SEL.LOOKS NEWSEL NEWOPERATION)
+                  (CL:WHEN (EQ NEWOPERATION 'NORMAL)
 
-                          (* ;; "Switching from e.g. COPY to NORMAL with button down. Since we didn't start out NORMAL, the original normal selection is still on the screen.  We take it down here, and establish the current (off) CURSEL as the new restoration selection")
+                      (* ;; "Switching from e.g. COPY to NORMAL with button down. Since we didn't start out NORMAL, the original normal selection is still on the screen.  We take it down here, and establish the current (off) CURSEL as the new restoration selection")
 
-                          (\TEDIT.SEL.OFF TSTREAM CURSEL)
-                          (\TEDIT.COPYSEL CURSEL (TEXTSEL TEXTOBJ)))
-                      (\TEDIT.SEL.ON TSTREAM CURSEL)
-                      (SETQ CUROPERATION NEWOPERATION)) 
+                      (\TEDIT.SEL.OFF TSTREAM CURSEL)
+                      (\TEDIT.COPYSEL CURSEL (TEXTSEL TEXTOBJ)))
+                  (\TEDIT.SEL.ON TSTREAM CURSEL)
+                  (SETQ CUROPERATION NEWOPERATION)) 
 
-                  (* ;; "Update NEWSEL each time around. Note that \TEDIT.XYTOSEL fixes but doesn't show the selection, we do that here. MOUSEREGION is set by \TEDITCURSORMOVEDFN, below.")
+              (* ;; "Update NEWSEL each time around. Note that \TEDIT.XYTOSEL fixes but doesn't show the selection, we do that here. MOUSEREGION is set by \TEDITCURSORMOVEDFN, below.")
 
-                  (if (\TEDIT.MOUSESTATE RIGHT)
-                      then                                   (* ; 
+              (if (\TEDIT.MOUSESTATE RIGHT)
+                  then                                       (* ; 
                                                            "Right button: NEWSEL extends last CURSEL")
-                           (\TEDIT.XYTOSEL X Y NEWSEL TSTREAM CUROPERATION PANE 'RIGHT CURSEL)
-                           (CL:WHEN (FGETSEL NEWSEL SET)
-                               (CL:WHEN (AND TEDIT.EXTEND.PENDING.DELETE (NOT PENDINGDEL)
-                                             (EQ CUROPERATION 'NORMAL)
-                                             (NOT (FGETTOBJ TEXTOBJ TXTREADONLY)))
+                       (\TEDIT.XYTOSEL X Y NEWSEL TSTREAM CUROPERATION PANE 'RIGHT CURSEL)
+                       (CL:WHEN (FGETSEL NEWSEL SET)
+                           (CL:WHEN (AND TEDIT.EXTEND.PENDING.DELETE (NOT PENDINGDEL)
+                                         (EQ CUROPERATION 'NORMAL)
+                                         (NOT (FGETTOBJ TEXTOBJ TXTREADONLY)))
 
-                                 (* ;; "Switch to simulation of Laurel bluependingdelete: Black, deletes on type-in. Coerce CURSEL and display for pending looks.  Otherwise, CURSEL is already BPD and stays on to avoid flicker in extending")
+                               (* ;; "Switch to simulation of Laurel bluependingdelete: Black, deletes on type-in. Coerce CURSEL and display for pending looks.  Otherwise, CURSEL is already BPD and stays on to avoid flicker in extending")
 
-                                   (\TEDIT.SEL.OFF TSTREAM CURSEL)
+                               (\TEDIT.SEL.OFF TSTREAM CURSEL)
                                                              (* ; 
                                                              "Take down old looks, change, re-show")
-                                   (\TEDIT.SET.SEL.LOOKS CURSEL 'PENDINGDEL)
-                                   (\TEDIT.SET.SEL.LOOKS NEWSEL 'PENDINGDEL)
-                                   (\TEDIT.SEL.ON TSTREAM CURSEL)
-                                   (SETQ PENDINGDEL T))
-                               [\TEDIT.EXTEND.SEL NEWSEL CURSEL TSTREAM (MEMB CUROPERATION
-                                                                              '(COPY COPYLOOKS]) 
+                               (\TEDIT.SET.SEL.LOOKS CURSEL 'PENDINGDEL)
+                               (\TEDIT.SET.SEL.LOOKS NEWSEL 'PENDINGDEL)
+                               (\TEDIT.SEL.ON TSTREAM CURSEL)
+                               (SETQ PENDINGDEL T))
+                           [\TEDIT.EXTEND.SEL NEWSEL CURSEL TSTREAM (MEMB CUROPERATION
+                                                                          '(COPY COPYLOOKS]) 
                                                              (* ; "No valid selection, go to cleanup")
-                    else (if (\TEDIT.MOUSESTATE LEFT)
-                             then                            (* ; "Left selects char/point. ")
-                                  (\TEDIT.XYTOSEL X Y NEWSEL TSTREAM CUROPERATION PANE 'LEFT CURSEL)
-                           elseif (\TEDIT.MOUSESTATE MIDDLE)
-                             then                            (* ; "Middle selects word/line")
-                                  (\TEDIT.XYTOSEL X Y NEWSEL TSTREAM CUROPERATION PANE 'MIDDLE CURSEL
-                                         ))
-                         (CL:WHEN (AND (FGETSEL NEWSEL SET)
-                                       (\TEDIT.SEL.CHANGED? NEWSEL CURSEL)
-                                       (OR (NOT (ALLBUTTONSUP))
-                                           (FGETSEL NEWSEL SELOBJ)))
+                else (if (\TEDIT.MOUSESTATE LEFT)
+                         then                                (* ; "Left selects char/point. ")
+                              (\TEDIT.XYTOSEL X Y NEWSEL TSTREAM CUROPERATION PANE 'LEFT CURSEL)
+                       elseif (\TEDIT.MOUSESTATE MIDDLE)
+                         then                                (* ; "Middle selects word/line")
+                              (\TEDIT.XYTOSEL X Y NEWSEL TSTREAM CUROPERATION PANE 'MIDDLE CURSEL))
+                     (CL:WHEN (AND (FGETSEL NEWSEL SET)
+                                   (\TEDIT.SEL.CHANGED? NEWSEL CURSEL)
+                                   (OR (NOT (ALLBUTTONSUP))
+                                       (FGETSEL NEWSEL SELOBJ)))
 
-                             (* ;; "Selection has changed while at least one button is down. Take down current CURSEL highlighting, switch to NEWSEL.  If the mouse condition is removed, the secondary selection can be lost if the mouse moves while the operation keys are still down.  But if the copy isn't done when NEWSEL picks out an object, the object will be lost. ")
+                         (* ;; "Selection has changed while at least one button is down. Take down current CURSEL highlighting, switch to NEWSEL.  If the mouse condition is removed, the secondary selection can be lost if the mouse moves while the operation keys are still down.  But if the copy isn't done when NEWSEL picks out an object, the object will be lost. ")
 
-                             (\TEDIT.SEL.OFF TSTREAM CURSEL)
-                             (\TEDIT.COPYSEL NEWSEL CURSEL)
-                             (\TEDIT.SEL.ON TSTREAM CURSEL))) 
+                         (\TEDIT.SEL.OFF TSTREAM CURSEL)
+                         (\TEDIT.COPYSEL NEWSEL CURSEL)
+                         (\TEDIT.SEL.ON TSTREAM CURSEL))) 
 
-                  (* ;; "CURSEL now matches the display and CUROPERATION.")
+              (* ;; "CURSEL now matches the display and CUROPERATION.")
  finally 
 
        (* ;; "Out of Polling loop")
@@ -1361,7 +1373,7 @@
                   'NORMAL)                                   (* ; "Restore TEXTSEL")
            (\TEDIT.SEL.ON TSTREAM)
            (RETURN))
-       (\TEDIT.BUTTONEVENTFN.DOOPERATION CURSEL CUROPERATION TSTREAM PANE PENDINGDEL TTYPROC))))])
+       (\TEDIT.BUTTONEVENTFN.DOOPERATION CURSEL CUROPERATION TSTREAM PANE PENDINGDEL TTYPROC)))])
 
 (\TEDIT.BUTTONEVENTFN.DOOPERATION
   [LAMBDA (CURSEL CUROPERATION TSTREAM PANE PENDINGDEL TTYPROC)
@@ -3702,36 +3714,36 @@
 (RPAQ? TEDIT.TITLED.ICON.TEMPLATE (create TITLEDICON ICON _ TEDITICON MASK _ TEDITMASK TITLEREG _ 
                                          TEDIT.ICON.TITLE.REGION))
 (DECLARE%: DONTCOPY
-  (FILEMAP (NIL (17098 17994 (TEDIT.DEFER.UPDATES 17108 . 17992)) (17995 46302 (\TEDIT.WINDOW.CREATE 
-18005 . 24868) (\TEDIT.WINDOW.GETREGION 24870 . 30463) (\TEDIT.WINDOW.SETUP 30465 . 34972) (
-\TEDIT.MINIMAL.WINDOW.SETUP 34974 . 42934) (\TEDIT.CLEARPANE 42936 . 43653) (\TEDIT.FILL.PANES 43655
- . 46300)) (46303 70030 (\TEDIT.CURSORMOVEDFN 46313 . 51840) (\TEDIT.CURSOROUTFN 51842 . 52639) (
-\TEDIT.ACTIVE.WINDOWP 52641 . 53711) (\TEDIT.EXPANDFN 53713 . 54276) (\TEDIT.MAINW 54278 . 55558) (
-\TEDIT.MAINSTREAM 55560 . 55894) (\TEDIT.PRIMARYPANE 55896 . 56666) (\TEDIT.PANELIST 56668 . 57164) (
-\TEDIT.NEWREGIONFN 57166 . 59682) (\TEDIT.SET.WINDOW.EXTENT 59684 . 64666) (\TEDIT.SHRINK.ICONCREATE 
-64668 . 67401) (\TEDIT.SHRINKFN 67403 . 67812) (\TEDIT.PANEREGION 67814 . 70028)) (70062 105406 (
-\TEDIT.BUTTONEVENTFN 70072 . 84998) (\TEDIT.BUTTONEVENTFN.DOOPERATION 85000 . 92471) (
-\TEDIT.BUTTONEVENTFN.GETOPERATION 92473 . 94315) (\TEDIT.BUTTONEVENTFN.CURSEL.INIT 94317 . 97987) (
-\TEDIT.BUTTONEVENTFN.INACTIVE 97989 . 100419) (\TEDIT.BUTTONEVENTFN.INTITLE 100421 . 102256) (
-\TEDIT.COPYINSERTFN 102258 . 103390) (\TEDIT.FOREIGN.COPY 103392 . 105404)) (105407 122970 (
-\TEDIT.PANE.SPLIT 105417 . 109365) (\TEDIT.SPLITW 109367 . 117426) (\TEDIT.UNSPLITW 117428 . 121627) (
-\TEDIT.LINKPANES 121629 . 122392) (\TEDIT.UNLINKPANE 122394 . 122968)) (124404 125295 (TEDITWINDOWP 
-124414 . 125293)) (125332 128435 (TEDIT.GETINPUT 125342 . 127785) (\TEDIT.MAKEFILENAME 127787 . 128433
-)) (128484 136567 (TEDIT.PROMPTWINDOW 128494 . 128808) (TEDIT.PROMPTPRINT 128810 . 131777) (
-TEDIT.PROMPTCLEAR 131779 . 133614) (TEDIT.PROMPTFLASH 133616 . 134874) (\TEDIT.PROMPT.PAGEFULLFN 
-134876 . 136565)) (136805 147383 (\TEDIT.FILENAME 136815 . 137587) (\TEDIT.DEFAULT.TITLE 137589 . 
-139968) (\TEDIT.WINDOW.TITLE 139970 . 142139) (\TEDIT.LIKELY.FILENAME 142141 . 144865) (
-\TEDIT.UPDATE.TITLE 144867 . 147381)) (147426 160153 (TEDIT.DEACTIVATE.WINDOW 147436 . 153252) (
-\TEDIT.RESHAPEFN 153254 . 155339) (\TEDIT.REPAINTFN 155341 . 155565) (\TEDIT.CLOSESPLITS 155567 . 
-158012) (\TEDIT.CLOSEPANE 158014 . 160151)) (160154 202953 (\TEDIT.SCROLLFN 160164 . 162395) (
-\TEDIT.SCROLLCH.TOP 162397 . 164508) (\TEDIT.SCROLLCH.BOTTOM 164510 . 168840) (\TEDIT.SCROLLUP 168842
- . 174568) (\TEDIT.TOPLINE.YTOP 174570 . 176239) (\TEDIT.SCROLLDOWN 176241 . 183280) (
-\TEDIT.SCROLL.CARET 183282 . 186120) (\TEDIT.VISIBLECARETP 186122 . 188416) (\TEDIT.VISIBLECHARP 
-188418 . 189509) (\TEDIT.BITMAPLINES 189511 . 193431) (\TEDIT.SETPANE.TOPLINE 193433 . 194045) (
-\TEDIT.SHIFTLINES 194047 . 202951)) (202954 213823 (\TEDIT.ONSCREEN? 202964 . 207515) (
-\TEDIT.ONSCREEN.REGION 207517 . 211168) (\TEDIT.AFTERMOVEFN 211170 . 212067) (OFFSCREENP 212069 . 
-213821)) (213865 216679 (\TEDIT.PROCIDLEFN 213875 . 215535) (\TEDIT.PROCENTRYFN 215537 . 215982) (
-\TEDIT.PROCEXITFN 215984 . 216677)) (216758 229983 (\TEDIT.DOWNCARET 216768 . 217561) (
-\TEDIT.FLASHCARET 217563 . 219674) (\TEDIT.UPCARET 219676 . 220780) (TEDIT.NORMALIZECARET 220782 . 
-224000) (\TEDIT.SETCARET 224002 . 229353) (\TEDIT.CARET 229355 . 229981)))))
+  (FILEMAP (NIL (17218 18114 (TEDIT.DEFER.UPDATES 17228 . 18112)) (18115 46646 (\TEDIT.WINDOW.CREATE 
+18125 . 24988) (\TEDIT.WINDOW.GETREGION 24990 . 30583) (\TEDIT.WINDOW.SETUP 30585 . 35092) (
+\TEDIT.MINIMAL.WINDOW.SETUP 35094 . 43278) (\TEDIT.CLEARPANE 43280 . 43997) (\TEDIT.FILL.PANES 43999
+ . 46644)) (46647 71653 (\TEDIT.CURSORMOVEDFN 46657 . 52184) (\TEDIT.CURSOROUTFN 52186 . 52983) (
+\TEDIT.CURSORINFN 52985 . 54262) (\TEDIT.ACTIVE.WINDOWP 54264 . 55334) (\TEDIT.EXPANDFN 55336 . 55899)
+ (\TEDIT.MAINW 55901 . 57181) (\TEDIT.MAINSTREAM 57183 . 57517) (\TEDIT.PRIMARYPANE 57519 . 58289) (
+\TEDIT.PANELIST 58291 . 58787) (\TEDIT.NEWREGIONFN 58789 . 61305) (\TEDIT.SET.WINDOW.EXTENT 61307 . 
+66289) (\TEDIT.SHRINK.ICONCREATE 66291 . 69024) (\TEDIT.SHRINKFN 69026 . 69435) (\TEDIT.PANEREGION 
+69437 . 71651)) (71685 106349 (\TEDIT.BUTTONEVENTFN 71695 . 85941) (\TEDIT.BUTTONEVENTFN.DOOPERATION 
+85943 . 93414) (\TEDIT.BUTTONEVENTFN.GETOPERATION 93416 . 95258) (\TEDIT.BUTTONEVENTFN.CURSEL.INIT 
+95260 . 98930) (\TEDIT.BUTTONEVENTFN.INACTIVE 98932 . 101362) (\TEDIT.BUTTONEVENTFN.INTITLE 101364 . 
+103199) (\TEDIT.COPYINSERTFN 103201 . 104333) (\TEDIT.FOREIGN.COPY 104335 . 106347)) (106350 123913 (
+\TEDIT.PANE.SPLIT 106360 . 110308) (\TEDIT.SPLITW 110310 . 118369) (\TEDIT.UNSPLITW 118371 . 122570) (
+\TEDIT.LINKPANES 122572 . 123335) (\TEDIT.UNLINKPANE 123337 . 123911)) (125347 126238 (TEDITWINDOWP 
+125357 . 126236)) (126275 129378 (TEDIT.GETINPUT 126285 . 128728) (\TEDIT.MAKEFILENAME 128730 . 129376
+)) (129427 137510 (TEDIT.PROMPTWINDOW 129437 . 129751) (TEDIT.PROMPTPRINT 129753 . 132720) (
+TEDIT.PROMPTCLEAR 132722 . 134557) (TEDIT.PROMPTFLASH 134559 . 135817) (\TEDIT.PROMPT.PAGEFULLFN 
+135819 . 137508)) (137748 148326 (\TEDIT.FILENAME 137758 . 138530) (\TEDIT.DEFAULT.TITLE 138532 . 
+140911) (\TEDIT.WINDOW.TITLE 140913 . 143082) (\TEDIT.LIKELY.FILENAME 143084 . 145808) (
+\TEDIT.UPDATE.TITLE 145810 . 148324)) (148369 161096 (TEDIT.DEACTIVATE.WINDOW 148379 . 154195) (
+\TEDIT.RESHAPEFN 154197 . 156282) (\TEDIT.REPAINTFN 156284 . 156508) (\TEDIT.CLOSESPLITS 156510 . 
+158955) (\TEDIT.CLOSEPANE 158957 . 161094)) (161097 203896 (\TEDIT.SCROLLFN 161107 . 163338) (
+\TEDIT.SCROLLCH.TOP 163340 . 165451) (\TEDIT.SCROLLCH.BOTTOM 165453 . 169783) (\TEDIT.SCROLLUP 169785
+ . 175511) (\TEDIT.TOPLINE.YTOP 175513 . 177182) (\TEDIT.SCROLLDOWN 177184 . 184223) (
+\TEDIT.SCROLL.CARET 184225 . 187063) (\TEDIT.VISIBLECARETP 187065 . 189359) (\TEDIT.VISIBLECHARP 
+189361 . 190452) (\TEDIT.BITMAPLINES 190454 . 194374) (\TEDIT.SETPANE.TOPLINE 194376 . 194988) (
+\TEDIT.SHIFTLINES 194990 . 203894)) (203897 214766 (\TEDIT.ONSCREEN? 203907 . 208458) (
+\TEDIT.ONSCREEN.REGION 208460 . 212111) (\TEDIT.AFTERMOVEFN 212113 . 213010) (OFFSCREENP 213012 . 
+214764)) (214808 217622 (\TEDIT.PROCIDLEFN 214818 . 216478) (\TEDIT.PROCENTRYFN 216480 . 216925) (
+\TEDIT.PROCEXITFN 216927 . 217620)) (217701 230926 (\TEDIT.DOWNCARET 217711 . 218504) (
+\TEDIT.FLASHCARET 218506 . 220617) (\TEDIT.UPCARET 220619 . 221723) (TEDIT.NORMALIZECARET 221725 . 
+224943) (\TEDIT.SETCARET 224945 . 230296) (\TEDIT.CARET 230298 . 230924)))))
 STOP
diff --git a/library/tedit/TEDIT-WINDOW.LCOM b/library/tedit/TEDIT-WINDOW.LCOM
index ded88d84..8fec865b 100644
Binary files a/library/tedit/TEDIT-WINDOW.LCOM and b/library/tedit/TEDIT-WINDOW.LCOM differ
