From 5cbf0663762422d1db1cc6a41e5261245b8cfea2 2013-07-16 21:51:06 From: MinRK Date: 2013-07-16 21:51:06 Subject: [PATCH] refocus active cell on dialog close if there is one Otherwise, the cursor is lost on kernel restart, etc. --- diff --git a/IPython/html/static/base/js/dialog.js b/IPython/html/static/base/js/dialog.js index 92d2e3c..4154b28 100644 --- a/IPython/html/static/base/js/dialog.js +++ b/IPython/html/static/base/js/dialog.js @@ -64,6 +64,14 @@ IPython.dialog = (function (IPython) { dialog.remove(); }); } + if (options.reselect_cell !== false) { + dialog.on("hidden", function () { + if (IPython.notebook) { + cell = IPython.notebook.get_selected_cell(); + if (cell) cell.select(); + } + }); + } return dialog.modal(options); }