Function: artist-calculate-new-char

artist-calculate-new-char is a byte-compiled function defined in artist.el.gz.

Signature

(artist-calculate-new-char LAST-COORD NEW-COORD)

Documentation

Return a line-char to use when moving from LAST-COORD to NEW-COORD.

Source Code

;; Defined in /usr/src/emacs/lisp/textmodes/artist.el.gz
;; artist-calculate-new-char, artist-calculate-new-chars
;; Calculates which char to insert depending on direction of point-list.
;;
;; Depending on new-coord's position relative to last-coord one of the
;; following chars are returned: \ | / - o, as indicated by this:
;;
;;			\ | /
;;			- o -
;;			/ | \
;;
;; artist-calculate-new-char  works on one coordinate, returns char.
;; artist-calculate-new-chars works on a point-list, returns point-list.
;;
(defun artist-calculate-new-char (last-coord new-coord)
  "Return a line-char to use when moving from LAST-COORD to NEW-COORD."
  (let ((last-x (artist-coord-get-x last-coord))
	(last-y (artist-coord-get-y last-coord))
	(new-x (artist-coord-get-x new-coord))
	(new-y (artist-coord-get-y new-coord)))
    (cond ((> new-x last-x) (cond ((< new-y last-y) ?/ )
				  ((> new-y last-y) ?\\ )
				  (t ?- )))
	  ((< new-x last-x) (cond ((< new-y last-y) ?\\ )
				  ((> new-y last-y) ?/ )
				  (t ?- )))
	  ((eq new-y last-y) ?o)
	  (t ?| ))))