The show The Two Ronnies started in the '70s, so it was closer to live performance than comedy shows today (nearly 50 years later). Both Ronnie Barker and Ronnie Corbett were able to react to unexpected events during filming (and make it funny) and were consummate performers.
Occasionally, it's obvious that they are briefly ad-libbing, but I suspect that they may have ad-libbed at other times and done it so well that it appeared to be scripted, in particular Ronnie Corbett during his rambling monologues.
How much ad-libbing did the Ronnies actually do in The Two Ronnies?