CLIM mail archive


RE: REAL simple text editor ... almost

I realized I'm using CLIM 2 - I could just use a text editor gadget!
Guess what? It has the same behavior as I observed in my original approach in
my original posting included below. Is the a Symbolics problem? Any
non-Symoblians tries my code (below) or used a text-editor gadget


    Date: Wed, 13 Jul 1994 17:45 EDT
    From: Richard Billington <>

    I want someone to be able to edit a single line of text,
    and (if they want) add additional text to it, add additional
    newlines of text, including empty ones. The enclosed code comes
    so close it drives me crazy I can't get it to work.

    If the presentation-type-option :echo-space to sequence is set to NIL, it
    doesn't start each newline with an space (which is what I want), but the
    display gets very confused if you enter multiple #\returns (like you would for
    a paragraph): It doesn't echo more than the first #\return, but if you erase
    or otherwise cause the window to refresh, the text shows up where its supposed
    to be AND on the line you meant to be blank, and the cursor remains on the
    line you meant to be blank

    If the presentation-type-option :echo-space is set to T, you get a space at
    the start of each newline, but the display is less confused - initially. Type
    in a line and then start a new paragraph, and then go back and edit the first
    line: edits done within the original characters are fine, but adding to the
    end of the line results in the display losing the characters which are above 
    the characters in the line of the next paragraph - a refresh (such as when you
    backspace to erase) fixes it temporarily.

    Finally, everything before the IP (insertion point) is returned when you hit
    #\end, the rest is lost - if IP = FP, no problem.

    If this worked it would be awfully elegant, don't ya think?

    ;;;;1 FakeTeX Package

0    (defpackage 2FakeTeX 0(:nicknames FT)
		(:use clim-lisp clim))

    (in-package 'FT)

    (defun 2text-edit 0(&optional (object ""))
      (let ((*standard-activation-gestures* '(#\end))
	    (first-time T)
	    (stream (open-window-stream :port (find-port) :width 500 :height 400))
	    (input nil))
	(setf (window-visibility stream) T)
	(setf input
		(stream (make-text-style :sans-serif :roman :large))
		(with-input-editing (stream)
		  ;; 3initialize stream for editting by inserting object
0		  (when first-time
		    (replace-input stream object :buffer-start 0 :rescan T)
		    (setf first-time nil))
		  ;; 3accept a sequence of strings
0		  (accept '((sequence string) :separator #\return :echo-space T)
			  :stream stream
			  :view +textual-view+
			  :prompt nil))))
	(setf (window-visibility stream) nil)


Main Index | Thread Index