I wrote a TUI window in Python, and I noticed that setting its title
did not result in a refresh, so the new title did not appear.  This
patch corrects this problem.
   if (value == nullptr)
     return -1;
 
-  win->window->title = value.get ();
+  win->window->set_title (value.get ());
   return 0;
 }
 
 
 Term::check_contents "title is unchanged" \
     "This Is The Title"
 
+Term::command "python change_window_title ()"
+Term::check_contents "test new title" \
+    "New Title"
+
 Term::resize 51 51
 # Remember that a resize request actually does two resizes...
 Term::check_contents "Window was updated" "Test: 2"
 
     raise RuntimeError("Whoops")
 
 
+# Change the title of the window.
+def change_window_title():
+    the_window.win.title = "New Title"
+
+
 gdb.register_window_type("fail", failwin)
 
   return *iter;
 }
 
+/* See tui-data.h.  */
+
+void
+tui_win_info::set_title (const char *new_title)
+{
+  if (title != new_title)
+    {
+      title = new_title;
+      check_and_display_highlight_if_needed ();
+    }
+}
 
 void
 tui_win_info::rerender ()
 
 
   void check_and_display_highlight_if_needed ();
 
+  /* A helper function to change the title and then redraw the
+     surrounding box, if needed.  */
+  void set_title (const char *new_title);
+
   /* Window handle.  */
   std::unique_ptr<WINDOW, curses_deleter> handle;
   /* Window width.  */