aboutsummaryrefslogtreecommitdiff
path: root/src/nix/edit.cc
diff options
context:
space:
mode:
authorpennae <github@quasiparticle.net>2022-03-04 20:54:50 +0100
committerpennae <github@quasiparticle.net>2022-04-21 21:25:18 +0200
commit39df15fb8e766c0a4fa2fda83784fb8a478a766c (patch)
tree8f60f47059cf33b6b9c62b92bbbd6783868b1d47 /src/nix/edit.cc
parent38de79fcf7e00187107e638036c010911d1b675b (diff)
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.
Diffstat (limited to 'src/nix/edit.cc')
-rw-r--r--src/nix/edit.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/nix/edit.cc b/src/nix/edit.cc
index fc48db0d7..ffe79af89 100644
--- a/src/nix/edit.cc
+++ b/src/nix/edit.cc
@@ -30,17 +30,17 @@ struct CmdEdit : InstallableCommand
auto [v, pos] = installable->toValue(*state);
- try {
- pos = findPackageFilename(*state, *v, installable->what());
- } catch (NoPositionInfo &) {
- }
-
- if (pos == noPos)
- throw Error("cannot find position information for '%s", installable->what());
+ const auto [file, line] = [&] {
+ try {
+ return findPackageFilename(*state, *v, installable->what());
+ } catch (NoPositionInfo &) {
+ throw Error("cannot find position information for '%s", installable->what());
+ }
+ }();
stopProgressBar();
- auto args = editorFor(pos);
+ auto args = editorFor(file, line);
restoreProcessContext();