From 79d9f0f039da407928b58d55961071f90752a55c Mon Sep 17 00:00:00 2001 From: MinRK Date: Tue, 16 Jul 2013 14:51:06 -0700 Subject: [PATCH] refocus active cell on dialog close if there is one Otherwise, the cursor is lost on kernel restart, etc. --- IPython/html/static/base/js/dialog.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/IPython/html/static/base/js/dialog.js b/IPython/html/static/base/js/dialog.js index 92d2e3cc1..4154b2837 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); }