refactoring: extracted common code for scrolling to caret

(cherry picked from commit 860f5a0b36b35df5ba2c45d142074b22cad25d52)
IDEA-126958 Syntax-coloured copying: TODOs color are ignored

partial solution - default TODO color settings will be used (from color scheme)

(cherry picked from commit 39c4e10539d08807174206e7f2136611d00cd42b)