From 1b002fb0ceaed9da5f5997bb900eb0aa64b820dc Mon Sep 17 00:00:00 2001 From: Pavel Shevaev Date: Thu, 25 Aug 2022 16:05:11 +0300 Subject: [PATCH] Trying to properly handle tabs --- bhl.inc.php | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/bhl.inc.php b/bhl.inc.php index f45405b..199af46 100644 --- a/bhl.inc.php +++ b/bhl.inc.php @@ -360,7 +360,19 @@ function bhl_clean_cache() function bhl_show_position($line, $row, array $lines) { if($line > 0 && $line <= count($lines)) - return $lines[$line-1].str_repeat('-', $row)."^"; + { + //handling tabs + $hint = str_replace("\t", " ", $lines[$line-1]); + for($c=0;$c<$row;++$c) + { + if($lines[$line-1][$c] === "\t") + $hint .= "----"; + else + $hint .= "-"; + } + $hint .= "^"; + return $hint; + } else return "??? @($line:$row)"; }