(defun c:edittxt ()
     (setq pick (entsel "\nPICK TEXT: "))
     (if (= "TEXT" (cdr (assoc 0 (setq e (entget (car pick))))))
	(progn
	(setq otext (cdr (setq as (assoc 1 e))))
	(princ (strcat "\n>" otext))
	(princ "\n>_")
	(setq edit "")
	(setq pos 1)
	(if (= (car (setq in (grread))) 2) (setq ch (cadr in)) (setq ch 0))
	(while (/= ch 13)
	   (cond
	      ((= ch 8)
		 (if (> pos 1)
		     (progn
			(princ (strcat (chr 8) (chr 8) "_"))
			(setq pos (1- pos))
			(setq edit (substr edit 1 (1- pos)))
		     )
		 )
	      )
	      ((and (> ch 31) (< ch 127))
		 (if (< pos 80)
		    (progn
		       (setq edit (strcat edit (chr ch)))
		       (setq pos (1+ pos))
		       (princ (strcat (chr 8) (chr ch) "_"))
		    )
		 )
	      )
	   )
	   (if (= (car (setq in (grread))) 2) (setq ch (cadr in)) (setq ch 0))
	)
	(while (> (strlen edit) 0)
	   (princ (chr 8))
	   (setq ntxt "")
	   (setq i 1)
	   (setq ch " ")
	   (while (and (<= i (strlen edit)) (/= ch "["))
	      (setq ch (substr edit i 1))
	      (cond
		 ((= ch " ") (if (> i (strlen otext))
		    (setq ntxt (strcat ntxt " "))
		    (setq ntxt (strcat ntxt (substr otext i 1)))
		 ))
		 ((= ch "^") (setq ntxt (strcat ntxt " ")))
		 ((= ch "[") (setq ntxt (strcat ntxt (substr edit (1+ i)))))
		 ((/= ch "\\") (setq ntxt (strcat ntxt ch)))
	      )
	      (if (/= ch "[") (setq i (1+ i)))
	   )
	   (if (<= i (strlen otext))
	      (setq ntxt (strcat ntxt (substr otext i))))
	   (setq otext ntxt)
	   (princ (strcat "\n>" otext))

	(princ "\n>_")
	(setq edit "")
	(setq pos 1)
	(if (= (car (setq in (grread))) 2) (setq ch (cadr in)) (setq ch 0))
	(while (/= ch 13)
	   (cond
	      ((= ch 8)
		 (if (> pos 1)
		     (progn
			(princ (strcat (chr 8) (chr 8) "_"))
			(setq pos (1- pos))
			(setq edit (substr edit 1 (1- pos)))
		     )
		 )
	      )
	      ((and (> ch 31) (< ch 127))
		 (if (< pos 80)
		    (progn
		       (setq edit (strcat edit (chr ch)))
		       (setq pos (1+ pos))
		       (princ (strcat (chr 8) (chr ch) "_"))
		    )
		 )
	      )
	   )
	   (if (= (car (setq in (grread))) 2) (setq ch (cadr in)) (setq ch 0))
	)

	)
	(setq e (subst (cons 1 ntxt) as e))
	(entmod e)
     ))
     ()
)
(edittxt)
