From f041b7e13757aab955899a79a92c9f5da80da56e Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Mon, 30 Aug 1999 00:49:45 +0000 Subject: [PATCH] ... original commit: dfd579f2a8d03677d5698890f003952388a766c0 --- collects/framework/keymap.ss | 22 ++++++++++++++++------ collects/framework/main.ss | 2 +- 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/collects/framework/keymap.ss b/collects/framework/keymap.ss index d00707c8..b54f155d 100644 --- a/collects/framework/keymap.ss +++ b/collects/framework/keymap.ss @@ -380,12 +380,22 @@ (get-text-from-user "Goto Line" "Goto Line:")))]) - (if (string? num-str) - (let ([line-num (string->number num-str)]) - (if line-num - (let ([pos (send edit line-start-position - (sub1 line-num))]) - (send edit set-position pos)))))) + (when (string? num-str) + (let ([line-num (inexact->exact (string->number num-str))]) + (cond + [(and (number? line-num) + (= line-num (floor line-num)) + (<= 1 line-num (+ (send edit last-line) 1))) + (let ([pos (send edit line-start-position + (sub1 line-num))]) + (send edit set-position pos))] + [else + (message-box + "Goto Line" + (format "~a is not an integer between 1 and ~a" + num-str + (+ (send edit last-line) 1)))])))) + #t)] [goto-position (lambda (edit event) diff --git a/collects/framework/main.ss b/collects/framework/main.ss index 5cb6a7cd..e75f8e89 100644 --- a/collects/framework/main.ss +++ b/collects/framework/main.ss @@ -114,7 +114,7 @@ (at-most-one (void) (lambda () (exit:on-exit) - (exit))) + (queue-callback (lambda () (exit))))) (void)))) (exit:insert-can?-callback