is cursor visible

I am looking to create a function that returns true or false if the cursor is visible within the active area of the codemirror viewport (isCursorVisible). I am using fullscreen mode and need to check this, but having difficulties.

Thank you,

You can get the coordinates of the cursor and compare these to the bounding box of the scrolling element (editor.getScrollerElement())

Thank you for your quick response. I am actually quite lost at the moment…

Can you give me a little bit more help? I really need this function and just can’t seem to get it right.

Thank you for your time.

function isCursorVisible() {
var cursor = cm.cursorCoords(null,‘local’);
var scroll = cm.getScrollInfo();
var bottom =;
if ( < return false;
if (cursor.bottom > bottom) return false;
return true;

Works like a charm! :slight_smile: