Confused about permanent residency

Hi, I'm confused about permanent residency. It says that to get Spanish permanent residency you need to have "legally lived in Spain for five uninterrupted years".  This is fine until brexit as UK citizens can stay as long as they like, but after brexit what would count as uninterrupted? As far as I'm aware non eu citizens have to apply for long term residence visas to stay longer than 3 months.
So say you move today and after 3 months you don't have a long term visa and need to fly back to your home country for a few months. When you come back, does it then restart the five year count or carry it on?

Thankyou.

At present no one can say what will happen after Brexit assuming it goes ahead

From a logical point of view after Brexit U.K. citizens will be treated as non EU  nationals.  Thus if one  searches on the internet, one will see what is required for a Non EU national to acquire residence status.

At present both EU nationals and non EU nationals acquire permanent status after five years of being granted permission to live here.   After that the requirements  for each group vary in that EU nationals need do no more to retain that status, non EU nationals must renew every ten  years

Under the draft agreement it appears brits will
be allowed to remain providing they are legally here on the day U.K. leaves, however, no deal may mean they will have no right to stay

As I said, no one knows for certain.

Anyones guess is as good as mine !