mirror of
https://github.com/NixOS/nix
synced 2025-06-27 08:31:16 +02:00
don't use full Pos for findPackageFilename/editorFor
only file and line of the returned position were ever used, it wasn't actually used a position. as such we may as well use a path+int pair for only those two values and remove a use of Pos that would not work well with a position table.
This commit is contained in:
parent
38de79fcf7
commit
39df15fb8e
6 changed files with 29 additions and 31 deletions
|
@ -197,17 +197,17 @@ void StorePathCommand::run(ref<Store> store, std::vector<StorePath> && storePath
|
|||
run(store, *storePaths.begin());
|
||||
}
|
||||
|
||||
Strings editorFor(const Pos & pos)
|
||||
Strings editorFor(const Path & file, uint32_t line)
|
||||
{
|
||||
auto editor = getEnv("EDITOR").value_or("cat");
|
||||
auto args = tokenizeString<Strings>(editor);
|
||||
if (pos.line > 0 && (
|
||||
if (line > 0 && (
|
||||
editor.find("emacs") != std::string::npos ||
|
||||
editor.find("nano") != std::string::npos ||
|
||||
editor.find("vim") != std::string::npos ||
|
||||
editor.find("kak") != std::string::npos))
|
||||
args.push_back(fmt("+%d", pos.line));
|
||||
args.push_back(pos.file);
|
||||
args.push_back(fmt("+%d", line));
|
||||
args.push_back(file);
|
||||
return args;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue