Changeset 6755


Ignore:
Timestamp:
Jun 18, 2007, 1:36:19 AM (17 years ago)
Author:
Gary Byers
Message:

Add/tweak a few things.

File:
1 edited

Legend:

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

    r6693 r6755  
    412412          (editor-error "Not enough lines in buffer."))
    413413        (move-mark point m)))))
     414
     415(defcommand "Goto Absolute Position" (p)
     416  "Goes to the indicated character position, if you counted them
     417   starting at the beginning of the buffer with the number zero.  If a
     418   prefix argument is supplied, that is the line number; otherwise, the
     419  user is prompted."
     420  "Go to a user perceived character position."
     421  (let ((p (or p (prompt-for-expression
     422                  :prompt "Character Position: "
     423                  :help "Enter an absolute character position to goto."))))
     424    (unless (and (integerp p) (not (minusp p)))
     425      (editor-error "Must supply a non-negatige integer."))
     426    (let ((point (current-point-unless-selection)))
     427      (when point
     428        (with-mark ((m point))
     429          (unless (character-offset (buffer-start m) p)
     430            (buffer-end m))
     431          (move-mark point m))))))
     432
     433(defcommand "What Cursor Position" (p)
     434  "Print info on current point position"
     435  "Print info on current point position"
     436  (declare (ignore p))
     437  (time
     438  (let* ((point (current-point))
     439         (current-line (mark-line point)))
     440    (let* ((line-number (do* ((l 1 (1+ l))
     441                              (mark-line (mark-line point) (line-previous mark-line)))
     442                             ((null mark-line) l)))
     443             (charpos (mark-charpos point))
     444             (abspos (+ (hi::get-line-origin current-line) charpos))
     445             (char (next-character point))
     446             (size (count-characters (buffer-region (current-buffer)))))
     447        (message "Char: ~s point = ~d of ~d(~d%) line ~d column ~d"
     448                 char abspos size (round (/ (* 100 abspos) size)) line-number charpos)))))
     449
     450
     451
    414452
    415453
Note: See TracChangeset for help on using the changeset viewer.