Skip to content

Commit 8d45659

Browse files
committed
Make tab size a constant
1 parent 187eb06 commit 8d45659

2 files changed

Lines changed: 3 additions & 1 deletion

File tree

lib/include/pl/core/lexer.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ namespace pl::core
7979
return false;
8080
}
8181

82+
static constexpr int tabsize = 4;
83+
8284
std::string m_sourceCode;
8385
const api::Source *m_source = nullptr;
8486
std::vector<Token> m_tokens;

lib/source/pl/core/lexer.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ namespace pl::core
572572
if (c == '\t')
573573
{
574574
u32 column = m_tabCompensation + (m_cursor - m_lineBegin + 1);
575-
u32 tabbedColumn = (((column - 1) / 4 + 1) * 4) + 1;
575+
u32 tabbedColumn = (((column - 1) / tabsize + 1) * tabsize) + 1;
576576
m_tabCompensation += tabbedColumn - column - 1;
577577
++m_cursor;
578578
}

0 commit comments

Comments
 (0)