@@ -97,7 +97,9 @@ package body Codefix.Text_Manager.Ada_Commands is
9797 Close_Cursor.Set_Line (Sloc_Start.Line);
9898 Close_Cursor.Set_Column
9999 (To_Column_Index
100- (String_Index_Type (Sloc_Start.Column), Line));
100+ (String_Index_Type (Sloc_Start.Column),
101+ Line,
102+ Current_Text.Tab_Width (Open_Cursor.File)));
101103
102104 return True;
103105 end if ;
@@ -201,10 +203,11 @@ package body Codefix.Text_Manager.Ada_Commands is
201203 loop
202204 declare
203205 Full_Line : constant String :=
204- Get_Line (Current_Text, End_Cursor, 1 );
205- J : String_Index_Type :=
206- To_Char_Index
207- (Get_Column (End_Cursor), Full_Line) - 1 ;
206+ Get_Line (Current_Text, End_Cursor, 1 );
207+ J : String_Index_Type := To_Char_Index
208+ (Get_Column (End_Cursor),
209+ Full_Line,
210+ Current_Text.Tab_Width (End_Cursor.Get_File)) - 1 ;
208211
209212 begin
210213 -- Skip previous blanks
@@ -222,7 +225,9 @@ package body Codefix.Text_Manager.Ada_Commands is
222225 Set_Location
223226 (End_Cursor,
224227 Get_Line (End_Cursor),
225- To_Column_Index (J, Full_Line) + 1 );
228+ To_Column_Index
229+ (J, Full_Line,
230+ Current_Text.Tab_Width (End_Cursor.Get_File)) + 1 );
226231
227232 exit ;
228233
@@ -244,7 +249,9 @@ package body Codefix.Text_Manager.Ada_Commands is
244249 Set_Location
245250 (End_Cursor,
246251 Get_Line (End_Cursor),
247- To_Column_Index (J, Full_Line));
252+ To_Column_Index
253+ (J, Full_Line,
254+ Current_Text.Tab_Width (End_Cursor.Get_File)));
248255
249256 exit ;
250257 end if ;
@@ -876,7 +883,9 @@ package body Codefix.Text_Manager.Ada_Commands is
876883 Set_Location
877884 (Position,
878885 Get_Construct (Declaration).Sloc_End.Line,
879- To_Column_Index (Char_Ind, Line));
886+ To_Column_Index
887+ (Char_Ind, Line,
888+ Current_Text.Tab_Width (Cursor.Get_File)));
880889 end ;
881890 end Add_Pragma ;
882891
@@ -909,7 +918,9 @@ package body Codefix.Text_Manager.Ada_Commands is
909918 Set_Location
910919 (Position,
911920 Get_Construct (Clause).Sloc_End.Line,
912- To_Column_Index (Char_Ind, Line));
921+ To_Column_Index
922+ (Char_Ind, Line,
923+ Current_Text.Tab_Width (Cursor.Get_File)));
913924 end ;
914925 end Add_Clause_Pragma ;
915926
@@ -943,7 +954,9 @@ package body Codefix.Text_Manager.Ada_Commands is
943954 Set_Location
944955 (Position,
945956 Get_Construct (Declaration).Sloc_End.Line,
946- To_Column_Index (Char_Ind, Line));
957+ To_Column_Index
958+ (Char_Ind, Line,
959+ Current_Text.Tab_Width (Cursor.Get_File)));
947960 end ;
948961 end Add_Literal_Pragma ;
949962
@@ -971,7 +984,9 @@ package body Codefix.Text_Manager.Ada_Commands is
971984 (Position, Get_Construct (Declaration).Sloc_Entity.Line,
972985 To_Column_Index
973986 (String_Index_Type
974- (Get_Construct (Declaration).Sloc_Entity.Column), Line));
987+ (Get_Construct (Declaration).Sloc_Entity.Column),
988+ Line,
989+ Current_Text.Tab_Width (Cursor.Get_File)));
975990 end ;
976991
977992 Garbage := Position;
@@ -1292,7 +1307,8 @@ package body Codefix.Text_Manager.Ada_Commands is
12921307 Begin_Cursor.Line := Sloc_Start.Line;
12931308 Begin_Cursor.Col := To_Column_Index
12941309 (String_Index_Type (Sloc_Start.Column),
1295- Get_Line (Current_Text, Begin_Cursor, 1 ));
1310+ Get_Line (Current_Text, Begin_Cursor, 1 ),
1311+ Current_Text.Tab_Width (Begin_Cursor.Get_File));
12961312 end if ;
12971313 end Begin_Of_Profile ;
12981314
@@ -1306,7 +1322,8 @@ package body Codefix.Text_Manager.Ada_Commands is
13061322 End_Cursor.Line := Last_Entity_Line;
13071323 End_Cursor.Col := To_Column_Index
13081324 (String_Index_Type (Last_Entity_Column),
1309- Get_Line (Current_Text, End_Cursor, 1 ));
1325+ Get_Line (Current_Text, End_Cursor, 1 ),
1326+ Current_Text.Tab_Width (End_Cursor.Get_File));
13101327
13111328 if Begin_Cursor = Null_File_Cursor then
13121329 End_Cursor.Col := End_Cursor.Col + 1 ;
@@ -1389,7 +1406,8 @@ package body Codefix.Text_Manager.Ada_Commands is
13891406 To_Column_Index
13901407 (String_Index_Type
13911408 (Get_Construct (Position_It).Sloc_Start.Column),
1392- Get_Line (Current_Text, Begin_Analyze_Cursor, 1 )));
1409+ Get_Line (Current_Text, Begin_Analyze_Cursor, 1 ),
1410+ Current_Text.Tab_Width (Begin_Analyze_Cursor.Get_File)));
13931411
13941412 Last_Entity_Column := Integer (Begin_Analyze_Cursor.Col);
13951413 Last_Entity_Line := Begin_Analyze_Cursor.Line;
@@ -1720,7 +1738,10 @@ package body Codefix.Text_Manager.Ada_Commands is
17201738 (Get_File (Line_Cursor)).Indent_Line (Line_Cursor);
17211739 else
17221740 Char_Ind := To_Char_Index
1723- (This.Force_Column, Get_Line (Current_Text, Line_Cursor, 1 ));
1741+ (This.Force_Column,
1742+ Get_Line (Current_Text, Line_Cursor, 1 ),
1743+ Current_Text.Tab_Width (Line_Cursor.Get_File));
1744+
17241745 Indent_Size := Natural (Char_Ind) - 1 ;
17251746
17261747 declare
@@ -1929,7 +1950,9 @@ package body Codefix.Text_Manager.Ada_Commands is
19291950 (This => Cursor,
19301951 Line => Sloc_End.Line,
19311952 Column => To_Column_Index
1932- (String_Index_Type (Sloc_End.Column), Line));
1953+ (String_Index_Type (Sloc_End.Column),
1954+ Line,
1955+ Current_Text.Tab_Width (Cursor.Get_File)));
19331956 end if ;
19341957
19351958 return Stop_Scanning;
@@ -2207,7 +2230,9 @@ package body Codefix.Text_Manager.Ada_Commands is
22072230
22082231 End_Line := Sloc_End.Line;
22092232 End_Column := To_Column_Index
2210- (String_Index_Type (Sloc_End.Column), Line);
2233+ (String_Index_Type (Sloc_End.Column),
2234+ Line,
2235+ Current_Text.Tab_Width (Cursor.Get_File));
22112236
22122237 return False;
22132238 end Scan_Forward_Callback ;
@@ -2288,8 +2313,8 @@ package body Codefix.Text_Manager.Ada_Commands is
22882313 Current_Text.Get_Current_Cursor (This.Cursor.all );
22892314 Line : constant String := Get_Line (Current_Text, Cursor, 1 );
22902315 New_Id : String (1 .. Line'Length);
2291- Index : String_Index_Type :=
2292- To_Char_Index (Get_Column (Cursor), Line);
2316+ Index : String_Index_Type := To_Char_Index
2317+ (Get_Column (Cursor), Line, Current_Text.Tab_Width (Cursor.Get_File) );
22932318 New_Id_Index : Integer := 1 ;
22942319 Start_Index : String_Index_Type;
22952320 begin
@@ -2325,7 +2350,8 @@ package body Codefix.Text_Manager.Ada_Commands is
23252350 end if ;
23262351 end loop ;
23272352
2328- Cursor.Col := To_Column_Index (Start_Index, Line);
2353+ Cursor.Col := To_Column_Index
2354+ (Start_Index, Line, Current_Text.Tab_Width (Cursor.Get_File));
23292355
23302356 Current_Text.Replace
23312357 (Cursor,
@@ -2384,7 +2410,8 @@ package body Codefix.Text_Manager.Ada_Commands is
23842410 Pragma_Cursor.Set_Column
23852411 (To_Column_Index
23862412 (String_Index_Type (Get_Construct (It).Sloc_Start.Column),
2387- Current_Text.Get_Line (Pragma_Cursor, 0 )));
2413+ Current_Text.Get_Line (Pragma_Cursor, 0 ),
2414+ Current_Text.Tab_Width (Pragma_Cursor.Get_File)));
23882415
23892416 declare
23902417 List : Ada_Statement;
@@ -2581,7 +2608,8 @@ package body Codefix.Text_Manager.Ada_Commands is
25812608 End_Line : constant String :=
25822609 Current_Text.Get_Line (Src_End_Cursor, 0 );
25832610 begin
2584- Src_End_Cursor.Col := To_Column_Index (End_Line'Length, End_Line);
2611+ Src_End_Cursor.Col := To_Column_Index
2612+ (End_Line'Length, End_Line, Current_Text.Tab_Width (Cursor.File));
25852613 end ;
25862614
25872615 if Prev_Entity = Null_Construct_Tree_Iterator then
@@ -2596,7 +2624,10 @@ package body Codefix.Text_Manager.Ada_Commands is
25962624 End_Line : constant String :=
25972625 Current_Text.Get_Line (Dst_Cursor, 0 );
25982626 begin
2599- Dst_Cursor.Col := To_Column_Index (End_Line'Length, End_Line) + 1 ;
2627+ Dst_Cursor.Col := To_Column_Index
2628+ (End_Line'Length,
2629+ End_Line,
2630+ Current_Text.Tab_Width (Dst_Cursor.Get_File)) + 1 ;
26002631 end ;
26012632 else
26022633 -- If there is a subprogram before, place it after the end of that
@@ -2608,7 +2639,10 @@ package body Codefix.Text_Manager.Ada_Commands is
26082639 End_Line : constant String :=
26092640 Current_Text.Get_Line (Dst_Cursor, 0 );
26102641 begin
2611- Dst_Cursor.Col := To_Column_Index (End_Line'Length, End_Line) + 1 ;
2642+ Dst_Cursor.Col := To_Column_Index
2643+ (End_Line'Length,
2644+ End_Line,
2645+ Current_Text.Tab_Width (Dst_Cursor.Get_File)) + 1 ;
26122646 end ;
26132647 end if ;
26142648
@@ -2863,7 +2897,9 @@ package body Codefix.Text_Manager.Ada_Commands is
28632897 Name_Cursor.Set_Location
28642898 (Sloc_Start.Line,
28652899 To_Column_Index
2866- (String_Index_Type (Sloc_Start.Column), Line));
2900+ (String_Index_Type (Sloc_Start.Column),
2901+ Line,
2902+ Current_Text.Tab_Width (Name_Cursor.Get_File)));
28672903
28682904 Name_Length := Sloc_End.Column - Sloc_Start.Column + 1 ;
28692905
0 commit comments