diff options
author | Yorick van Pelt <yorick@yorickvanpelt.nl> | 2023-03-02 17:24:58 +0100 |
---|---|---|
committer | Yorick van Pelt <yorick@yorickvanpelt.nl> | 2023-03-02 17:24:58 +0100 |
commit | 5bb6e3bfafbcd101962b39ce579ee56d670cd83a (patch) | |
tree | 35c22a31cd26c3a63042cb44b5a0fb00dad10b91 | |
parent | 306e5c5ce5a38fecb90b2d2a3c6159fd2ad9c5cc (diff) |
NixRepl::mainLoop: restore old curRepl on function exit
This fixes completion callbacks after entering and leaving a nested
debugger.
-rw-r--r-- | src/libcmd/repl.cc | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/src/libcmd/repl.cc b/src/libcmd/repl.cc index e3afb1531..29c838ec0 100644 --- a/src/libcmd/repl.cc +++ b/src/libcmd/repl.cc @@ -252,7 +252,9 @@ void NixRepl::mainLoop() el_hist_size = 1000; #endif read_history(historyFile.c_str()); + auto oldRepl = curRepl; curRepl = this; + Finally restoreRepl([&] { curRepl = oldRepl; }); #ifndef READLINE rl_set_complete_func(completionCallback); rl_set_list_possib_func(listPossibleCallback); |