Commit e2c15bd1 authored by Benoît Minisini's avatar Benoît Minisini
Browse files

Fix highlighting and rewriting of lines having comments with more than one space before them.

[GB.EVAL]
* BUG: Fix highlighting and rewriting of lines having comments with more than one space before them.
parent 67e13ac2
Pipeline #332070159 passed with stage
in 24 minutes and 28 seconds
......@@ -372,7 +372,7 @@ static void analyze(EVAL_ANALYZE *result)
if (type == RT_SPACE)
{
if (!EVAL->rewrite || _colors_len == 0 || PATTERN_is_end(pattern[1]))
if (!EVAL->rewrite || _colors_len == 0 || PATTERN_is_end(pattern[1]) || PATTERN_is_comment(pattern[1]))
{
len = PATTERN_index(*pattern);
add_data(RT_SPACE, len);
......@@ -457,7 +457,7 @@ static void analyze(EVAL_ANALYZE *result)
case RT_COMMENT:
//state = Commentary;
space_before = *symbol != ' ';
space_before = FALSE; //*symbol != ' ';
i = get_symbol_indent(symbol, len);
if (i <= (len - 2) && symbol[i + 1] == '\'')
type = RT_HELP;
......@@ -557,7 +557,7 @@ static void analyze(EVAL_ANALYZE *result)
break;
}
if (space_before && old_type != RT_END && EVAL->rewrite)
if (EVAL->rewrite && space_before && old_type != RT_END)
{
add_result_char(result, ' ');
add_data(preprocessor ? RT_PREPROCESSOR : RT_SPACE, 1);
......
......@@ -849,36 +849,10 @@ static void add_comment()
int len;
int index;
int type;
bool space = FALSE;
start = source_ptr;
len = 1;
for(;;)
{
if (start == EVAL->source)
break;
start--;
car = *start;
if (car == '\n')
break;
if (car > ' ')
{
start++;
space = TRUE;
break;
}
len++;
}
if (!space)
{
start = source_ptr;
len = 1;
}
for(;;)
{
source_ptr++;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment