Question

So, I'm making this text editor from scratch using a custom edit control. As of now, I update the visible part of the current line in which the caret is contained. It works generally fine, but i tried to type really fast on it, and I notice that it flickers(only once or twice, and only for lines that are very long). But this little flicker is kinda not good.

  • So, I was wondering whether I should update only two characters at a time(the current character and the previous character). 2 characters because if I don't erase/update the previous character there would be an artifact from the cursor in the previous position.
  • I am also analyzing my code to check if there is a performance bottleneck or sloppy code out there. In this regard, I noticed that I pass a lot of `HANDLE's' to windows and stuff. I was wondering if it would make a difference if I pass them as references instead. I know that handles are 32-bit values as well, so I'm not sure if there would be any boost in performance.

Thanks!

Devjeet

Was it helpful?

Solution

Draw the contents of your editor control using MemDC. This example uses MFC, but the idea is independent of it.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top