Sergey Tkachenko wrote: ↑Tue Nov 23, 2021 9:22 am
Maybe you have custom painting events assigned?
Not to the rve(s) other than the draw custom caret, and in the rve's style OnDrawParaBack (which I've tried disabling many times for testing) but I do for the line numbers (paint box), multi word highlighting (a combo of TWordEnum (to spin through the words) and WordPaintList (to paint the words)) and URL highlighting (WordPaintList). There is also spell checking that can affect things but spell check seems OK at this point.
However, I can turn all that stuff off with menu options and the code inside them is not running and I still have the "ghosts." I've also added hard coded "exit;" calls in those and many other procs and funcs to no avail.
Aside from hints and warnings in the IDE, I rely on MadExcept to tell me about leaks, and the windows task manager to monitor CPU. If all that looks OK and I'm not getting an actual error or AV when running, it's usually good. The added call to rve.Refresh; in rveVScrolled is not driving the cpu crazy so I'm OK with using it for now.
I have several rve's in the "big" app. The main one is the main editor rve and is running all the time. The secondary one is below that and I use that for a notepad and to do simple editing of the theme (and other) files. I have a third rve that shows up if the caret is on a bookmark check point. That one has almost no code attached, and no line numbers, and I use the system caret for that one so it's OK. However, if I set that one up for a custom caret, it too displays a "ghost" caret but only briefly; after a pause it goes away.
The 2 main rve's have the same "ghost" issue. Note that the actual caret (the one in the center vertically, see screen shots below) is a maroon color which matches the text color which is correct, the other 2 are white "ghosts" (probably clWindow, not clWhite). I am not intentionally drawing white carets anywhere in code that I'm aware of!
My guess right now, and it's just a guess, is there's so much going on in this app "behind the scenes," that when I scroll without the rve.Refresh in rveVScrolled, is that the caret drawing can't quite keep up with things. Even in a simple test app set up to use custom caret stuff just like the big app (but with no refresh call in rveVScrolled), there is a slight delay of caret drawing when scrolling vertically, but in the simple app there's time (I guess) for things to refresh properly.
BTW, I tried horizontal scrolling for the first time today and I have the same issue there as well, same refresh call fixes it there too. See screenshot below.
I'll keep looking. There must be something I'm doing causing it. Here are the various calls that seem to workaround the issue for me:
Code: Select all
//Fixes "ghost" carets when using custom caret functions. SRD
rve.Refresh;
//These also work, not sure which alternatives are lowest impact:
//RVSetLinearCaretPos(rve,RVGetLinearCaretPos(rve));
//rve.RVData.Invalidate;
//rve.RVData.Refresh;
Thanks Sergey
Stan
- Main app window
- SRDJournal 3.1.2.509-sm.png (158.34 KiB) Viewed 12935 times
- Caret "ghosts" after vertical scrolling
- SRDJournal caret ghosts.png (2.59 KiB) Viewed 12935 times
- Caret "ghosts" after horizontal scrolling
- SRDJournal caret horz ghosts.png (4.83 KiB) Viewed 12935 times