Improve cursor handling to prevent flickering during resize.