Skip to content

Commit 0186418

Browse files
committed
fix(repl): do not mix colors when highlighting 'import', due to 'or' matching as well as 'import'
1 parent 392b4c3 commit 0186418

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@
44
### Added
55
- the repl prints the output of the last expression it ran
66

7+
### Fixed
8+
- the REPL doesn't color `import` in two colors (red for `imp__t` and blue for `___or_`), it keeps the first color that matched (red for import here)
9+
710
### Changed
811

912
### Removed

src/arkscript/REPL/Utils.cpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,10 @@ namespace Ark::internal
149149

150150
pos += codepointLength(prefix);
151151
for (std::size_t i = 0; i < len; ++i)
152-
colors.at(pos + i) = color;
152+
{
153+
if (colors.at(pos + i) == replxx::Replxx::Color::DEFAULT)
154+
colors.at(pos + i) = color;
155+
}
153156

154157
pos += len;
155158
str = match.suffix();

0 commit comments

Comments
 (0)