Fix bugs and improve cursor placement in GridLayouter and related