Former first minister Nicola Sturgeon has said she grieved for Alex Salmond four or five years before his death following the breakdown of their relationship.