TextArea, RowCanvas

Henk Blik hjblik at dds.nl
Mon Feb 1 01:26:44 PST 1999


Hello,


Alexandre Oliva wrote:
> 
> There appears to be something wrong in the diff, all I can see is:
> 
> > 881c
> >       if ( i0 <= n ){
> 
> Please try again, and use `diff -u', `diff -c' or `diff -C3', since
> these are safer to apply if other changes have been installed already.

As requested with diff -c

mvg Henk
-------------- next part --------------
*** RowCanvas.java	Tue Dec  1 19:25:23 1998
--- kaffe-1.0.b3/libraries/javalib/java/awt/widgets/RowCanvas.java	Thu Jan 28 12:30:35 1999
***************
*** 244,251 ****
  	}
  
  	int d = BORDER_WIDTH;
- 	rgr.copyArea( d, d, width- 2*d, height- 2*d, 0, rows * rowHeight );
  
  	if ( rows < 0 ){
  		int sIdx = first + getVisibleRows() + rows;
  		int len = -rows + 1;
--- 244,262 ----
  	}
  
  	int d = BORDER_WIDTH;
  
+ 	// hjb, 01-28-1999: only move the area that will fall in
+ 	// pane after the copy.
+ 	// otherwise text is displayed above or under the pane
+ 	// obscuring the scrollbar and/or other fields
+ 	
+ 	if (rows < 0)
+ 	    rgr.copyArea( d, d + rows * rowHeight, width- 2*d, height- 2*d,
+ 			  0, rows * rowHeight );
+ 	else
+ 	    rgr.copyArea( d, d, width- 2*d, height- 2*d - rows * rowHeight,
+ 			  0, rows * rowHeight );
+ 	    
  	if ( rows < 0 ){
  		int sIdx = first + getVisibleRows() + rows;
  		int len = -rows + 1;
-------------- next part --------------
*** TextArea.java	Tue Dec  1 19:25:25 1998
--- kaffe-1.0.b3/libraries/javalib/java/awt/widgets/TextArea.java	Thu Jan 28 13:17:24 1999
***************
*** 252,257 ****
--- 252,258 ----
  	for ( int i=0; i<p.y; i++) {
  		TextBuffer tb = (TextBuffer)rows.elementAt( i);
  		xt += tb.len;
+ 		xt ++;  // hjb 01-27-1999: count the virtual newline
  	}
  	xt += p.x;
  	
***************
*** 271,276 ****
--- 272,278 ----
  		xt += tb.len;
  		if (xt >= pos)
  			return new Point( tb.len - xt + pos, i);
+ 		pos --;  // hjb 01-27-1999: substract 1 for the virtual newline
  	}
  	
  	return new Point( tb.len, rs-1);
***************
*** 418,429 ****
--- 420,437 ----
  		case e.VK_TAB:
  		  if ( sh )
  				return;	//do not consume event for HotKeyHandler
+ 		    if ( ! isEditable)  // hjb 01-27-1999: do nothing for TAB,
+ 			break;          // ENTER, DEL and BS if not editable
    		insertChar( '\t' );
  			break;
  		case e.VK_ENTER:
+ 		        if ( ! isEditable)
+ 			    break;
  			newline();
  			break;
  		case e.VK_BACK_SPACE:
+ 		        if ( ! isEditable)
+ 			    break;
  			if ( hasSel() )
  				replaceSelectionWith("");
  			else
***************
*** 430,435 ****
--- 438,445 ----
  				backspace();
  			break;
  		case e.VK_DELETE:
+ 		        if ( ! isEditable)
+ 		            break;
  			if ( hasSel() )
  				replaceSelectionWith("");
  			else
***************
*** 878,884 ****
  		}
  	}
  
! 	if ( i0 < n ){
  		v.addElement( new String( cbuf, i0, i-i0));
  	}
  	
--- 888,894 ----
  		}
  	}
  
! 	if ( i0 <= n ){
  		v.addElement( new String( cbuf, i0, i-i0));
  	}
  	


More information about the kaffe mailing list