+/* The set_func hook of "set tui ..." commands that affect the window
+ borders on the TUI display. */
+void
+tui_set_var_cmd (const char *null_args,
+ int from_tty, struct cmd_list_element *c)
+{
+ if (tui_update_variables () && tui_active)
+ tui_rehighlight_all ();
+}
+
+/* Generic window name completion function. Complete window name pointed
+ to by TEXT and WORD. If INCLUDE_NEXT_PREV_P is true then the special
+ window names 'next' and 'prev' will also be considered as possible
+ completions of the window name. */
+
+static void
+window_name_completer (completion_tracker &tracker,
+ int include_next_prev_p,
+ const char *text, const char *word)
+{
+ VEC (const_char_ptr) *completion_name_vec = NULL;
+ int win_type;
+
+ for (win_type = SRC_WIN; win_type < MAX_MAJOR_WINDOWS; win_type++)
+ {
+ const char *completion_name = NULL;
+
+ /* We can't focus on an invisible window. */
+ if (tui_win_list[win_type] == NULL
+ || !tui_win_list[win_type]->generic.is_visible)
+ continue;
+
+ completion_name = tui_win_name (&tui_win_list [win_type]->generic);
+ gdb_assert (completion_name != NULL);
+ VEC_safe_push (const_char_ptr, completion_name_vec, completion_name);
+ }
+
+ /* If no windows are considered visible then the TUI has not yet been
+ initialized. But still "focus src" and "focus cmd" will work because
+ invoking the focus command will entail initializing the TUI which sets the
+ default layout to SRC_COMMAND. */
+ if (VEC_length (const_char_ptr, completion_name_vec) == 0)
+ {
+ VEC_safe_push (const_char_ptr, completion_name_vec, SRC_NAME);
+ VEC_safe_push (const_char_ptr, completion_name_vec, CMD_NAME);
+ }
+
+ if (include_next_prev_p)
+ {
+ VEC_safe_push (const_char_ptr, completion_name_vec, "next");
+ VEC_safe_push (const_char_ptr, completion_name_vec, "prev");
+ }
+
+ VEC_safe_push (const_char_ptr, completion_name_vec, NULL);
+ complete_on_enum (tracker,
+ VEC_address (const_char_ptr, completion_name_vec),
+ text, word);
+
+ VEC_free (const_char_ptr, completion_name_vec);
+}
+
+/* Complete possible window names to focus on. TEXT is the complete text
+ entered so far, WORD is the word currently being completed. */
+
+static void
+focus_completer (struct cmd_list_element *ignore,
+ completion_tracker &tracker,
+ const char *text, const char *word)
+{
+ window_name_completer (tracker, 1, text, word);
+}
+
+/* Complete possible window names for winheight command. TEXT is the
+ complete text entered so far, WORD is the word currently being
+ completed. */
+
+static void
+winheight_completer (struct cmd_list_element *ignore,
+ completion_tracker &tracker,
+ const char *text, const char *word)
+{
+ /* The first word is the window name. That we can complete. Subsequent
+ words can't be completed. */
+ if (word != text)
+ return;
+
+ window_name_completer (tracker, 0, text, word);
+}
+