[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: text wrap in scrolling f
- To: MCELROY@applelink.apple.com
- Subject: Re: text wrap in scrolling f
- From: "Andre Koehorst" <email@example.com>
- Date: 21 Mar 94 10:14:21 U
- Cc: firstname.lastname@example.org
Reply to: RE>text wrap in scrolling fred
> Does anyone know how to get a scrolling fred dialog item to wrap properly
> that it doesn't break in the middle of a word.
Here is a small hack i did for a project I worked on some time ago. The
behaviour is a bit buggy (sometimes a space is scrolled to the beginning of the
next line) and there is no possibility to "reformat" a paragraph within the
boundaries. I have no time to improve the code at this moment. If you do,
please let me know.
> Thanks in advance.
; author: Andre Koehorst
; Research Instutute for Knowledge Systems
; status: hack
; bugs: Sometimes a #\space character is srolled
to the next line.
; Words are only scrolled when you type a
; character beyond the boundary. If you insert
; chars before that, words are happy to move beyond
; the boundary.
(defclass wordscroll-fred-item (fred-dialog-item)
(scroll-position :initarg :scroll-position :initform 36 :accessor
"Scrolls to the next line when a character is typed that is
beyond scroll-position. If the character is tped within a word, the word is
to the next line and the cursor is positioned after that word.")
(defmethod view-key-event-handler :around ((item wordscroll-fred-item) char)
;;; (format t "~a ~a" (char-code char) (char-name char))
(if (> (buffer-column (fred-buffer item))(scroll-position item))
((< (char-code char) 32) ; All control characters
((= (char-code char) 32) ; #\Space
; Scroll to the next line
((> (char-code char) 32) ; All printable characters?
;Scroll the word to the next line