diff options
Diffstat (limited to 'src/libutil')
-rw-r--r-- | src/libutil/args.cc | 8 | ||||
-rw-r--r-- | src/libutil/args.hh | 3 |
2 files changed, 6 insertions, 5 deletions
diff --git a/src/libutil/args.cc b/src/libutil/args.cc index 35ec3e4ab..b7baad375 100644 --- a/src/libutil/args.cc +++ b/src/libutil/args.cc @@ -178,16 +178,16 @@ Strings argvToStrings(int argc, char * * argv) return args; } -Strings editorFor(std::string filename, int lineno) +Strings editorFor(Pos pos) { auto editor = getEnv("EDITOR", "cat"); auto args = tokenizeString<Strings>(editor); - if (lineno > 0 && ( + if (pos.line > 0 && ( editor.find("emacs") != std::string::npos || editor.find("nano") != std::string::npos || editor.find("vim") != std::string::npos)) - args.push_back(fmt("+%d", lineno)); - args.push_back(filename); + args.push_back(fmt("+%d", pos.line)); + args.push_back(pos.file); return args; } diff --git a/src/libutil/args.hh b/src/libutil/args.hh index 22702c2d8..1e29bd4fa 100644 --- a/src/libutil/args.hh +++ b/src/libutil/args.hh @@ -5,6 +5,7 @@ #include <memory> #include "util.hh" +#include "nixexpr.hh" namespace nix { @@ -191,7 +192,7 @@ public: Strings argvToStrings(int argc, char * * argv); /* Helper function to generate args that invoke $EDITOR on filename:lineno */ -Strings editorFor(std::string filename, int lineno); +Strings editorFor(Pos pos); /* Helper function for rendering argument labels. */ std::string renderLabels(const Strings & labels); |