fdo#75718: Correctly count the length of trailing empty range.

This affects auto fill, apparently.

Change-Id: I653918d374122bc9bb938231934c149da79a3306
(cherry picked from commit 01de94471c20a8b9c36d6080638d70e57eac55bf)
Reviewed-on: https://gerrit.libreoffice.org/8501
Tested-by: Markus Mohrhard <markus.mohrhard@googlemail.com>
Reviewed-by: Markus Mohrhard <markus.mohrhard@googlemail.com>