Better implementation of widget _repr_ style display logic.