diff --git a/src/wbc-gtk-edit.c b/src/wbc-gtk-edit.c
index 4caeb20..157d8ec 100644
--- a/src/wbc-gtk-edit.c
+++ b/src/wbc-gtk-edit.c
@@ -37,6 +37,7 @@
 #include "sheet-style.h"
 #include "sheet-view.h"
 #include "sheet.h"
+#include "selection.h"
 #include "cell.h"
 #include "expr.h"
 #include "gnm-format.h"
@@ -219,8 +220,19 @@ wbcg_edit_finish (WBCGtk *wbcg, WBCEditResult result,
 			PangoAttrList *res_markup = wbcg->edit_line.markup
 				? pango_attr_list_copy (wbcg->edit_line.markup)
 				: NULL;
+			GSList *l = selection_get_ranges  (sv, TRUE), *ptr;
+			GnmCellPos saved_pos = sv->edit_pos_real;
 			cmd_set_text (wbc, sheet, &sv->edit_pos, txt, res_markup);
 			if (res_markup) pango_attr_list_unref (res_markup);
+			/* reset selection range */
+			sv_selection_reset (sv);
+			for (ptr = l; ptr; ptr = ptr->next) {
+				sv_selection_add_range (sv, ptr->data);
+				g_free (ptr->data);
+			}
+			g_slist_free (l);
+			// set back the initial edit position
+			sv->edit_pos_real = saved_pos;
 		} else
 			cmd_area_set_text (wbc, sv, txt,
 				result == WBC_EDIT_ACCEPT_ARRAY);
