@@ -2456,18 +2456,26 @@ package body LSP.Ada_Documents is
2456
2456
Start_Line : constant LSP.Types.Line_Number :=
2457
2457
LSP.Types.Line_Number (Segment.Start_Line) - 1 ;
2458
2458
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 )));
2462
2466
Start_Iterator : VSS.Strings.Character_Iterators.Character_Iterator :=
2463
2467
Start_Line_Text.At_First_Character;
2464
2468
2465
2469
End_Line : constant LSP.Types.Line_Number :=
2466
2470
LSP.Types.Line_Number (Segment.End_Line) - 1 ;
2467
2471
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 )));
2471
2479
End_Iterator : VSS.Strings.Character_Iterators.Character_Iterator :=
2472
2480
End_Line_Text.At_First_Character;
2473
2481
Success : Boolean with Unreferenced;
0 commit comments