Skip to content

textview: Fix cursor/anchor mixup when retrieving surrounding text

Sebastian Keller requested to merge skeller/gtk:textview-cursor-anchor into main

Previously the cursor (insert) of a selection was considered the "start" while the anchor (selection bound) was considered the "end". Then the selection was considered flipped when the something was selected from left to right, with the anchor/end being before the cursor/start.

This selection wrongly being considered flipped then lead to the cursor and anchor position being mixed up.

Change this to the anchor/selection bound of a selection to be considered the start and the cursor/insert to be the end. Then for selections from left to right, they go from start to end and are not considered flipped. Selections from right to left on the other hand are considered flipped now.

Closes: #6460 (closed)

Merge request reports