<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">Index: def.h
===================================================================
RCS file: /var/cvsroot/ng/def.h,v
retrieving revision 1.7.2.1
retrieving revision 1.7.2.2
diff -c -r1.7.2.1 -r1.7.2.2
*** def.h	2001/07/23 18:15:53	1.7.2.1
--- def.h	2003/03/08 00:38:05	1.7.2.2
***************
*** 1,4 ****
! /* $Id: def.h,v 1.7.2.1 2001/07/23 18:15:53 amura Exp $ */
  /*
   * This file is the general header file for all parts
   * of the MicroEMACS display editor. It contains all of the
--- 1,4 ----
! /* $Id: def.h,v 1.7.2.2 2003/03/08 00:38:05 amura Exp $ */
  /*
   * This file is the general header file for all parts
   * of the MicroEMACS display editor. It contains all of the
***************
*** 11,16 ****
--- 11,19 ----
  
  /*
   * $Log: def.h,v $
+  * Revision 1.7.2.2  2003/03/08 00:38:05  amura
+  * fix query-replace bug
+  *
   * Revision 1.7.2.1  2001/07/23 18:15:53  amura
   * now buffers have only one mark (before windows have one mark)
   *
***************
*** 170,175 ****
--- 173,182 ----
  #define KNONE	0
  #define KFORW	1
  #define KBACK	2
+ #ifdef KANJI
+ #define KNOKANJI	0x80
+ #define KFLAGS(n)	((n) &amp; 0x0f)
+ #endif
  
  /*
   * All text is kept in circularly linked
Index: line.c
===================================================================
RCS file: /var/cvsroot/ng/line.c,v
retrieving revision 1.9.2.3
retrieving revision 1.9.2.4
diff -c -r1.9.2.3 -r1.9.2.4
*** line.c	2001/07/23 18:15:54	1.9.2.3
--- line.c	2003/03/08 00:38:05	1.9.2.4
***************
*** 1,4 ****
! /* $Id: line.c,v 1.9.2.3 2001/07/23 18:15:54 amura Exp $ */
  /*
   *		Text line handling.
   * The functions in this file
--- 1,4 ----
! /* $Id: line.c,v 1.9.2.4 2003/03/08 00:38:05 amura Exp $ */
  /*
   *		Text line handling.
   * The functions in this file
***************
*** 21,26 ****
--- 21,29 ----
  
  /*
   * $Log: line.c,v $
+  * Revision 1.9.2.4  2003/03/08 00:38:05  amura
+  * fix query-replace bug
+  *
   * Revision 1.9.2.3  2001/07/23 18:15:54  amura
   * now buffers have only one mark (before windows have one mark)
   *
***************
*** 487,492 ****
--- 490,502 ----
  	    }
  	}
  #endif
+ #ifdef KANJI
+ 	if (kflag &amp; KNOKANJI)
+ 		kanji2nd = -1;
+ 	else
+ 		kanji2nd = 0;
+ 	kflag = KFLAGS(kflag);
+ #endif
  
  	/*
  	 * HACK - doesn't matter, and fixes back-over-nl bug for empty
***************
*** 533,552 ****
  		lchange(WFEDIT);
  		cp1 = &amp;dotp-&gt;l_text[doto];	/* Scrunch text.	*/
  #ifdef	KANJI	/* 90.01.29  by S.Yoshida */
! 		cp2 = cp1;
! 		kanji2nd = FALSE;
! 		for (i = 0; i &lt; chunk; i++, cp2++) {
  			if (kanji2nd) {
! 				kanji2nd = FALSE;
! 			} else if (ISKANJI(*cp2)) {
! 				kanji2nd = TRUE;
  			}
  		}
- 		if (kanji2nd) {
- 			cp2++;
- 			chunk++;
- 			n++;
- 		}
  #else	/* NOT KANJI */
  		cp2 = cp1 + chunk;
  #endif	/* KANJI */
--- 543,566 ----
  		lchange(WFEDIT);
  		cp1 = &amp;dotp-&gt;l_text[doto];	/* Scrunch text.	*/
  #ifdef	KANJI	/* 90.01.29  by S.Yoshida */
! 		if (kanji2nd &lt; 0) /* ignore KANJI */
! 			cp2 = cp1 + chunk;
! 		else {
! 			cp2 = cp1;
! 			kanji2nd = 0;
! 			for (i = 0; i &lt; chunk; i++, cp2++) {
! 				if (kanji2nd) {
! 					kanji2nd = 0;
! 				} else if (ISKANJI(*cp2)) {
! 					kanji2nd = 1;
! 				}
! 			}
  			if (kanji2nd) {
! 				cp2++;
! 				chunk++;
! 				n++;
  			}
  		}
  #else	/* NOT KANJI */
  		cp2 = cp1 + chunk;
  #endif	/* KANJI */
***************
*** 600,606 ****
  		n -= chunk;
  	}
  #ifdef	CLIPBOARD
! 	send_clipboard();
  #endif
  #ifdef	UNDO
  	if (isundo() &amp;&amp; char_num!=0) {
--- 614,621 ----
  		n -= chunk;
  	}
  #ifdef	CLIPBOARD
! 	if (kflag != KNONE)
! 		send_clipboard();
  #endif
  #ifdef	UNDO
  	if (isundo() &amp;&amp; char_num!=0) {
***************
*** 754,760 ****
--- 769,779 ----
  	}
  #endif
  	if (plen &gt; rlen)
+ #ifdef KANJI
+ 		(VOID) ldelete((RSIZE) (plen-rlen), KNONE|KNOKANJI);
+ #else
  		(VOID) ldelete((RSIZE) (plen-rlen), KNONE);
+ #endif
  	else if (plen &lt; rlen) {
  		if (linsert((int)(rlen-plen), ' ') == FALSE)
  			return FALSE;
</pre></body></html>