anchor.diff:    (when (do-window-size-updates app)
       (send-window-size app)))
   
  -(defun telnet-receive (telnet)
  -  (handler-case
  -      (let ((connection (connection telnet))
  -            (xterm (xterm telnet))
  -            (last-was-cr nil))
  -        ;; Announce capabilities.
  -        (write-sequence (vector-ub8 +command-iac+ +command-do+ +option-suppress-go-ahead+
  -                                    +command-iac+ +command-will+ +option-window-size+)
  -                        connection)
  -        ;; FIXME: Translate from UTF-8 here. Can't use read-char on the tcp-stream because
  -        ;; terminal IO happens on top of the binary telnet layer.
  -        (loop
  -           (when (not (connection telnet))
  -             (return))
  -           (let ((byte (read-byte connection)))
  -             (cond ((eql byte +command-iac+)
  -                    (let ((command (read-byte connection)))
  -                      (if (eql command +command-iac+)
  -                          (mezzano.gui.xterm:receive-char (xterm telnet) (code-char +command-iac+))
  -                          (telnet-command telnet command))))
  -                   ((eql byte #x0D) ; CR
  -                    (setf last-was-cr t)
  -                    (mezzano.gui.xterm:receive-char xterm (code-char byte)))
  -                   ((and last-was-cr (eql byte #x00))
  -                    (setf last-was-cr nil))
  -                   (t (setf last-was-cr nil)
  -                      (mezzano.gui.xterm:receive-char xterm (code-char byte)))))))
  -    (end-of-file ()
  -      (mezzano.supervisor:fifo-push (make-instance 'server-disconnect-event)
  -                                    (fifo telnet)))))
  +(defun telnet-receive-byte (telnet byte)
  +  ;; FIXME: Translate from UTF-8 here. Can't use read-char on the tcp-stream because
  +  ;; terminal IO happens on top of the binary telnet layer.
  +  ;; FIXME: This does sync reads of the telnet stream when processing commands.
  +  ;; If the server doesn't play nice this will block the UI.
  +  (cond ((eql byte +command-iac+)
  +         (let ((command (read-byte (connection telnet))))
  +           (if (eql command +command-iac+)
  +               (mezzano.gui.xterm:receive-char (xterm telnet) (code-char +command-iac+))
  +               (telnet-command telnet command))))
  +        ((eql byte #x0D) ; CR
  +         (setf (last-was-cr telnet) t)
  +         (mezzano.gui.xterm:receive-char (xterm telnet) (code-char byte)))
  +        ((and (last-was-cr telnet) (eql byte #x00))
  +         (setf (last-was-cr telnet) nil))
  +        (t
  +         (setf (last-was-cr telnet) nil)
  +         (mezzano.gui.xterm:receive-char (xterm telnet) (code-char byte)))))
   
   (defvar *server-shortcuts*
     '(("nao" "nethack.alt.org")))
  
positive.code:                                          (when (eql ch (code-char +command-iac+))
                                             (write-byte +command-iac+ (connection telnet)))
                                           (write-byte (char-code ch) (connection telnet))))))
  
  (defmethod dispatch-event (telnet (event server-disconnect-event))
    (setf (connection telnet) nil)
    (telnet-write-string telnet (format nil "~%Disconnected from server")))
  
  (defmethod dispatch-event (app (event mezzano.gui.compositor:resize-request-event))
    (let ((old-width (mezzano.gui.compositor:width (window app)))
  
negative.code:               (unwind-protect
                     (progn
                       (setf server (find-server telnet server))
                       (setf (connection telnet) (mezzano.network.tcp:tcp-stream-connect server port :element-type '(unsigned-byte 8)))
                       ;; Announce capabilities.
                       (write-sequence (vector-ub8 +command-iac+ +command-do+ +option-suppress-go-ahead+
                                                   +command-iac+ +command-will+ +option-window-size+)
                                       (connection telnet))
                       (setf (mezzano.gui.widgets:frame-title frame) (format nil "Telnet - ~A:~D" server port))
                       (mezzano.gui.widgets:draw-frame frame)
                       ;; Main interaction loop, when connected to the server.
                       (loop
                          (when (not (connection telnet))
                            (return))
                          (mezzano.sync:wait-for-objects fifo (connection telnet))
                          (loop
                             for msg = (mezzano.supervisor:fifo-pop fifo nil)
                             while msg
                             do (dispatch-event telnet msg))
                          (loop
                             for byte = (sys.int::read-byte-no-hang (connection telnet) nil :eof)
                             while byte
                             do (cond ((eql byte :eof)
                                       ;; Server disconnected
                                       (setf (connection telnet) nil)
                                       (telnet-write-string telnet (format nil "~%Disconnected from server"))
                                       (return))
                                      (t
                                       (telnet-receive-byte telnet byte)))))
                       ;; Post-connection interaction loop. Just processing compositor events.
                       (loop
                          (dispatch-event telnet (mezzano.supervisor:fifo-pop fifo))))
                  (when (connection telnet)
  