mirror of
https://github.com/mawww/kakoune.git
synced 2024-12-19 01:11:36 +03:00
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 {};
|
||||
}
|
||||
|
||||
DisplayCoord coord() const
|
||||
BufferCoord coord() const
|
||||
{
|
||||
return {line, utf8::column_distance(line_start, pos)};
|
||||
return {line, (int)(pos - line_start)};
|
||||
}
|
||||
|
||||
StringView str;
|
||||
@ -432,7 +432,7 @@ CommandManager::find_command(const Context& context, StringView name) const
|
||||
void CommandManager::execute_single_command(CommandParameters params,
|
||||
Context& context,
|
||||
const ShellContext& shell_context,
|
||||
DisplayCoord pos)
|
||||
BufferCoord pos)
|
||||
{
|
||||
if (params.empty())
|
||||
return;
|
||||
@ -481,7 +481,7 @@ void CommandManager::execute(StringView command_line,
|
||||
// Tokens are going to be read as a stack
|
||||
std::reverse(tokens.begin(), tokens.end());
|
||||
|
||||
DisplayCoord command_coord;
|
||||
BufferCoord command_coord;
|
||||
Vector<String> params;
|
||||
while (not tokens.empty())
|
||||
{
|
||||
|
@ -57,7 +57,7 @@ struct Token
|
||||
Type type;
|
||||
ByteCount begin;
|
||||
ByteCount end;
|
||||
DisplayCoord coord;
|
||||
BufferCoord coord;
|
||||
String content;
|
||||
};
|
||||
|
||||
@ -99,7 +99,7 @@ private:
|
||||
void execute_single_command(CommandParameters params,
|
||||
Context& context,
|
||||
const ShellContext& shell_context,
|
||||
DisplayCoord pos);
|
||||
BufferCoord pos);
|
||||
|
||||
struct Command
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user