CommandManager: Use byte rather than columns for token positions
Not only are display columns rarely used to give error positions, but they make the parsing much slower as for each token we need to compute the column in the line.
This commit is contained in:
parent
39c0c03351
commit
b7a3d80bde
|
@ -85,9 +85,9 @@ public:
|
||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
DisplayCoord coord() const
|
BufferCoord coord() const
|
||||||
{
|
{
|
||||||
return {line, utf8::column_distance(line_start, pos)};
|
return {line, (int)(pos - line_start)};
|
||||||
}
|
}
|
||||||
|
|
||||||
StringView str;
|
StringView str;
|
||||||
|
@ -432,7 +432,7 @@ CommandManager::find_command(const Context& context, StringView name) const
|
||||||
void CommandManager::execute_single_command(CommandParameters params,
|
void CommandManager::execute_single_command(CommandParameters params,
|
||||||
Context& context,
|
Context& context,
|
||||||
const ShellContext& shell_context,
|
const ShellContext& shell_context,
|
||||||
DisplayCoord pos)
|
BufferCoord pos)
|
||||||
{
|
{
|
||||||
if (params.empty())
|
if (params.empty())
|
||||||
return;
|
return;
|
||||||
|
@ -481,7 +481,7 @@ void CommandManager::execute(StringView command_line,
|
||||||
// Tokens are going to be read as a stack
|
// Tokens are going to be read as a stack
|
||||||
std::reverse(tokens.begin(), tokens.end());
|
std::reverse(tokens.begin(), tokens.end());
|
||||||
|
|
||||||
DisplayCoord command_coord;
|
BufferCoord command_coord;
|
||||||
Vector<String> params;
|
Vector<String> params;
|
||||||
while (not tokens.empty())
|
while (not tokens.empty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,7 +57,7 @@ struct Token
|
||||||
Type type;
|
Type type;
|
||||||
ByteCount begin;
|
ByteCount begin;
|
||||||
ByteCount end;
|
ByteCount end;
|
||||||
DisplayCoord coord;
|
BufferCoord coord;
|
||||||
String content;
|
String content;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -99,7 +99,7 @@ private:
|
||||||
void execute_single_command(CommandParameters params,
|
void execute_single_command(CommandParameters params,
|
||||||
Context& context,
|
Context& context,
|
||||||
const ShellContext& shell_context,
|
const ShellContext& shell_context,
|
||||||
DisplayCoord pos);
|
BufferCoord pos);
|
||||||
|
|
||||||
struct Command
|
struct Command
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user