[61] in bug-owl

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

fix to my transpose patch

daemon@ATHENA.MIT.EDU (Jeremy Daniel)
Mon Jul 22 00:42:18 2002

To: bug-owl@MIT.EDU
From: Jeremy Daniel <jdaniel@MIT.EDU>
Date: 22 Jul 2002 00:42:16 -0400
Message-ID: <skeptxgfk5z.fsf@multics.mit.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii

Oops, the last one failed to take into account the one of the border
cases.  Here's the fixed version:

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,398
> 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 at beginning of buffer do
>    * nothing.  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 cursor point */
>   z=_owl_editwin_get_index_from_xy(e);
> 
>   if (z-1 < e->lock) {
>     /* point is at beginning of buffer, do nothing */
>     return;
>   } else if (z==e->bufflen) {
>     /* point is after last character */
>     z--;
>   }
> 
>   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