Bug 106416 - insert key doesn't work properly in the text example
Summary: insert key doesn't work properly in the text example
Status: NEW
Alias: None
Product: GEF
Classification: Tools
Component: GEF-Legacy GEF (MVC) (show other bugs)
Version: unspecified   Edit
Hardware: PC Linux
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: gef-inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-08-08 19:07 EDT by Takahiro Kato CLA
Modified: 2016-12-14 11:17 EST (History)
0 users

See Also:


Attachments
patch for BlockEditPolicy, TextRun, TextRequest, and TextTool (and AbstractModifyString and ReplaceString are added). (24.25 KB, patch)
2005-08-08 19:17 EDT, Takahiro Kato CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Takahiro Kato CLA 2005-08-08 19:07:24 EDT
insert key is not hooked up.  It doesn't do anything.
Comment 1 Takahiro Kato CLA 2005-08-08 19:17:59 EDT
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.
Comment 2 Pratik Shah CLA 2005-12-20 17:32:54 EST
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.