Subject: bug#76679: 31.0.50; forward-sentence not working in the narrowed buffer under c-ts-mode

From: Juri Linkov <[email-masked]>
Date: Thu, 13 Mar 2025 20:45:09 +0200

merge 76679 76497
close 76679 31.0.50
thanks

> @@ -3417,9 +3417,10 @@ treesit-forward-sentence
>  by `text' and `sentence' in `treesit-thing-settings'."
>    (if (treesit-node-match-p (treesit-node-at (point)) 'text t)
>        (funcall #'forward-sentence-default-function arg)
> -    (funcall
> -     (if (> arg 0) #'treesit-end-of-thing #'treesit-beginning-of-thing)
> -     'sentence (abs arg))))
> +    (or (funcall
> +         (if (> arg 0) #'treesit-end-of-thing #'treesit-beginning-of-thing)
> +         'sentence (abs arg))
> +        (goto-char (if (> arg 0) (point-max) (point-min))))))

Actually this is not so simple, because also need to handle
range boundaries as well.  So pushed the change that stops
at the 'treesit-parser' overlay's end.