stdout

Sun, 03 Dec 2006

Zile on OS X

Lately I've been fiddling with the emacs clone zile on Mac OS X

The version in macports is 2.0.7. This works fine, and in particular, C-h works for help, and Backspace works for deleting text.

The current release is 2.2.22. Unpatched on OS X C-h deletes text, as does backspace - it's not picking up the difference correctly. From a peer at the source, the difference is that the earlier release uses a termcap based terminal, where the later one uses ncurses.

I had a fiddle around looking at which keycodes are returned, and found 2.2.22 does actually see a difference between C-h and backspace, but it ignores it. So I wrote the following patch:

diff -ur zile-2.2.22/src/term_ncurses.c macports-trunk/dports/editors/zile/work/zile-2.2.22/src/term_ncurses.c
--- zile-2.2.22/src/term_ncurses.c	2006-09-13 20:54:39.000000000 +0100
+++ macports-trunk/dports/editors/zile/work/zile-2.2.22/src/term_ncurses.c	2006-09-21 22:02:01.000000000 +0100
@@ -155,6 +155,7 @@
   case KEY_DC:		/* DEL */
     return KBD_DEL;
   case KEY_BACKSPACE:	/* BS */
+	return KBD_CTRL | 'h';
   case 0177:		/* BS */
     return KBD_BS;
   case KEY_IC:		/* INSERT */

This appears to work exactly right on OS X, and also worked on a quick test of a ssh into a FreeBSD system. I've submitted the patch to the zile people via the Sourceforge patch tracker, and will see what they think. It looks a bit too magical to be portable, but it works on the only machines I've got handy.

I don't actually understand ncurses.

[21:19] | [] | Zile on OS X

< December 2006 >
SuMoTuWeThFrSa
      1 2
3 4 5 6 7 8 9
10111213141516
17181920212223
24252627282930
31      

Contact: Michael Stevens <mstevens@etla.org>

RSS: RSS feed

Atom: Atom feed

Valid XHTML 1.0!

Valid CSS!