diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2014-05-05 13:09:59 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2014-05-05 13:09:59 +0100 |
| commit | e6bda60ca4dfbf8e3a3ca6d451f057db9d7ae16e (patch) | |
| tree | dd4d6fd53fa6bc8f1102909f81853d437535a761 /src | |
| parent | dfb12466974d846717ef2e15b6b9839076d11443 (diff) | |
Use c++ code for 'gf' command rather than running a user :edit command
Diffstat (limited to 'src')
| -rw-r--r-- | src/normal.cc | 12 |
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 '.': |
