diff --git a/lispusers/MODERNIZE b/lispusers/MODERNIZE
index 09e99137..515f99a7 100644
--- a/lispusers/MODERNIZE
+++ b/lispusers/MODERNIZE
@@ -1,12 +1,12 @@
 (DEFINE-FILE-INFO PACKAGE "INTERLISP" READTABLE "INTERLISP" BASE 10)
 
-(FILECREATED " 7-Oct-2022 21:45:29" 
-{DSK}<Users>kaplan>Local>medley3.5>working-medley>lispusers>MODERNIZE.;43 30755  
+(FILECREATED "29-Oct-2023 10:56:48" {WMEDLEY}<lispusers>MODERNIZE.;48 30909  
 
-      :CHANGES-TO (FNS MODERNWINDOW)
+      :EDIT-BY rmk
 
-      :PREVIOUS-DATE " 5-Mar-2022 23:20:21" 
-{DSK}<Users>kaplan>Local>medley3.5>working-medley>lispusers>MODERNIZE.;40)
+      :CHANGES-TO (FNS NEARESTCORNER)
+
+      :PREVIOUS-DATE "29-Jul-2023 10:48:55" {WMEDLEY}<lispusers>MODERNIZE.;47)
 
 
 (PRETTYCOMPRINT MODERNIZECOMS)
@@ -30,7 +30,7 @@
               
               (* ;; "Add some Meta commands")
 
-              (FNS TEDIT.MODERNIZE \MODERNIZED.TEDIT.BUTTONEVENTFN TEDIT.SELECTALL)
+              (FNS TEDIT.MODERNIZE \MODERNIZED.TEDIT.BUTTONEVENTFN)
               (DECLARE%: DONTEVAL@LOAD DOCOPY (P 
                                                  (* ;; "Tedit")
 
@@ -325,21 +325,47 @@
                       (IGREATERP LASTMOUSEX (IPLUS LEFT (TIMES WIDTH (DIFFERENCE 1 TITLEPROPORTION])
 
 (NEARESTCORNER
-  [LAMBDA (REGION)                                      (* ; "Edited 14-Feb-2021 21:46 by rmk:")
+  [LAMBDA (REGION)                                           (* ; "Edited 29-Oct-2023 10:56 by rmk")
+                                                             (* ; "Edited 29-Jul-2023 10:32 by rmk")
+                                                            (* ; "Edited 14-Feb-2021 21:46 by rmk:")
 
-    (* ;; 
-"Moves the cursor to the corner of REGION that is closest to the current LASTMOUSEX AND LASTMOUSEY")
+    (* ;; "Moves the cursor to the corner of REGION that is closest to the current LASTMOUSEX and LASTMOUSEY, provided that that corner is on-screen.")
 
-    (\CURSORPOSITION (CL:IF (ILESSP (IDIFFERENCE LASTMOUSEX (FETCH LEFT OF REGION))
-                                   (IDIFFERENCE (FETCH RIGHT OF REGION)
-                                          LASTMOUSEX))
-                         (FETCH LEFT OF REGION)
-                         (FETCH RIGHT OF REGION))
-           (CL:IF (ILESSP (IDIFFERENCE LASTMOUSEY (FETCH BOTTOM OF REGION))
-                         (IDIFFERENCE (FETCH TOP OF REGION)
-                                LASTMOUSEY))
-               (FETCH BOTTOM OF REGION)
-               (FETCH TOP OF REGION))])
+    (LET ((LEFT (FETCH (REGION LEFT) OF REGION))
+          (RIGHT (FETCH (REGION RIGHT) OF REGION))
+          (TOP (FETCH (REGION TOP) OF REGION))
+          (BOTTOM (FETCH (REGION BOTTOM) OF REGION))
+          X Y)
+
+         (* ;; "If the nearest corner is offscreen, pick the other one.")
+
+         (SETQ X (if (OR (ILESSP LEFT 0)
+                         (IGEQ LEFT SCREENWIDTH))
+                     then 
+                          (* ;; "LEFT is offscreen")
+
+                          RIGHT
+                   elseif (ILESSP (IDIFFERENCE LASTMOUSEX LEFT)
+                                 (IDIFFERENCE RIGHT LASTMOUSEX))
+                     then 
+                          (* ;; "Closer to LEFT")
+
+                          LEFT
+                   else RIGHT))
+         (SETQ Y (if (OR (ILESSP TOP 0)
+                         (IGEQ TOP SCREENHEIGHT))
+                     then 
+                          (* ;; "TOP is offscreen")
+
+                          BOTTOM
+                   elseif (ILESSP (IDIFFERENCE LASTMOUSEY BOTTOM)
+                                 (IDIFFERENCE TOP LASTMOUSEY))
+                     then 
+                          (* ;; "Closer to BOTTOM")
+
+                          BOTTOM
+                   else TOP))
+         (\CURSORPOSITION X Y])
 
 (INCORNER.REGION
   [LAMBDA (CORNERREGION TOPMARGIN)                      (* ; "Edited 13-Oct-2021 15:04 by rmk:")
@@ -470,50 +496,25 @@
 (DEFINEQ
 
 (TEDIT.MODERNIZE
-  [LAMBDA NIL                                           (* ; "Edited 11-Oct-2021 15:02 by rmk:")
+  [LAMBDA NIL                                                (* ; "Edited 14-Jun-2023 16:56 by rmk")
+                                                            (* ; "Edited 11-Oct-2021 15:02 by rmk:")
     (MODERNWINDOW.SETUP (FUNCTION \TEDIT.BUTTONEVENTFN)
-           (FUNCTION \MODERNIZED.TEDIT.BUTTONEVENTFN))
-    (CL:WHEN (GETD '\TEDIT.BUTTONEVENTFN)
-
-        (* ;; "All")
-
-        (TEDIT.SETFUNCTION (CHARCODE "Meta,a")
-               (FUNCTION TEDIT.SELECTALL)
-               TEDIT.READTABLE)
-        (TEDIT.SETFUNCTION (CHARCODE "Meta,A")
-               (FUNCTION TEDIT.SELECTALL)
-               TEDIT.READTABLE)
-
-        (* ;; "Quit")
-
-        (TEDIT.SETFUNCTION (CHARCODE "Meta,q")
-               (FUNCTION TEDIT.QUIT)
-               TEDIT.READTABLE)
-        (TEDIT.SETFUNCTION (CHARCODE "Meta,Q")
-               (FUNCTION TEDIT.QUIT)
-               TEDIT.READTABLE))])
+           (FUNCTION \MODERNIZED.TEDIT.BUTTONEVENTFN])
 
 (\MODERNIZED.TEDIT.BUTTONEVENTFN
-  [LAMBDA (W STREAM)                                    (* ; "Edited 13-Oct-2021 21:43 by rmk:")
+  [LAMBDA (W STREAM)                                         (* ; "Edited 29-Jul-2023 10:48 by rmk")
+                                                            (* ; "Edited 13-Oct-2021 21:43 by rmk:")
 
     (* ;; "If a TEDIT window has been split, we have to make sure that movement happens only for clicks at the top of the main window and at the bottom of the bottom-most split window.  Clicks near the split lines must be ignored.  Essentially, the %"region%" of the Tedit window is the union of the regions of all of its split-panes.")
 
-    (* ;; "We pass the pain that received the click, because that's what the original \TEDIT.BUTTONEVENTFN needs to see, if we decide not to shape or move.")
+    (* ;; "We pass the pane that received the click, because that's what the original \TEDIT.BUTTONEVENTFN needs to see, if we decide not to shape or move.")
 
     (MODERNWINDOW.BUTTONEVENTFN W (FUNCTION MODERN-ORIG-\TEDIT.BUTTONEVENTFN)
            NIL NIL [APPLY (FUNCTION UNIONREGIONS)
-                          (bind PANE _ (CENTRALWINDOW W) collect (WINDOWPROP PANE
-                                                                                'REGION)
+                          (bind PANE _ (CENTRALWINDOW W) collect (WINDOWPROP PANE 'REGION)
                              repeatwhile (SETQ PANE (WINDOWPROP PANE 'TEDIT-NEXT-PANE-DOWN]
            (WINDOWPROP (CENTRALWINDOW W)
                   'TITLE])
-
-(TEDIT.SELECTALL
-  [LAMBDA (STREAM TEXTOBJ SEL)                          (* ; "Edited  3-May-2020 17:29 by rmk:")
-    (LET [(TEXTSTREAM (TEXTSTREAM (TTY.PROCESS]
-         (CL:WHEN TEXTSTREAM
-             (TEDIT.SETSEL TEXTSTREAM 0 (ADD1 (fetch TEXTLEN of (TEXTOBJ TEXTSTREAM)))
-                    'LEFT))])
 )
 (DECLARE%: DONTEVAL@LOAD DOCOPY 
 
@@ -614,12 +615,11 @@
 (ADDTOVAR LAMA MODERN-ADD-EXEC)
 )
 (DECLARE%: DONTCOPY
-  (FILEMAP (NIL (5125 11487 (MODERNWINDOW 5135 . 6675) (MODERNWINDOW.SETUP 6677 . 9626) (UNMODERNWINDOW 
-9628 . 10022) (MODERNWINDOW.UNSETUP 10024 . 10836) (\MODERNIZED.FREEMENU.BUTTONEVENTFN 10838 . 11485))
- (11552 21714 (MODERNWINDOW.BUTTONEVENTFN 11562 . 18589) (NEARTOP 18591 . 19519) (NEARESTCORNER 19521
- . 20400) (INCORNER.REGION 20402 . 21712)) (21772 24244 (MODERN-ADD-EXEC 21782 . 22213) (MODERN-SNAPW 
-22215 . 22758) (TOTOPW.MODERNIZE 22760 . 23188) (MODERN-MENUBUTTONFN 23190 . 24242)) (24245 26674 (
-\MODERNIZED.FREEMENU.BUTTONEVENTFN 24255 . 24902) (MODERNIZED.TB.BUTTONEVENTFN 24904 . 26672)) (26715 
-28994 (TEDIT.MODERNIZE 26725 . 27539) (\MODERNIZED.TEDIT.BUTTONEVENTFN 27541 . 28663) (TEDIT.SELECTALL
- 28665 . 28992)))))
+  (FILEMAP (NIL (5048 11410 (MODERNWINDOW 5058 . 6598) (MODERNWINDOW.SETUP 6600 . 9549) (UNMODERNWINDOW 
+9551 . 9945) (MODERNWINDOW.UNSETUP 9947 . 10759) (\MODERNIZED.FREEMENU.BUTTONEVENTFN 10761 . 11408)) (
+11475 22625 (MODERNWINDOW.BUTTONEVENTFN 11485 . 18512) (NEARTOP 18514 . 19442) (NEARESTCORNER 19444 . 
+21311) (INCORNER.REGION 21313 . 22623)) (22683 25155 (MODERN-ADD-EXEC 22693 . 23124) (MODERN-SNAPW 
+23126 . 23669) (TOTOPW.MODERNIZE 23671 . 24099) (MODERN-MENUBUTTONFN 24101 . 25153)) (25156 27585 (
+\MODERNIZED.FREEMENU.BUTTONEVENTFN 25166 . 25813) (MODERNIZED.TB.BUTTONEVENTFN 25815 . 27583)) (27626 
+29148 (TEDIT.MODERNIZE 27636 . 27989) (\MODERNIZED.TEDIT.BUTTONEVENTFN 27991 . 29146)))))
 STOP
diff --git a/lispusers/MODERNIZE.LCOM b/lispusers/MODERNIZE.LCOM
index 35b9aac7..3ce8dfb2 100644
Binary files a/lispusers/MODERNIZE.LCOM and b/lispusers/MODERNIZE.LCOM differ
