Use c++ code for 'gf' command rather than running a user :edit command

This commit is contained in:
Maxime Coste 2014-05-05 13:09:59 +01:00
parent dfb1246697
commit e6bda60ca4

View File

@ -312,7 +312,17 @@ void goto_commands(Context& context, int line)
String path = find_file(filename, paths); String path = find_file(filename, paths);
if (path.empty()) if (path.empty())
throw runtime_error("unable to find file '" + filename + "'"); throw runtime_error("unable to find file '" + filename + "'");
CommandManager::instance().execute("edit '" + path + "'", context);
Buffer* buffer = create_buffer_from_file(path);
if (buffer == nullptr)
throw runtime_error("unable to open file '" + path + "'");
if (buffer != &context.buffer())
{
BufferManager::instance().set_last_used_buffer(*buffer);
context.push_jump();
context.change_buffer(*buffer);
}
break; break;
} }
case '.': case '.':