Skip to content

libide/sourceview: Fix calculation of multiline range

RocketRide requested to merge rocketride/gnome-builder:main into main

It fixes multiline range calculation in ide_source_view_get_visual_position_range function which is used by position label

  1. Add +1 to range length, because we are dealing with closed interval
  2. Move insert or selection iterator backwards depending on direction of selection, so it will be located inside selection and we can determine across how many lines does selection span.

More about bugs:

  1. Make a selection which spans across multiple lines. See range in position label: its off by 1.


  2. Make a selection which goes from up to down and has '\n' in the end: range is correct here but if we fix first bug it going to be greater by 1 than expected.


    Same thing with selection from down to up with '\n' at the start.

Merge request reports