summaryrefslogtreecommitdiff
path: root/src/normal.cc
diff options
context:
space:
mode:
authorMaxime Coste <frrrwww@gmail.com>2014-05-05 13:09:59 +0100
committerMaxime Coste <frrrwww@gmail.com>2014-05-05 13:09:59 +0100
commite6bda60ca4dfbf8e3a3ca6d451f057db9d7ae16e (patch)
treedd4d6fd53fa6bc8f1102909f81853d437535a761 /src/normal.cc
parentdfb12466974d846717ef2e15b6b9839076d11443 (diff)
Use c++ code for 'gf' command rather than running a user :edit command
Diffstat (limited to 'src/normal.cc')
-rw-r--r--src/normal.cc12
1 files changed, 11 insertions, 1 deletions
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 '.':