extracted line couting
This commit is contained in:
parent
7f24975092
commit
60eaba951a
2 changed files with 17 additions and 6 deletions
|
|
@ -7,6 +7,8 @@ enum class IndentAction
|
|||
None
|
||||
};
|
||||
|
||||
constexpr int TAB_WIDTH = 8;
|
||||
|
||||
class IndentHelper
|
||||
{
|
||||
std::stack<int> indent_stack;
|
||||
|
|
@ -56,4 +58,14 @@ public:
|
|||
pending_dedents--;
|
||||
return true;
|
||||
}
|
||||
|
||||
static int calculateColumn(const char *text, int length)
|
||||
{
|
||||
int spaces = 0;
|
||||
for (int i = 0; i < length; i++)
|
||||
{
|
||||
spaces += (text[i] == '\t') ? TAB_WIDTH : 1;
|
||||
}
|
||||
return spaces;
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue