From e6bda60ca4dfbf8e3a3ca6d451f057db9d7ae16e Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Mon, 5 May 2014 13:09:59 +0100 Subject: [PATCH] Use c++ code for 'gf' command rather than running a user :edit command --- src/normal.cc | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/normal.cc b/src/normal.cc index 3750f4cb..c8a46cef 100644 --- a/src/normal.cc +++ b/src/normal.cc @@ -312,7 +312,17 @@ void goto_commands(Context& context, int line) String path = find_file(filename, paths); if (path.empty()) 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; } case '.':