[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Best way to intercept terminal escape sequences?
From: |
David Kastrup |
Subject: |
Re: Best way to intercept terminal escape sequences? |
Date: |
Fri, 27 Aug 2010 16:17:14 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
Ryan Johnson <address@hidden> writes:
> On Fri, 27 Aug 2010 12:36:52 +0200, David Kastrup wrote:
>> Ryan Johnson<address@hidden> writes
>>> I tried setting the keyboard-coding-system to iso-latin-1, but no
>>> luck.
>> You should set it to raw-text, do your mouse code preprocessing, and
>> afterwards decode the remainder using the intended coding system.
> Like this?
>
> (defun xterm-mouse-event-read ()
> (let ((c (read-char)))
> (cond
> ;; out-of-bounds values come back as zero
> ((eq c 0) #x100)
> ;; 8-bit characters come back weird
> ((> c (unibyte-char-to-multibyte #xff))
> (+ #x80 (logand #xff c)))
> ((> c #xff)
> (multibyte-char-to-unibyte c))
> ;; normal 7-bit character
> (c))))
I don't see that you are setting the
> (defun xterm-mouse-pos-read ()
> (let ((old-coding (keyboard-coding-system)))
> (set-keyboard-coding-system 'raw-text)
> (unwind-protect
> (cons (xterm-mouse-event-read) (xterm-mouse-event-read))
> (set-keyboard-coding-system old-coding))))
You can't go setting the keyboard reading system back and forth. It
operates into a buffer even before calling read-char. You have to put
it to raw and stick with it.
> First, it's unusably slow.
It would probably be best to write a CCL program for that sort of
thing.
--
David Kastrup
- Best way to intercept terminal escape sequences?, Ryan Johnson, 2010/08/26
- Re: Best way to intercept terminal escape sequences?, Ryan Johnson, 2010/08/27
- Re: Best way to intercept terminal escape sequences?,
David Kastrup <=
- Re: Best way to intercept terminal escape sequences?, Ryan Johnson, 2010/08/27
- Re: Best way to intercept terminal escape sequences?, Eli Zaretskii, 2010/08/27
- Re: Best way to intercept terminal escape sequences?, Stefan Monnier, 2010/08/27
- Re: Best way to intercept terminal escape sequences?, Ryan Johnson, 2010/08/28
- Re: Best way to intercept terminal escape sequences?, Stefan Monnier, 2010/08/28
- Re: Best way to intercept terminal escape sequences?, Ryan Johnson, 2010/08/28
- Re: Best way to intercept terminal escape sequences?, Ryan Johnson, 2010/08/31