aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/files_map.adb5
-rw-r--r--src/files_map.ads7
-rw-r--r--src/ghdldrv/ghdlprint.adb4
3 files changed, 12 insertions, 4 deletions
diff --git a/src/files_map.adb b/src/files_map.adb
index 3cb7e0594..66b3a1087 100644
--- a/src/files_map.adb
+++ b/src/files_map.adb
@@ -261,7 +261,8 @@ package body Files_Map is
-- Convert a physical column to a logical column.
-- A physical column is the offset in byte from the first byte of the line.
-- A logical column is the position of the character when displayed.
- -- A HT (tabulation) moves the cursor to the next position multiple of 8.
+ -- A HT (tabulation) moves the cursor to the next position multiple of the
+ -- tab stop.
-- The first character is at position 1 and at offset 0.
procedure Coord_To_Position (File : Source_File_Entry;
Line_Pos : Source_Ptr;
@@ -278,7 +279,7 @@ package body Files_Map is
else
for I in Line_Pos .. Line_Pos + Source_Ptr (Offset) - 1 loop
if Source_File.Source (I) = ASCII.HT then
- Res := Res + 8 - Res mod 8;
+ Res := Res + Tab_Stop - Res mod Tab_Stop;
else
Res := Res + 1;
end if;
diff --git a/src/files_map.ads b/src/files_map.ads
index d06805948..55933ebc3 100644
--- a/src/files_map.ads
+++ b/src/files_map.ads
@@ -22,6 +22,13 @@ with Nodes;
package Files_Map is
+ -- Range for Tab_Stop.
+ subtype Tab_Stop_Range is Natural range 1 .. 120;
+
+ -- Tab width: a tab character jumps to the next column that is one plus a
+ -- multiple of this witdh (if columns are numbered from 1).
+ Tab_Stop : Tab_Stop_Range := 8;
+
-- Create the path from DIRECTORY and NAME:
-- If NAME is an absolute pathname, then return NAME.
-- Otherwise, return the concatenation of DIRECTORY and NAME.
diff --git a/src/ghdldrv/ghdlprint.adb b/src/ghdldrv/ghdlprint.adb
index 53df620ae..9aac16824 100644
--- a/src/ghdldrv/ghdlprint.adb
+++ b/src/ghdldrv/ghdlprint.adb
@@ -146,8 +146,8 @@ package body Ghdlprint is
C := Buf (P);
if C = HT then
-- Expand TABS.
- N_Col := Col + 8;
- N_Col := N_Col - N_Col mod 8;
+ N_Col := Col + Tab_Stop;
+ N_Col := N_Col - N_Col mod Tab_Stop;
while Col < N_Col loop
Put (' ');
Col := Col + 1;