[60] in bug-owl

home help back first fref pref prev next nref lref last post

transpose-chars patch

daemon@ATHENA.MIT.EDU (Jeremy Daniel)
Sun Jul 21 23:59:11 2002

To: bug-owl@MIT.EDU
From: Jeremy Daniel <jdaniel@MIT.EDU>
Date: 21 Jul 2002 23:59:07 -0400
Message-ID: <skeu1msfm5w.fsf@multics.mit.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii

Here's my first patch against the cvs.  It binds C-t to a
transpose-chars function in editwin.  Thanks to erik for pointers to
the right files to edit to make this patch.

/mit/jdaniel/project/owl/build-cvs/patches/transpose-chars.patch
------------------
Index: commands.c
===================================================================
RCS file: /mit/ktools/src/owl/repository/owl/commands.c,v
retrieving revision 1.12
diff -r1.12 commands.c
573a574,578
>   OWLCMD_VOID_CTX("edit:transpose-chars", owl_editwin_transpose_chars,
> 		  OWL_CTX_EDIT,
> 		  "Interchange characters around point, moving forward one character.",
> 		  "", ""),
> 
Index: editwin.c
===================================================================
RCS file: /mit/ktools/src/owl/repository/owl/editwin.c,v
retrieving revision 1.6
diff -r1.6 editwin.c
369a370,395
> void owl_editwin_transpose_chars(owl_editwin *e) {
>   /* Swap the character at point with the character at point-1 and
>    * advance the pointer.  If point is after the last character swap 
>    * point-1 with point-2 (behaves as observed in tcsh and emacs).
>    */ 
>   int z;
>   char tmp;
> 
>   if (e->bufflen==0) return;
>   
>   /* get the deletion point */
>   z=_owl_editwin_get_index_from_xy(e);
> 
>   if (z==e->bufflen) {
>     /* point is after last character */
>     tmp=e->buff[z-1];
>     e->buff[z-1]=e->buff[z-2];
>     e->buff[z-2]=tmp;
>   } else {
>     tmp=e->buff[z];
>     e->buff[z]=e->buff[z-1];
>     e->buff[z-1]=tmp;
>     owl_editwin_key_right(e);
>   }
> }
> 
Index: keys.c
===================================================================
RCS file: /mit/ktools/src/owl/repository/owl/keys.c,v
retrieving revision 1.10
diff -r1.10 keys.c
71a72,73
>   BIND_CMD("C-t",         "edit:transpose-chars", "");
> 
------------------


				Jer


------------------------------------------------------------------
Tulgey Wood - tulgeywood@attbi.com     Cell Phone: 617-429-8573 / 
4 Farragut Ave (617-629-3983)             jdaniel-phone@mit.edu
Somerville, MA 02144-1709              AIM: jdanielmit      
                                    
Zephyr athena users over the web:  http://webzephyr.mit.edu/

home help back first fref pref prev next nref lref last post