Changeset 14208


Ignore:
Timestamp:
Aug 24, 2010, 4:25:33 AM (9 years ago)
Author:
rme
Message:

Change Hemlock command "Previous Interactive Input" so that it inserts
previous input at point, leaving the current input line intact.

See ticket:721.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/source/cocoa-ide/hemlock/src/listener.lisp

    r13186 r14208  
    108108        :buffer buffer
    109109        :value nil)
     110      (defhvar "Grabbed Input Start Mark"
     111        "Mark start of grabbed input"
     112        :buffer buffer
     113        :value (copy-mark point :right-inserting))
    110114      )
    111115    (let* ((input-mark (variable-value 'buffer-input-mark :buffer buffer)))
     
    355359  "This is the length used for the history ring in interactive buffers.
    356360   It must be set before turning on the mode."
    357   :value 10)
     361  :value 200)
    358362
    359363(defun input-region-containing-mark (m history-list)
     
    400404  "When the number of characters in an interactive buffer exceeds this value,
    401405   it is pushed onto the interactive history, otherwise it is lost forever."
    402   :value 2)
     406  :value 0)
    403407
    404408
     
    466470    (cond
    467471     ((eq (last-command-type) :interactive-history)
    468       (let ((base (mod (+ (value interactive-pointer) p) length)))
    469         (delete-region (region mark point))
    470         (insert-region point (ring-ref ring base))
     472      (let ((base (mod (+ (value interactive-pointer) p) length))
     473            (grab-start (value grabbed-input-start-mark)))
     474        (delete-region (region grab-start point))
     475        (insert-region grab-start (ring-ref ring base))
    471476        (setf (value interactive-pointer) base)))
    472477     (t
    473478      (let ((base (mod (if (minusp p) p (1- p)) length))
    474             (region (delete-and-save-region (region mark point))))
    475         (insert-region point (ring-ref ring base))
    476         (when (mark/= (region-start region) (region-end region))
    477           (ring-push region ring)
    478           (incf base))
     479            (region (copy-region (region mark (buffer-end-mark (current-buffer)))))
     480            (grab-start (move-mark (value grabbed-input-start-mark) point)))
     481        (when (mark/= (region-start region) (region-end region))
     482          (ring-push region ring)
     483          (incf base))
     484        (insert-region grab-start (ring-ref ring base))
    479485        (setf (value interactive-pointer) base)))))
    480486  (setf (last-command-type) :interactive-history))
Note: See TracChangeset for help on using the changeset viewer.