Changeset 6653


Ignore:
Timestamp:
Jun 3, 2007, 2:49:19 AM (17 years ago)
Author:
Gary Byers
Message:

CURRENT-POINT-FOR-DELETION, -FOR-SELECTION, -FOR-INSERTION: try to handle
existing selection sanely.

File:
1 edited

Legend:

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

    r2097 r6653  
    325325  (buffer-point *current-buffer*))
    326326
     327(defun current-point-for-insertion ()
     328  "Check to see if the current buffer can be modified at its
     329  current point; error if not.  If there's a selection in the
     330  current buffer, delete it.  Return the current point."
     331  (let* ((buffer *current-buffer*)
     332         (point (buffer-point buffer)))
     333    (check-buffer-modification buffer point)
     334    (let* ((region (%buffer-current-region buffer)))
     335      (when region
     336        (delete-region region))
     337      point)))
     338
     339(defun current-point-for-deletion ()
     340  "Check to see if the current buffer can be modified at its
     341  current point; error if not.  If there's a selection in the
     342  current buffer, delete it and return NIL, else return the
     343  current point."
     344  (let* ((buffer *current-buffer*)
     345         (point (buffer-point buffer)))
     346    (check-buffer-modification buffer point)
     347    (let* ((region (%buffer-current-region buffer)))
     348      (if region
     349        (progn
     350          (delete-region region)
     351          nil)
     352        point))))
     353
     354(defun current-point-unless-selection ()
     355  "Check to see if the current buffer can be modified at its
     356  current point; error if not.  If there's a selection in the
     357  current buffer, return NIL, else return the  current point."
     358  (let* ((buffer *current-buffer*)
     359         (point (buffer-point buffer)))
     360    (check-buffer-modification buffer point)
     361    (let* ((region (%buffer-current-region buffer)))
     362      (unless region
     363        point))))
     364
    327365;;; %SET-CURRENT-BUFFER  --  Internal
    328366;;;
Note: See TracChangeset for help on using the changeset viewer.