Community
Participate
Working Groups
insert key is not hooked up. It doesn't do anything.
Created attachment 25880 [details] patch for BlockEditPolicy, TextRun, TextRequest, and TextTool (and AbstractModifyString and ReplaceString are added). this patch implements the insert key functionality. 1. ReplaceString class is created. It's used when the editor is in the overwrite mode. 2. AbstractModifyString class is created. This is a bass class for ReplaceString and InsertString since they share a lot of code. 3. the request for the overwriting is created (TextRequest.REQ_REPLACE). 4. BlockEditPolicy was modified so that it traps REQ_REPLACE and create ReplaceString. It reuses the getInsertionCommand method that was used for TextRequest.REQ_INSERT. 5. TextTool to trap insert key. Also, TextTool keeps track of the 'mode.' The mode can be overwrite or not overwrite (normal). TextTool uses the mode information to create TextRequest object (it used to create with REQ_INSERT whenever TextRequest was created). 6. TextRun.replaceText(String,int) is created. It's almost the same as insertText except that this method replaces the text at offset. I didn't add the file header again because we haven't figured out what to do about it... Thanks.
The TextTool now handles OVERWRITE. There are still some minor bugs remaining. 1) The positioning of the caret is not right for RTL text. Haven't tested it in the mirrored workbench either. 2) How wide should the overwrite caret be? Currently, it's half the height of the caret, which works quite well but isn't exact all the time. I've seen similar behaviour in a text editor (KWrite) on SUSE Linux. Word and Wordpad use the same caret for insert and overwrite. Powerpoint doesn't support the overwrite mode. We could just get the caret location for the current position and the next position and that would give us the exact width of the caret. This case would also fix the RTL case in 1 above. 3) TextRun has a bug where it only handles overwrite within itself, and doesn't move into the next run. So, if you're at the end of a TextFlowPart, overwrite does insert.