trichview.support
Re: possible bug, Search/Replace question |
Author |
Message |
Sergey Tkachenko |
Posted: 04/30/2002 11:33:21 > Menu shortcut was indeed the reason for different behavior of Ctrl+V and > Shift+Insert. > > But I still believe that if: > a) I define RichViewEdit.Options:=[rvoAutoCopyText]; > b) In OnPaste event handler I have DoDefault := True; > that the text should be pasted as the text and not as RTF or RVF when using > the Ctrl+V and Shift+Insert (This is the way I understand the help for Paste > procedure, but I could be wrong, of course). Yes, if only rvoAutoCopyText in Options, and not other rvoAutoCopy*** options, only text will be copied (and pasted). In response on menu click you should execute RichViewEdit.CopyDef (RichViewEdit.Copy copies in all formats regardless of Options) > > >I do not understand what do you want to achieve. Returning to the original > position after executing Replace All command or something different? > > > Just an example - in sentence: > "quick brown fox jumps over the lazy dog's back" I have caret at beginning > of 'lazy'. If I now do search/replace of word 'brown' with 'red', my caret > is just before letter 'z' of 'lazy' (i.e. caret is at the same byte offset > from beginning of sentence, but it is not at same position of the text). > I cant figure out does the RichView offers an way to 'anchor' the caret to > the text (bookmark, jumppoint ..)? After replacing text, the caret will be at the end of inserted text (or at the beginning, if you call InsertText(NewText, True) what is highly recommended for replacing in up-down direction). So, as I understand, you actually want to return caret to the original location yourself. To do it, you need to store somehow this position. Results of GetSelectionBounds will work if replacement is in up-down direction . If replacement is in down-up direction, a text before will be changed and stored indices will not be valid (as you mentioned). You need to store position as a number of characters from the END of document (considering pictures/tables as one character). This value will not be changed when replacing in down-up direction, and can be used to restore caret position. > > Excuse me, please for awkward explanation before, but to express oneself > in non native language can be the bitch .. Hope this time around it is better |
Powered by ABC Amber Outlook Express Converter