From 1a6d7a3af466dad946e6fc0e969927a8f246c13a Mon Sep 17 00:00:00 2001 From: Goldstein Date: Mon, 15 Jul 2024 23:28:55 +0300 Subject: src/libcmd/repl.cc: avoid unneeded reload after :e If `:edit`ing a store path, don't reload repl afterwards to avoid losing local variables: store is immutable, so "editing" a store path is always just viewing it. Resolves: https://git.lix.systems/lix-project/lix/issues/341 Change-Id: I3747f75ce26e0595e953069c39ddc3ee80699718 --- src/libcmd/repl.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/libcmd/repl.cc') diff --git a/src/libcmd/repl.cc b/src/libcmd/repl.cc index 635b54958..5086e9999 100644 --- a/src/libcmd/repl.cc +++ b/src/libcmd/repl.cc @@ -652,9 +652,12 @@ ProcessLineResult NixRepl::processLine(std::string line) // using runProgram2 to allow editors to display their UI runProgram2(RunOptions { .program = editor, .searchPath = true, .args = args }).wait(); - // Reload right after exiting the editor - state->resetFileCache(); - reloadFiles(); + // Reload right after exiting the editor if path is not in store + // Store is immutable, so there could be no changes, so there's no need to reload + if (!state->store->isInStore(path.resolveSymlinks().path.abs())) { + state->resetFileCache(); + reloadFiles(); + } } else if (command == ":t") { -- cgit v1.2.3