throw an error when gf does not find any file to open
This commit is contained in:
parent
258637222f
commit
eab1213555
|
@ -139,7 +139,7 @@ void goto_commands(Context& context)
|
||||||
case 'f':
|
case 'f':
|
||||||
{
|
{
|
||||||
String filename = context.editor().main_selection().content();
|
String filename = context.editor().main_selection().content();
|
||||||
static char forbidden[] = { '\'', '\\', '\0' };
|
static constexpr char forbidden[] = { '\'', '\\', '\0' };
|
||||||
for (auto c : forbidden)
|
for (auto c : forbidden)
|
||||||
if (contains(filename, c))
|
if (contains(filename, c))
|
||||||
return;
|
return;
|
||||||
|
@ -151,8 +151,9 @@ void goto_commands(Context& context)
|
||||||
paths.insert(paths.begin(), String{buffer_name.begin(), it.base()});
|
paths.insert(paths.begin(), String{buffer_name.begin(), it.base()});
|
||||||
|
|
||||||
String path = find_file(filename, paths);
|
String path = find_file(filename, paths);
|
||||||
if (not path.empty())
|
if (path.empty())
|
||||||
CommandManager::instance().execute("edit '" + path + "'", context);
|
throw runtime_error("unable to find file '" + filename + "'");
|
||||||
|
CommandManager::instance().execute("edit '" + path + "'", context);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user