patch 8.1.1850: focus may remain in popup window

Problem:    Focus may remain in popup window.
Solution:   Change focus if needed.
diff --git a/src/popupmnu.c b/src/popupmnu.c
index 9569ffd..2da720a 100644
--- a/src/popupmnu.c
+++ b/src/popupmnu.c
@@ -814,7 +814,7 @@
 			 * update the view on the buffer.  Only go back to
 			 * the window when needed, otherwise it will always be
 			 * redraw. */
-			if (resized)
+			if (resized && win_valid(curwin_save))
 			{
 			    ++no_u_sync;
 			    win_enter(curwin_save, TRUE);
@@ -844,6 +844,11 @@
 		    }
 		}
 	    }
+# ifdef FEAT_TEXT_PROP
+	    if (WIN_IS_POPUP(curwin))
+		// can't keep focus in a popup window
+		win_enter(firstwin, TRUE);
+# endif
 	}
 #endif
     }
diff --git a/src/version.c b/src/version.c
index 4a993da..64a43be 100644
--- a/src/version.c
+++ b/src/version.c
@@ -770,6 +770,8 @@
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1850,
+/**/
     1849,
 /**/
     1848,