Changeset 6699


Ignore:
Timestamp:
Jun 12, 2007, 12:40:05 PM (17 years ago)
Author:
Gary Byers
Message:

Greater care with echo-area modification.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ide-1.0/ccl/hemlock/src/echo.lisp

    r6598 r6699  
    4545    (progn
    4646      (buffer-document-begin-editing *echo-area-buffer*)
    47       ,@body)
     47      (modifying-buffer *echo-area-buffer* ,@body))
    4848    (buffer-document-end-editing *echo-area-buffer*)))
    4949;;; %Not-Inside-A-Parse  --  Internal
     
    115115  "You guessed it."
    116116  (maybe-wait)
    117   (let* ((b (current-buffer)))
     117  (let* ((b (current-buffer))
     118         (doc (buffer-document *echo-area-buffer*)))
    118119    (unwind-protect
    119120         (progn
     
    122123            (delete-region *echo-area-region*))
    123124           (setf (buffer-modified *echo-area-buffer*) nil))
     125      (when doc
     126        (document-set-point-position doc))
    124127      (setf (current-buffer) b))))
    125128
     
    151154                   (clear-echo-area)))
    152155            (apply #'format *echo-area-stream* string args)
    153             (setf (buffer-modified *echo-area-buffer*) nil))))
     156            (setf (buffer-modified *echo-area-buffer*) t))))
    154157   (force-output *echo-area-stream*)
    155158   (setq *last-message-time* (get-internal-real-time)))
     
    169172
    170173
    171 (defhvar "Raise Echo Area When Modified"
    172   "When set, Hemlock raises the echo area window when output appears there."
    173   :value nil)
    174 
    175 ;;; RAISE-ECHO-AREA-WHEN-MODIFIED -- Internal.
    176 ;;;
    177 ;;; INIT-BITMAP-SCREEN-MANAGER in bit-screen.lisp adds this hook when
    178 ;;; initializing the bitmap screen manager.
    179 ;;;
    180 #+clx
    181 (defun raise-echo-area-when-modified (buffer modified)
    182   (when (and (value hemlock::raise-echo-area-when-modified)
    183              (eq buffer *echo-area-buffer*)
    184              modified)
    185     (let* ((hunk (window-hunk *echo-area-window*))
    186            (win (window-group-xparent (bitmap-hunk-window-group hunk))))
    187       (xlib:map-window win)
    188       (setf (xlib:window-priority win) :above)
    189       (xlib:display-force-output
    190        (bitmap-device-display (device-hunk-device hunk))))))
     174
     175
    191176
    192177
     
    199184                                                     *parse-default*)))
    200185  (clear-echo-area)
    201   (let ((point (buffer-point *echo-area-buffer*)))
    202     (if (listp prompt)
    203         (apply #'format *echo-area-stream* prompt)
    204         (insert-string point prompt))
    205     (when default
    206       (insert-character point #\[)
    207       (insert-string point default)
    208       (insert-string point "] "))))
     186  (modifying-echo-buffer
     187   (let ((point (buffer-point *echo-area-buffer*)))
     188     (if (listp prompt)
     189       (apply #'format *echo-area-stream* prompt)
     190       (insert-string point prompt))
     191     (when default
     192       (insert-character point #\[)
     193       (insert-string point default)
     194       (insert-string point "] ")))))
    209195
    210196(defun parse-for-something ()
     
    216202     (use-buffer *echo-area-buffer*
    217203       (recursive-edit nil))
     204     
    218205     (setf (current-window) start-window))))
    219206
     
    252239(defun buffer-verification-function (string)
    253240  (declare (simple-string string))
    254   (cond ((string= string "") nil)
    255         (*parse-value-must-exist*
    256          (multiple-value-bind
    257              (prefix key value field ambig)
    258              (complete-string string *parse-string-tables*)
    259            (declare (ignore field))
    260            (ecase key
    261              (:none nil)
    262              ((:unique :complete)
    263               (list value))
    264              (:ambiguous
    265               (delete-region *parse-input-region*)
    266               (insert-string (region-start *parse-input-region*) prefix)
    267               (let ((point (current-point)))
    268                 (move-mark point (region-start *parse-input-region*))
    269                 (unless (character-offset point ambig)
    270                   (buffer-end point)))
    271               nil))))
    272         (t
    273          (list (or (getstring string *buffer-names*) string)))))
     241  (modifying-echo-buffer
     242   (cond ((string= string "") nil)
     243         (*parse-value-must-exist*
     244          (multiple-value-bind
     245              (prefix key value field ambig)
     246              (complete-string string *parse-string-tables*)
     247            (declare (ignore field))
     248            (ecase key
     249              (:none nil)
     250              ((:unique :complete)
     251               (list value))
     252              (:ambiguous
     253               (delete-region *parse-input-region*)
     254               (insert-string (region-start *parse-input-region*) prefix)
     255               (let ((point (current-point)))
     256                 (move-mark point (region-start *parse-input-region*))
     257                 (unless (character-offset point ambig)
     258                   (buffer-end point)))
     259               nil))))
     260         (t
     261          (list (or (getstring string *buffer-names*) string))))))
    274262
    275263
     
    317305                                         :junk-allowed t)
    318306    (cond (pn)
    319           (t (delete-characters (region-end *echo-area-region*)
    320                                 (- idx (length string)))
     307          (t (modifying-echo-buffer
     308              (delete-characters (region-end *echo-area-region*)
     309                                (- idx (length string))))
    321310             nil))))
    322311
     
    365354      (complete-string string *parse-string-tables*)
    366355    (declare (ignore field))
    367     (cond (*parse-value-must-exist*
    368            (ecase key
    369              (:none nil)
    370              ((:unique :complete)
    371               (list prefix value))
    372              (:ambiguous
    373               (delete-region *parse-input-region*)
    374               (insert-string (region-start *parse-input-region*) prefix)
    375               (let ((point (current-point)))
    376                 (move-mark point (region-start *parse-input-region*))
    377                 (unless (character-offset point ambig)
    378                   (buffer-end point)))
    379               nil)))
    380           (t
    381            ;; HACK: If it doesn't have to exist, and the completion does not
    382            ;; add anything, then return the completion's capitalization,
    383            ;; instead of the user's input.
    384            (list (if (= (length string) (length prefix)) prefix string))))))
     356    (modifying-echo-buffer
     357     (cond (*parse-value-must-exist*
     358            (ecase key
     359              (:none nil)
     360              ((:unique :complete)
     361               (list prefix value))
     362              (:ambiguous
     363               (delete-region *parse-input-region*)
     364               (insert-string (region-start *parse-input-region*) prefix)
     365               (let ((point (current-point)))
     366                 (move-mark point (region-start *parse-input-region*))
     367                 (unless (character-offset point ambig)
     368                   (buffer-end point)))
     369               nil)))
     370           (t
     371            ;; HACK: If it doesn't have to exist, and the completion does not
     372            ;; add anything, then return the completion's capitalization,
     373            ;; instead of the user's input.
     374            (list (if (= (length string) (length prefix)) prefix string)))))))
    385375
    386376
Note: See TracChangeset for help on using the changeset viewer.