@@ -2456,18 +2456,26 @@ package body LSP.Ada_Documents is
24562456 Start_Line : constant LSP.Types.Line_Number :=
24572457 LSP.Types.Line_Number (Segment.Start_Line) - 1 ;
24582458 Start_Line_Text : constant VSS.Strings.Virtual_String :=
2459- Self.Text.Slice
2460- (Self.Line_To_Marker (Start_Line),
2461- Self.Line_To_Marker (Start_Line + 1 ));
2459+ (if Self.Line_To_Marker.Last_Index = Start_Line then
2460+ Self.Text.Slice
2461+ (Self.Line_To_Marker (Start_Line), Self.Text.After_Last_Character)
2462+ else
2463+ Self.Text.Slice
2464+ (Self.Line_To_Marker (Start_Line),
2465+ Self.Line_To_Marker (Start_Line + 1 )));
24622466 Start_Iterator : VSS.Strings.Character_Iterators.Character_Iterator :=
24632467 Start_Line_Text.At_First_Character;
24642468
24652469 End_Line : constant LSP.Types.Line_Number :=
24662470 LSP.Types.Line_Number (Segment.End_Line) - 1 ;
24672471 End_Line_Text : constant VSS.Strings.Virtual_String :=
2468- Self.Text.Slice
2469- (Self.Line_To_Marker (End_Line),
2470- Self.Line_To_Marker (End_Line + 1 ));
2472+ (if Self.Line_To_Marker.Last_Index = End_Line then
2473+ Self.Text.Slice
2474+ (Self.Line_To_Marker (End_Line), Self.Text.After_Last_Character)
2475+ else
2476+ Self.Text.Slice
2477+ (Self.Line_To_Marker (End_Line),
2478+ Self.Line_To_Marker (End_Line + 1 )));
24712479 End_Iterator : VSS.Strings.Character_Iterators.Character_Iterator :=
24722480 End_Line_Text.At_First_Character;
24732481 Success : Boolean with Unreferenced;
0 commit comments