Sergey Tkachenko wrote:Reformat is an overkill here. Use Invalidate.
ОК, rewrote this part.
I've got another one advice for this code - actually, I didn't find implementation for directional search, but I've done it directly in my processing procedures. If you gonna implement this contributed procedure for text searching in futher versions of TRichView, it could be useful to implement all the search options from Delphi search dialogs for example (and it'll be more MS Word like search conceptions).
This means, that the full list of options in ideal looks like:
a) Case sensitive option (implemented in this code)
b) Match case (implemented in this code)
c) Searching in entire scope/from cursor (partially implemented)
d) Searching in selected text/global search (not implemented - an due to this c) state won't work correctly in all cases - I've to make some adjustments to the contributed code and fix it in my inherited class - it didn't look so nice in object-oriented view

)
e) Direction of search - it's Achilles' heel of this code (not implemented). Without code corrections, I've done it with cycling through desire part of searching and keeping information of last found item. If the search routine couldn't find the right text, I'm simply restoring the last backup information. It's not looking nice for implementing "Find Next" method, but another way for making this functionality is to rewrite the DavidRM contributed procedure. This means that in the most bad situation it'll work with O(n!) complexity (but the sequent search has O(n) complexity

). Of course, in future I'll optimize my code and fix this slow part for searching, but not for now.
Despite all this disadvantages I've understood that another editors/viewers are far behind from your components, and if this functionality, described above, could be implemented in further versions, it would be outstanding.
With best regards
