1 /* TUI window generic functions.
3 Copyright (C) 1998-2015 Free Software Foundation, Inc.
5 Contributed by Hewlett-Packard Company.
7 This file is part of GDB.
9 This program is free software; you can redistribute it and/or modify
10 it under the terms of the GNU General Public License as published by
11 the Free Software Foundation; either version 3 of the License, or
12 (at your option) any later version.
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
19 You should have received a copy of the GNU General Public License
20 along with this program. If not, see <http://www.gnu.org/licenses/>. */
22 /* This module contains procedures for handling tui window functions
23 like resize, scrolling, scrolling, changing focus, etc.
25 Author: Susan B. Macchia */
30 #include "breakpoint.h"
32 #include "cli/cli-cmds.h"
37 #include "tui/tui-data.h"
38 #include "tui/tui-wingeneral.h"
39 #include "tui/tui-stack.h"
40 #include "tui/tui-regs.h"
41 #include "tui/tui-disasm.h"
42 #include "tui/tui-source.h"
43 #include "tui/tui-winsource.h"
44 #include "tui/tui-windata.h"
45 #include "tui/tui-win.h"
47 #include "gdb_curses.h"
49 #include "readline/readline.h"
53 /*******************************
55 ********************************/
56 static void make_visible_with_new_height (struct tui_win_info
*);
57 static void make_invisible_and_set_new_height (struct tui_win_info
*,
59 static enum tui_status
tui_adjust_win_heights (struct tui_win_info
*,
61 static int new_height_ok (struct tui_win_info
*, int);
62 static void tui_set_tab_width_command (char *, int);
63 static void tui_refresh_all_command (char *, int);
64 static void tui_set_win_height_command (char *, int);
65 static void tui_xdb_set_win_height_command (char *, int);
66 static void tui_all_windows_info (char *, int);
67 static void tui_set_focus_command (char *, int);
68 static void tui_scroll_forward_command (char *, int);
69 static void tui_scroll_backward_command (char *, int);
70 static void tui_scroll_left_command (char *, int);
71 static void tui_scroll_right_command (char *, int);
72 static void parse_scrolling_args (char *,
73 struct tui_win_info
**,
77 /***************************************
79 ***************************************/
80 #define WIN_HEIGHT_USAGE "Usage: winheight <win_name> [+ | -] <#lines>\n"
81 #define XDBWIN_HEIGHT_USAGE "Usage: w <#lines>\n"
82 #define FOCUS_USAGE "Usage: focus {<win> | next | prev}\n"
84 /***************************************
86 ***************************************/
89 # define ACS_LRCORNER '+'
92 # define ACS_LLCORNER '+'
95 # define ACS_ULCORNER '+'
98 # define ACS_URCORNER '+'
101 # define ACS_HLINE '-'
104 # define ACS_VLINE '|'
107 /* Possible values for tui-border-kind variable. */
108 static const char *const tui_border_kind_enums
[] = {
115 /* Possible values for tui-border-mode and tui-active-border-mode. */
116 static const char *const tui_border_mode_enums
[] = {
133 /* Translation table for border-mode variables.
134 The list of values must be terminated by a NULL.
135 After the NULL value, an entry defines the default. */
136 struct tui_translate tui_border_mode_translate
[] = {
137 { "normal", A_NORMAL
},
138 { "standout", A_STANDOUT
},
139 { "reverse", A_REVERSE
},
141 { "half-standout", A_DIM
| A_STANDOUT
},
143 { "bold-standout", A_BOLD
| A_STANDOUT
},
145 { "normal", A_NORMAL
}
148 /* Translation tables for border-kind, one for each border
149 character (see wborder, border curses operations).
150 -1 is used to indicate the ACS because ACS characters
151 are determined at run time by curses (depends on terminal). */
152 struct tui_translate tui_border_kind_translate_vline
[] = {
160 struct tui_translate tui_border_kind_translate_hline
[] = {
168 struct tui_translate tui_border_kind_translate_ulcorner
[] = {
176 struct tui_translate tui_border_kind_translate_urcorner
[] = {
184 struct tui_translate tui_border_kind_translate_llcorner
[] = {
192 struct tui_translate tui_border_kind_translate_lrcorner
[] = {
201 /* Tui configuration variables controlled with set/show command. */
202 const char *tui_active_border_mode
= "bold-standout";
204 show_tui_active_border_mode (struct ui_file
*file
,
206 struct cmd_list_element
*c
,
209 fprintf_filtered (file
, _("\
210 The attribute mode to use for the active TUI window border is \"%s\".\n"),
214 const char *tui_border_mode
= "normal";
216 show_tui_border_mode (struct ui_file
*file
,
218 struct cmd_list_element
*c
,
221 fprintf_filtered (file
, _("\
222 The attribute mode to use for the TUI window borders is \"%s\".\n"),
226 const char *tui_border_kind
= "acs";
228 show_tui_border_kind (struct ui_file
*file
,
230 struct cmd_list_element
*c
,
233 fprintf_filtered (file
, _("The kind of border for TUI windows is \"%s\".\n"),
238 /* Tui internal configuration variables. These variables are updated
239 by tui_update_variables to reflect the tui configuration
241 chtype tui_border_vline
;
242 chtype tui_border_hline
;
243 chtype tui_border_ulcorner
;
244 chtype tui_border_urcorner
;
245 chtype tui_border_llcorner
;
246 chtype tui_border_lrcorner
;
248 int tui_border_attrs
;
249 int tui_active_border_attrs
;
251 /* Identify the item in the translation table.
252 When the item is not recognized, use the default entry. */
253 static struct tui_translate
*
254 translate (const char *name
, struct tui_translate
*table
)
258 if (name
&& strcmp (table
->name
, name
) == 0)
263 /* Not found, return default entry. */
268 /* Update the tui internal configuration according to gdb settings.
269 Returns 1 if the configuration has changed and the screen should
272 tui_update_variables (void)
275 struct tui_translate
*entry
;
277 entry
= translate (tui_border_mode
, tui_border_mode_translate
);
278 if (tui_border_attrs
!= entry
->value
)
280 tui_border_attrs
= entry
->value
;
283 entry
= translate (tui_active_border_mode
, tui_border_mode_translate
);
284 if (tui_active_border_attrs
!= entry
->value
)
286 tui_active_border_attrs
= entry
->value
;
290 /* If one corner changes, all characters are changed.
291 Only check the first one. The ACS characters are determined at
292 run time by curses terminal management. */
293 entry
= translate (tui_border_kind
, tui_border_kind_translate_lrcorner
);
294 if (tui_border_lrcorner
!= (chtype
) entry
->value
)
296 tui_border_lrcorner
= (entry
->value
< 0) ? ACS_LRCORNER
: entry
->value
;
299 entry
= translate (tui_border_kind
, tui_border_kind_translate_llcorner
);
300 tui_border_llcorner
= (entry
->value
< 0) ? ACS_LLCORNER
: entry
->value
;
302 entry
= translate (tui_border_kind
, tui_border_kind_translate_ulcorner
);
303 tui_border_ulcorner
= (entry
->value
< 0) ? ACS_ULCORNER
: entry
->value
;
305 entry
= translate (tui_border_kind
, tui_border_kind_translate_urcorner
);
306 tui_border_urcorner
= (entry
->value
< 0) ? ACS_URCORNER
: entry
->value
;
308 entry
= translate (tui_border_kind
, tui_border_kind_translate_hline
);
309 tui_border_hline
= (entry
->value
< 0) ? ACS_HLINE
: entry
->value
;
311 entry
= translate (tui_border_kind
, tui_border_kind_translate_vline
);
312 tui_border_vline
= (entry
->value
< 0) ? ACS_VLINE
: entry
->value
;
318 set_tui_cmd (char *args
, int from_tty
)
323 show_tui_cmd (char *args
, int from_tty
)
327 static struct cmd_list_element
*tuilist
;
330 tui_command (char *args
, int from_tty
)
332 printf_unfiltered (_("\"tui\" must be followed by the name of a "
334 help_list (tuilist
, "tui ", all_commands
, gdb_stdout
);
337 struct cmd_list_element
**
338 tui_get_cmd_list (void)
341 add_prefix_cmd ("tui", class_tui
, tui_command
,
342 _("Text User Interface commands."),
343 &tuilist
, "tui ", 0, &cmdlist
);
347 /* Function to initialize gdb commands, for tui window
350 /* Provide a prototype to silence -Wmissing-prototypes. */
351 extern initialize_file_ftype _initialize_tui_win
;
354 _initialize_tui_win (void)
356 static struct cmd_list_element
*tui_setlist
;
357 static struct cmd_list_element
*tui_showlist
;
359 /* Define the classes of commands.
360 They will appear in the help list in the reverse of this order. */
361 add_prefix_cmd ("tui", class_tui
, set_tui_cmd
,
362 _("TUI configuration variables"),
363 &tui_setlist
, "set tui ",
364 0 /* allow-unknown */, &setlist
);
365 add_prefix_cmd ("tui", class_tui
, show_tui_cmd
,
366 _("TUI configuration variables"),
367 &tui_showlist
, "show tui ",
368 0 /* allow-unknown */, &showlist
);
370 add_com ("refresh", class_tui
, tui_refresh_all_command
,
371 _("Refresh the terminal display.\n"));
373 add_com_alias ("U", "refresh", class_tui
, 0);
374 add_com ("tabset", class_tui
, tui_set_tab_width_command
, _("\
375 Set the width (in characters) of tab stops.\n\
376 Usage: tabset <n>\n"));
377 add_com ("winheight", class_tui
, tui_set_win_height_command
, _("\
378 Set the height of a specified window.\n\
379 Usage: winheight <win_name> [+ | -] <#lines>\n\
381 src : the source window\n\
382 cmd : the command window\n\
383 asm : the disassembly window\n\
384 regs : the register display\n"));
385 add_com_alias ("wh", "winheight", class_tui
, 0);
386 add_info ("win", tui_all_windows_info
,
387 _("List of all displayed windows.\n"));
388 add_com ("focus", class_tui
, tui_set_focus_command
, _("\
389 Set focus to named window or next/prev window.\n\
390 Usage: focus {<win> | next | prev}\n\
391 Valid Window names are:\n\
392 src : the source window\n\
393 asm : the disassembly window\n\
394 regs : the register display\n\
395 cmd : the command window\n"));
396 add_com_alias ("fs", "focus", class_tui
, 0);
397 add_com ("+", class_tui
, tui_scroll_forward_command
, _("\
398 Scroll window forward.\n\
399 Usage: + [win] [n]\n"));
400 add_com ("-", class_tui
, tui_scroll_backward_command
, _("\
401 Scroll window backward.\n\
402 Usage: - [win] [n]\n"));
403 add_com ("<", class_tui
, tui_scroll_left_command
, _("\
404 Scroll window forward.\n\
405 Usage: < [win] [n]\n"));
406 add_com (">", class_tui
, tui_scroll_right_command
, _("\
407 Scroll window backward.\n\
408 Usage: > [win] [n]\n"));
410 add_com ("w", class_xdb
, tui_xdb_set_win_height_command
, _("\
411 XDB compatibility command for setting the height of a command window.\n\
412 Usage: w <#lines>\n"));
414 /* Define the tui control variables. */
415 add_setshow_enum_cmd ("border-kind", no_class
, tui_border_kind_enums
,
416 &tui_border_kind
, _("\
417 Set the kind of border for TUI windows."), _("\
418 Show the kind of border for TUI windows."), _("\
419 This variable controls the border of TUI windows:\n\
420 space use a white space\n\
421 ascii use ascii characters + - | for the border\n\
422 acs use the Alternate Character Set"),
424 show_tui_border_kind
,
425 &tui_setlist
, &tui_showlist
);
427 add_setshow_enum_cmd ("border-mode", no_class
, tui_border_mode_enums
,
428 &tui_border_mode
, _("\
429 Set the attribute mode to use for the TUI window borders."), _("\
430 Show the attribute mode to use for the TUI window borders."), _("\
431 This variable controls the attributes to use for the window borders:\n\
432 normal normal display\n\
433 standout use highlight mode of terminal\n\
434 reverse use reverse video mode\n\
435 half use half bright\n\
436 half-standout use half bright and standout mode\n\
437 bold use extra bright or bold\n\
438 bold-standout use extra bright or bold with standout mode"),
440 show_tui_border_mode
,
441 &tui_setlist
, &tui_showlist
);
443 add_setshow_enum_cmd ("active-border-mode", no_class
, tui_border_mode_enums
,
444 &tui_active_border_mode
, _("\
445 Set the attribute mode to use for the active TUI window border."), _("\
446 Show the attribute mode to use for the active TUI window border."), _("\
447 This variable controls the attributes to use for the active window border:\n\
448 normal normal display\n\
449 standout use highlight mode of terminal\n\
450 reverse use reverse video mode\n\
451 half use half bright\n\
452 half-standout use half bright and standout mode\n\
453 bold use extra bright or bold\n\
454 bold-standout use extra bright or bold with standout mode"),
456 show_tui_active_border_mode
,
457 &tui_setlist
, &tui_showlist
);
460 /* Update gdb's knowledge of the terminal size. */
462 tui_update_gdb_sizes (void)
466 /* Set to TUI command window dimension or use readline values. */
467 xsnprintf (cmd
, sizeof (cmd
), "set width %d",
468 tui_active
? TUI_CMD_WIN
->generic
.width
: tui_term_width());
469 execute_command (cmd
, 0);
470 xsnprintf (cmd
, sizeof (cmd
), "set height %d",
471 tui_active
? TUI_CMD_WIN
->generic
.height
: tui_term_height());
472 execute_command (cmd
, 0);
476 /* Set the logical focus to win_info. */
478 tui_set_win_focus_to (struct tui_win_info
*win_info
)
480 if (win_info
!= NULL
)
482 struct tui_win_info
*win_with_focus
= tui_win_with_focus ();
484 if (win_with_focus
!= NULL
485 && win_with_focus
->generic
.type
!= CMD_WIN
)
486 tui_unhighlight_win (win_with_focus
);
487 tui_set_win_with_focus (win_info
);
488 if (win_info
->generic
.type
!= CMD_WIN
)
489 tui_highlight_win (win_info
);
495 tui_scroll_forward (struct tui_win_info
*win_to_scroll
,
498 if (win_to_scroll
!= TUI_CMD_WIN
)
500 int _num_to_scroll
= num_to_scroll
;
502 if (num_to_scroll
== 0)
503 _num_to_scroll
= win_to_scroll
->generic
.height
- 3;
505 /* If we are scrolling the source or disassembly window, do a
506 "psuedo" scroll since not all of the source is in memory,
507 only what is in the viewport. If win_to_scroll is the
508 command window do nothing since the term should handle
510 if (win_to_scroll
== TUI_SRC_WIN
)
511 tui_vertical_source_scroll (FORWARD_SCROLL
, _num_to_scroll
);
512 else if (win_to_scroll
== TUI_DISASM_WIN
)
513 tui_vertical_disassem_scroll (FORWARD_SCROLL
, _num_to_scroll
);
514 else if (win_to_scroll
== TUI_DATA_WIN
)
515 tui_vertical_data_scroll (FORWARD_SCROLL
, _num_to_scroll
);
520 tui_scroll_backward (struct tui_win_info
*win_to_scroll
,
523 if (win_to_scroll
!= TUI_CMD_WIN
)
525 int _num_to_scroll
= num_to_scroll
;
527 if (num_to_scroll
== 0)
528 _num_to_scroll
= win_to_scroll
->generic
.height
- 3;
530 /* If we are scrolling the source or disassembly window, do a
531 "psuedo" scroll since not all of the source is in memory,
532 only what is in the viewport. If win_to_scroll is the
533 command window do nothing since the term should handle
535 if (win_to_scroll
== TUI_SRC_WIN
)
536 tui_vertical_source_scroll (BACKWARD_SCROLL
, _num_to_scroll
);
537 else if (win_to_scroll
== TUI_DISASM_WIN
)
538 tui_vertical_disassem_scroll (BACKWARD_SCROLL
, _num_to_scroll
);
539 else if (win_to_scroll
== TUI_DATA_WIN
)
540 tui_vertical_data_scroll (BACKWARD_SCROLL
, _num_to_scroll
);
546 tui_scroll_left (struct tui_win_info
*win_to_scroll
,
549 if (win_to_scroll
!= TUI_CMD_WIN
)
551 int _num_to_scroll
= num_to_scroll
;
553 if (_num_to_scroll
== 0)
556 /* If we are scrolling the source or disassembly window, do a
557 "psuedo" scroll since not all of the source is in memory,
558 only what is in the viewport. If win_to_scroll is the command
559 window do nothing since the term should handle it. */
560 if (win_to_scroll
== TUI_SRC_WIN
561 || win_to_scroll
== TUI_DISASM_WIN
)
562 tui_horizontal_source_scroll (win_to_scroll
, LEFT_SCROLL
,
569 tui_scroll_right (struct tui_win_info
*win_to_scroll
,
572 if (win_to_scroll
!= TUI_CMD_WIN
)
574 int _num_to_scroll
= num_to_scroll
;
576 if (_num_to_scroll
== 0)
579 /* If we are scrolling the source or disassembly window, do a
580 "psuedo" scroll since not all of the source is in memory,
581 only what is in the viewport. If win_to_scroll is the command
582 window do nothing since the term should handle it. */
583 if (win_to_scroll
== TUI_SRC_WIN
584 || win_to_scroll
== TUI_DISASM_WIN
)
585 tui_horizontal_source_scroll (win_to_scroll
, RIGHT_SCROLL
,
591 /* Scroll a window. Arguments are passed through a va_list. */
593 tui_scroll (enum tui_scroll_direction direction
,
594 struct tui_win_info
*win_to_scroll
,
600 tui_scroll_forward (win_to_scroll
, num_to_scroll
);
602 case BACKWARD_SCROLL
:
603 tui_scroll_backward (win_to_scroll
, num_to_scroll
);
606 tui_scroll_left (win_to_scroll
, num_to_scroll
);
609 tui_scroll_right (win_to_scroll
, num_to_scroll
);
618 tui_refresh_all_win (void)
620 enum tui_win_type type
;
622 clearok (curscr
, TRUE
);
623 tui_refresh_all (tui_win_list
);
624 for (type
= SRC_WIN
; type
< MAX_MAJOR_WINDOWS
; type
++)
626 if (tui_win_list
[type
]
627 && tui_win_list
[type
]->generic
.is_visible
)
633 tui_show_source_content (tui_win_list
[type
]);
634 tui_check_and_display_highlight_if_needed (tui_win_list
[type
]);
635 tui_erase_exec_info_content (tui_win_list
[type
]);
636 tui_update_exec_info (tui_win_list
[type
]);
639 tui_refresh_data_win ();
646 tui_show_locator_content ();
650 /* Resize all the windows based on the terminal size. This function
651 gets called from within the readline sinwinch handler. */
653 tui_resize_all (void)
655 int height_diff
, width_diff
;
656 int screenheight
, screenwidth
;
658 rl_get_screen_size (&screenheight
, &screenwidth
);
659 width_diff
= screenwidth
- tui_term_width ();
660 height_diff
= screenheight
- tui_term_height ();
661 if (height_diff
|| width_diff
)
663 enum tui_layout_type cur_layout
= tui_current_layout ();
664 struct tui_win_info
*win_with_focus
= tui_win_with_focus ();
665 struct tui_win_info
*first_win
;
666 struct tui_win_info
*second_win
;
667 struct tui_gen_win_info
*locator
= tui_locator_win_info_ptr ();
668 enum tui_win_type win_type
;
669 int new_height
, split_diff
, cmd_split_diff
, num_wins_displayed
= 2;
671 #ifdef HAVE_RESIZE_TERM
672 resize_term (screenheight
, screenwidth
);
674 /* Turn keypad off while we resize. */
675 if (win_with_focus
!= TUI_CMD_WIN
)
676 keypad (TUI_CMD_WIN
->generic
.handle
, FALSE
);
677 tui_update_gdb_sizes ();
678 tui_set_term_height_to (screenheight
);
679 tui_set_term_width_to (screenwidth
);
680 if (cur_layout
== SRC_DISASSEM_COMMAND
681 || cur_layout
== SRC_DATA_COMMAND
682 || cur_layout
== DISASSEM_DATA_COMMAND
)
683 num_wins_displayed
++;
684 split_diff
= height_diff
/ num_wins_displayed
;
685 cmd_split_diff
= split_diff
;
686 if (height_diff
% num_wins_displayed
)
693 /* Now adjust each window. */
694 /* erase + clearok are used instead of a straightforward clear as
695 AIX 5.3 does not define clear. */
697 clearok (curscr
, TRUE
);
702 case DISASSEM_COMMAND
:
703 first_win
= (struct tui_win_info
*) (tui_source_windows ())->list
[0];
704 first_win
->generic
.width
+= width_diff
;
705 locator
->width
+= width_diff
;
706 /* Check for invalid heights. */
707 if (height_diff
== 0)
708 new_height
= first_win
->generic
.height
;
709 else if ((first_win
->generic
.height
+ split_diff
) >=
710 (screenheight
- MIN_CMD_WIN_HEIGHT
- 1))
711 new_height
= screenheight
- MIN_CMD_WIN_HEIGHT
- 1;
712 else if ((first_win
->generic
.height
+ split_diff
) <= 0)
713 new_height
= MIN_WIN_HEIGHT
;
715 new_height
= first_win
->generic
.height
+ split_diff
;
717 locator
->origin
.y
= new_height
+ 1;
718 make_invisible_and_set_new_height (first_win
, new_height
);
719 TUI_CMD_WIN
->generic
.origin
.y
= locator
->origin
.y
+ 1;
720 TUI_CMD_WIN
->generic
.width
+= width_diff
;
721 new_height
= screenheight
- TUI_CMD_WIN
->generic
.origin
.y
;
722 make_invisible_and_set_new_height (TUI_CMD_WIN
, new_height
);
723 make_visible_with_new_height (first_win
);
724 make_visible_with_new_height (TUI_CMD_WIN
);
725 if (first_win
->generic
.content_size
<= 0)
726 tui_erase_source_content (first_win
, EMPTY_SOURCE_PROMPT
);
729 if (cur_layout
== SRC_DISASSEM_COMMAND
)
731 first_win
= TUI_SRC_WIN
;
732 first_win
->generic
.width
+= width_diff
;
733 second_win
= TUI_DISASM_WIN
;
734 second_win
->generic
.width
+= width_diff
;
738 first_win
= TUI_DATA_WIN
;
739 first_win
->generic
.width
+= width_diff
;
740 second_win
= (struct tui_win_info
*)
741 (tui_source_windows ())->list
[0];
742 second_win
->generic
.width
+= width_diff
;
744 /* Change the first window's height/width. */
745 /* Check for invalid heights. */
746 if (height_diff
== 0)
747 new_height
= first_win
->generic
.height
;
748 else if ((first_win
->generic
.height
+
749 second_win
->generic
.height
+ (split_diff
* 2)) >=
750 (screenheight
- MIN_CMD_WIN_HEIGHT
- 1))
751 new_height
= (screenheight
- MIN_CMD_WIN_HEIGHT
- 1) / 2;
752 else if ((first_win
->generic
.height
+ split_diff
) <= 0)
753 new_height
= MIN_WIN_HEIGHT
;
755 new_height
= first_win
->generic
.height
+ split_diff
;
756 make_invisible_and_set_new_height (first_win
, new_height
);
758 locator
->width
+= width_diff
;
760 /* Change the second window's height/width. */
761 /* Check for invalid heights. */
762 if (height_diff
== 0)
763 new_height
= second_win
->generic
.height
;
764 else if ((first_win
->generic
.height
+
765 second_win
->generic
.height
+ (split_diff
* 2)) >=
766 (screenheight
- MIN_CMD_WIN_HEIGHT
- 1))
768 new_height
= screenheight
- MIN_CMD_WIN_HEIGHT
- 1;
770 new_height
= (new_height
/ 2) + 1;
774 else if ((second_win
->generic
.height
+ split_diff
) <= 0)
775 new_height
= MIN_WIN_HEIGHT
;
777 new_height
= second_win
->generic
.height
+ split_diff
;
778 second_win
->generic
.origin
.y
= first_win
->generic
.height
- 1;
779 make_invisible_and_set_new_height (second_win
, new_height
);
781 /* Change the command window's height/width. */
782 TUI_CMD_WIN
->generic
.origin
.y
= locator
->origin
.y
+ 1;
783 make_invisible_and_set_new_height (TUI_CMD_WIN
,
784 TUI_CMD_WIN
->generic
.height
786 make_visible_with_new_height (first_win
);
787 make_visible_with_new_height (second_win
);
788 make_visible_with_new_height (TUI_CMD_WIN
);
789 if (first_win
->generic
.content_size
<= 0)
790 tui_erase_source_content (first_win
, EMPTY_SOURCE_PROMPT
);
791 if (second_win
->generic
.content_size
<= 0)
792 tui_erase_source_content (second_win
, EMPTY_SOURCE_PROMPT
);
795 /* Now remove all invisible windows, and their content so that
796 they get created again when called for with the new size. */
797 for (win_type
= SRC_WIN
; (win_type
< MAX_MAJOR_WINDOWS
); win_type
++)
799 if (win_type
!= CMD_WIN
800 && (tui_win_list
[win_type
] != NULL
)
801 && !tui_win_list
[win_type
]->generic
.is_visible
)
803 tui_free_window (tui_win_list
[win_type
]);
804 tui_win_list
[win_type
] = (struct tui_win_info
*) NULL
;
807 /* Turn keypad back on, unless focus is in the command
809 if (win_with_focus
!= TUI_CMD_WIN
)
810 keypad (TUI_CMD_WIN
->generic
.handle
, TRUE
);
815 /* SIGWINCH signal handler for the tui. This signal handler is always
816 called, even when the readline package clears signals because it is
817 set as the old_sigwinch() (TUI only). */
819 tui_sigwinch_handler (int signal
)
821 /* Say that a resize was done so that the readline can do it later
823 tui_set_win_resized_to (TRUE
);
827 /* Initializes SIGWINCH signal handler for the tui. */
829 tui_initialize_win (void)
832 #ifdef HAVE_SIGACTION
833 struct sigaction old_winch
;
835 memset (&old_winch
, 0, sizeof (old_winch
));
836 old_winch
.sa_handler
= &tui_sigwinch_handler
;
838 old_winch
.sa_flags
= SA_RESTART
;
840 sigaction (SIGWINCH
, &old_winch
, NULL
);
842 signal (SIGWINCH
, &tui_sigwinch_handler
);
848 /*************************
849 ** STATIC LOCAL FUNCTIONS
850 **************************/
854 tui_scroll_forward_command (char *arg
, int from_tty
)
856 int num_to_scroll
= 1;
857 struct tui_win_info
*win_to_scroll
;
859 /* Make sure the curses mode is enabled. */
861 if (arg
== (char *) NULL
)
862 parse_scrolling_args (arg
, &win_to_scroll
, (int *) NULL
);
864 parse_scrolling_args (arg
, &win_to_scroll
, &num_to_scroll
);
865 tui_scroll (FORWARD_SCROLL
, win_to_scroll
, num_to_scroll
);
870 tui_scroll_backward_command (char *arg
, int from_tty
)
872 int num_to_scroll
= 1;
873 struct tui_win_info
*win_to_scroll
;
875 /* Make sure the curses mode is enabled. */
877 if (arg
== (char *) NULL
)
878 parse_scrolling_args (arg
, &win_to_scroll
, (int *) NULL
);
880 parse_scrolling_args (arg
, &win_to_scroll
, &num_to_scroll
);
881 tui_scroll (BACKWARD_SCROLL
, win_to_scroll
, num_to_scroll
);
886 tui_scroll_left_command (char *arg
, int from_tty
)
889 struct tui_win_info
*win_to_scroll
;
891 /* Make sure the curses mode is enabled. */
893 parse_scrolling_args (arg
, &win_to_scroll
, &num_to_scroll
);
894 tui_scroll (LEFT_SCROLL
, win_to_scroll
, num_to_scroll
);
899 tui_scroll_right_command (char *arg
, int from_tty
)
902 struct tui_win_info
*win_to_scroll
;
904 /* Make sure the curses mode is enabled. */
906 parse_scrolling_args (arg
, &win_to_scroll
, &num_to_scroll
);
907 tui_scroll (RIGHT_SCROLL
, win_to_scroll
, num_to_scroll
);
911 /* Set focus to the window named by 'arg'. */
913 tui_set_focus (char *arg
, int from_tty
)
915 if (arg
!= (char *) NULL
)
917 char *buf_ptr
= (char *) xstrdup (arg
);
919 struct tui_win_info
*win_info
= (struct tui_win_info
*) NULL
;
921 for (i
= 0; (i
< strlen (buf_ptr
)); i
++)
922 buf_ptr
[i
] = toupper (arg
[i
]);
924 if (subset_compare (buf_ptr
, "NEXT"))
925 win_info
= tui_next_win (tui_win_with_focus ());
926 else if (subset_compare (buf_ptr
, "PREV"))
927 win_info
= tui_prev_win (tui_win_with_focus ());
929 win_info
= tui_partial_win_by_name (buf_ptr
);
931 if (win_info
== (struct tui_win_info
*) NULL
932 || !win_info
->generic
.is_visible
)
933 warning (_("Invalid window specified. \n\
934 The window name specified must be valid and visible.\n"));
937 tui_set_win_focus_to (win_info
);
938 keypad (TUI_CMD_WIN
->generic
.handle
, (win_info
!= TUI_CMD_WIN
));
941 if (TUI_DATA_WIN
&& TUI_DATA_WIN
->generic
.is_visible
)
942 tui_refresh_data_win ();
944 printf_filtered (_("Focus set to %s window.\n"),
945 tui_win_name ((struct tui_gen_win_info
*)
946 tui_win_with_focus ()));
949 warning (_("Incorrect Number of Arguments.\n%s"), FOCUS_USAGE
);
953 tui_set_focus_command (char *arg
, int from_tty
)
955 /* Make sure the curses mode is enabled. */
957 tui_set_focus (arg
, from_tty
);
962 tui_all_windows_info (char *arg
, int from_tty
)
964 enum tui_win_type type
;
965 struct tui_win_info
*win_with_focus
= tui_win_with_focus ();
967 for (type
= SRC_WIN
; (type
< MAX_MAJOR_WINDOWS
); type
++)
968 if (tui_win_list
[type
]
969 && tui_win_list
[type
]->generic
.is_visible
)
971 if (win_with_focus
== tui_win_list
[type
])
972 printf_filtered (" %s\t(%d lines) <has focus>\n",
973 tui_win_name (&tui_win_list
[type
]->generic
),
974 tui_win_list
[type
]->generic
.height
);
976 printf_filtered (" %s\t(%d lines)\n",
977 tui_win_name (&tui_win_list
[type
]->generic
),
978 tui_win_list
[type
]->generic
.height
);
984 tui_refresh_all_command (char *arg
, int from_tty
)
986 /* Make sure the curses mode is enabled. */
989 tui_refresh_all_win ();
993 /* Set the height of the specified window. */
995 tui_set_tab_width_command (char *arg
, int from_tty
)
997 /* Make sure the curses mode is enabled. */
999 if (arg
!= (char *) NULL
)
1005 tui_set_default_tab_len (ts
);
1007 warning (_("Tab widths greater than 0 must be specified."));
1012 /* Set the height of the specified window. */
1014 tui_set_win_height (char *arg
, int from_tty
)
1016 /* Make sure the curses mode is enabled. */
1018 if (arg
!= (char *) NULL
)
1020 char *buf
= xstrdup (arg
);
1021 char *buf_ptr
= buf
;
1022 char *wname
= (char *) NULL
;
1024 struct tui_win_info
*win_info
;
1027 buf_ptr
= strchr (buf_ptr
, ' ');
1028 if (buf_ptr
!= (char *) NULL
)
1030 *buf_ptr
= (char) 0;
1032 /* Validate the window name. */
1033 for (i
= 0; i
< strlen (wname
); i
++)
1034 wname
[i
] = toupper (wname
[i
]);
1035 win_info
= tui_partial_win_by_name (wname
);
1037 if (win_info
== (struct tui_win_info
*) NULL
1038 || !win_info
->generic
.is_visible
)
1039 warning (_("Invalid window specified. \n\
1040 The window name specified must be valid and visible.\n"));
1043 /* Process the size. */
1044 while (*(++buf_ptr
) == ' ')
1047 if (*buf_ptr
!= (char) 0)
1050 int fixed_size
= TRUE
;
1053 if (*buf_ptr
== '+' || *buf_ptr
== '-')
1055 if (*buf_ptr
== '-')
1060 input_no
= atoi (buf_ptr
);
1066 new_height
= input_no
;
1068 new_height
= win_info
->generic
.height
+ input_no
;
1070 /* Now change the window's height, and adjust
1071 all other windows around it. */
1072 if (tui_adjust_win_heights (win_info
,
1073 new_height
) == TUI_FAILURE
)
1074 warning (_("Invalid window height specified.\n%s"),
1077 tui_update_gdb_sizes ();
1080 warning (_("Invalid window height specified.\n%s"),
1086 printf_filtered (WIN_HEIGHT_USAGE
);
1088 if (buf
!= (char *) NULL
)
1092 printf_filtered (WIN_HEIGHT_USAGE
);
1095 /* Set the height of the specified window, with va_list. */
1097 tui_set_win_height_command (char *arg
, int from_tty
)
1099 /* Make sure the curses mode is enabled. */
1101 tui_set_win_height (arg
, from_tty
);
1105 /* XDB Compatibility command for setting the window height. This will
1106 increase or decrease the command window by the specified
1109 tui_xdb_set_win_height (char *arg
, int from_tty
)
1111 /* Make sure the curses mode is enabled. */
1113 if (arg
!= (char *) NULL
)
1115 int input_no
= atoi (arg
);
1118 { /* Add 1 for the locator. */
1119 int new_height
= tui_term_height () - (input_no
+ 1);
1121 if (!new_height_ok (tui_win_list
[CMD_WIN
], new_height
)
1122 || tui_adjust_win_heights (tui_win_list
[CMD_WIN
],
1123 new_height
) == TUI_FAILURE
)
1124 warning (_("Invalid window height specified.\n%s"),
1125 XDBWIN_HEIGHT_USAGE
);
1128 warning (_("Invalid window height specified.\n%s"),
1129 XDBWIN_HEIGHT_USAGE
);
1132 warning (_("Invalid window height specified.\n%s"), XDBWIN_HEIGHT_USAGE
);
1135 /* Set the height of the specified window, with va_list. */
1137 tui_xdb_set_win_height_command (char *arg
, int from_tty
)
1139 tui_xdb_set_win_height (arg
, from_tty
);
1143 /* Function to adjust all window heights around the primary. */
1144 static enum tui_status
1145 tui_adjust_win_heights (struct tui_win_info
*primary_win_info
,
1148 enum tui_status status
= TUI_FAILURE
;
1150 if (new_height_ok (primary_win_info
, new_height
))
1152 status
= TUI_SUCCESS
;
1153 if (new_height
!= primary_win_info
->generic
.height
)
1156 struct tui_win_info
*win_info
;
1157 struct tui_gen_win_info
*locator
= tui_locator_win_info_ptr ();
1158 enum tui_layout_type cur_layout
= tui_current_layout ();
1160 diff
= (new_height
- primary_win_info
->generic
.height
) * (-1);
1161 if (cur_layout
== SRC_COMMAND
1162 || cur_layout
== DISASSEM_COMMAND
)
1164 struct tui_win_info
*src_win_info
;
1166 make_invisible_and_set_new_height (primary_win_info
, new_height
);
1167 if (primary_win_info
->generic
.type
== CMD_WIN
)
1169 win_info
= (tui_source_windows ())->list
[0];
1170 src_win_info
= win_info
;
1174 win_info
= tui_win_list
[CMD_WIN
];
1175 src_win_info
= primary_win_info
;
1177 make_invisible_and_set_new_height (win_info
,
1178 win_info
->generic
.height
+ diff
);
1179 TUI_CMD_WIN
->generic
.origin
.y
= locator
->origin
.y
+ 1;
1180 make_visible_with_new_height (win_info
);
1181 make_visible_with_new_height (primary_win_info
);
1182 if (src_win_info
->generic
.content_size
<= 0)
1183 tui_erase_source_content (src_win_info
, EMPTY_SOURCE_PROMPT
);
1187 struct tui_win_info
*first_win
;
1188 struct tui_win_info
*second_win
;
1190 if (cur_layout
== SRC_DISASSEM_COMMAND
)
1192 first_win
= TUI_SRC_WIN
;
1193 second_win
= TUI_DISASM_WIN
;
1197 first_win
= TUI_DATA_WIN
;
1198 second_win
= (tui_source_windows ())->list
[0];
1200 if (primary_win_info
== TUI_CMD_WIN
)
1201 { /* Split the change in height accross the 1st & 2nd
1202 windows, adjusting them as well. */
1203 /* Subtract the locator. */
1204 int first_split_diff
= diff
/ 2;
1205 int second_split_diff
= first_split_diff
;
1209 if (first_win
->generic
.height
>
1210 second_win
->generic
.height
)
1218 second_split_diff
--;
1220 second_split_diff
++;
1223 /* Make sure that the minimum hieghts are
1225 while ((first_win
->generic
.height
+ first_split_diff
) < 3)
1228 second_split_diff
--;
1230 while ((second_win
->generic
.height
+ second_split_diff
) < 3)
1232 second_split_diff
++;
1235 make_invisible_and_set_new_height (
1237 first_win
->generic
.height
+ first_split_diff
);
1238 second_win
->generic
.origin
.y
= first_win
->generic
.height
- 1;
1239 make_invisible_and_set_new_height (second_win
,
1240 second_win
->generic
.height
1241 + second_split_diff
);
1242 TUI_CMD_WIN
->generic
.origin
.y
= locator
->origin
.y
+ 1;
1243 make_invisible_and_set_new_height (TUI_CMD_WIN
, new_height
);
1247 if ((TUI_CMD_WIN
->generic
.height
+ diff
) < 1)
1248 { /* If there is no way to increase the command
1249 window take real estate from the 1st or 2nd
1251 if ((TUI_CMD_WIN
->generic
.height
+ diff
) < 1)
1255 for (i
= TUI_CMD_WIN
->generic
.height
+ diff
;
1257 if (primary_win_info
== first_win
)
1258 second_win
->generic
.height
--;
1260 first_win
->generic
.height
--;
1263 if (primary_win_info
== first_win
)
1264 make_invisible_and_set_new_height (first_win
, new_height
);
1266 make_invisible_and_set_new_height (
1268 first_win
->generic
.height
);
1269 second_win
->generic
.origin
.y
= first_win
->generic
.height
- 1;
1270 if (primary_win_info
== second_win
)
1271 make_invisible_and_set_new_height (second_win
, new_height
);
1273 make_invisible_and_set_new_height (
1274 second_win
, second_win
->generic
.height
);
1275 TUI_CMD_WIN
->generic
.origin
.y
= locator
->origin
.y
+ 1;
1276 if ((TUI_CMD_WIN
->generic
.height
+ diff
) < 1)
1277 make_invisible_and_set_new_height (TUI_CMD_WIN
, 1);
1279 make_invisible_and_set_new_height (TUI_CMD_WIN
,
1280 TUI_CMD_WIN
->generic
.height
+ diff
);
1282 make_visible_with_new_height (TUI_CMD_WIN
);
1283 make_visible_with_new_height (second_win
);
1284 make_visible_with_new_height (first_win
);
1285 if (first_win
->generic
.content_size
<= 0)
1286 tui_erase_source_content (first_win
, EMPTY_SOURCE_PROMPT
);
1287 if (second_win
->generic
.content_size
<= 0)
1288 tui_erase_source_content (second_win
, EMPTY_SOURCE_PROMPT
);
1297 /* Function make the target window (and auxillary windows associated
1298 with the targer) invisible, and set the new height and
1301 make_invisible_and_set_new_height (struct tui_win_info
*win_info
,
1305 struct tui_gen_win_info
*gen_win_info
;
1307 tui_make_invisible (&win_info
->generic
);
1308 win_info
->generic
.height
= height
;
1310 win_info
->generic
.viewport_height
= height
- 1;
1312 win_info
->generic
.viewport_height
= height
;
1313 if (win_info
!= TUI_CMD_WIN
)
1314 win_info
->generic
.viewport_height
--;
1316 /* Now deal with the auxillary windows associated with win_info. */
1317 switch (win_info
->generic
.type
)
1321 gen_win_info
= win_info
->detail
.source_info
.execution_info
;
1322 tui_make_invisible (gen_win_info
);
1323 gen_win_info
->height
= height
;
1324 gen_win_info
->origin
.y
= win_info
->generic
.origin
.y
;
1326 gen_win_info
->viewport_height
= height
- 1;
1328 gen_win_info
->viewport_height
= height
;
1329 if (win_info
!= TUI_CMD_WIN
)
1330 gen_win_info
->viewport_height
--;
1332 if (tui_win_has_locator (win_info
))
1334 gen_win_info
= tui_locator_win_info_ptr ();
1335 tui_make_invisible (gen_win_info
);
1336 gen_win_info
->origin
.y
= win_info
->generic
.origin
.y
+ height
;
1340 /* Delete all data item windows. */
1341 for (i
= 0; i
< win_info
->generic
.content_size
; i
++)
1343 gen_win_info
= (struct tui_gen_win_info
*)
1344 &((struct tui_win_element
*)
1345 win_info
->generic
.content
[i
])->which_element
.data_window
;
1346 tui_delete_win (gen_win_info
->handle
);
1347 gen_win_info
->handle
= (WINDOW
*) NULL
;
1356 /* Function to make the windows with new heights visible. This means
1357 re-creating the windows' content since the window had to be
1358 destroyed to be made invisible. */
1360 make_visible_with_new_height (struct tui_win_info
*win_info
)
1364 tui_make_visible (&win_info
->generic
);
1365 tui_check_and_display_highlight_if_needed (win_info
);
1366 switch (win_info
->generic
.type
)
1370 tui_free_win_content (win_info
->detail
.source_info
.execution_info
);
1371 tui_make_visible (win_info
->detail
.source_info
.execution_info
);
1372 if (win_info
->generic
.content
!= NULL
)
1374 struct gdbarch
*gdbarch
= win_info
->detail
.source_info
.gdbarch
;
1375 struct tui_line_or_address line_or_addr
;
1376 struct symtab_and_line cursal
1377 = get_current_source_symtab_and_line ();
1379 line_or_addr
= win_info
->detail
.source_info
.start_line_or_addr
;
1380 tui_free_win_content (&win_info
->generic
);
1381 tui_update_source_window (win_info
, gdbarch
,
1382 cursal
.symtab
, line_or_addr
, TRUE
);
1384 else if (deprecated_safe_get_selected_frame () != NULL
)
1386 struct tui_line_or_address line
;
1387 struct symtab_and_line cursal
1388 = get_current_source_symtab_and_line ();
1389 struct frame_info
*frame
= deprecated_safe_get_selected_frame ();
1390 struct gdbarch
*gdbarch
= get_frame_arch (frame
);
1392 s
= find_pc_line_symtab (get_frame_pc (frame
));
1393 if (win_info
->generic
.type
== SRC_WIN
)
1395 line
.loa
= LOA_LINE
;
1396 line
.u
.line_no
= cursal
.line
;
1400 line
.loa
= LOA_ADDRESS
;
1401 find_line_pc (s
, cursal
.line
, &line
.u
.addr
);
1403 tui_update_source_window (win_info
, gdbarch
, s
, line
, TRUE
);
1405 if (tui_win_has_locator (win_info
))
1407 tui_make_visible (tui_locator_win_info_ptr ());
1408 tui_show_locator_content ();
1412 tui_display_all_data ();
1415 win_info
->detail
.command_info
.cur_line
= 0;
1416 win_info
->detail
.command_info
.curch
= 0;
1418 wresize (TUI_CMD_WIN
->generic
.handle
,
1419 TUI_CMD_WIN
->generic
.height
,
1420 TUI_CMD_WIN
->generic
.width
);
1422 mvwin (TUI_CMD_WIN
->generic
.handle
,
1423 TUI_CMD_WIN
->generic
.origin
.y
,
1424 TUI_CMD_WIN
->generic
.origin
.x
);
1425 wmove (win_info
->generic
.handle
,
1426 win_info
->detail
.command_info
.cur_line
,
1427 win_info
->detail
.command_info
.curch
);
1436 new_height_ok (struct tui_win_info
*primary_win_info
,
1439 int ok
= (new_height
< tui_term_height ());
1444 enum tui_layout_type cur_layout
= tui_current_layout ();
1446 diff
= (new_height
- primary_win_info
->generic
.height
) * (-1);
1447 if (cur_layout
== SRC_COMMAND
|| cur_layout
== DISASSEM_COMMAND
)
1449 ok
= ((primary_win_info
->generic
.type
== CMD_WIN
1450 && new_height
<= (tui_term_height () - 4)
1451 && new_height
>= MIN_CMD_WIN_HEIGHT
)
1452 || (primary_win_info
->generic
.type
!= CMD_WIN
1453 && new_height
<= (tui_term_height () - 2)
1454 && new_height
>= MIN_WIN_HEIGHT
));
1456 { /* Check the total height. */
1457 struct tui_win_info
*win_info
;
1459 if (primary_win_info
== TUI_CMD_WIN
)
1460 win_info
= (tui_source_windows ())->list
[0];
1462 win_info
= TUI_CMD_WIN
;
1464 (win_info
->generic
.height
+ diff
)) <= tui_term_height ());
1469 int cur_total_height
, total_height
, min_height
= 0;
1470 struct tui_win_info
*first_win
;
1471 struct tui_win_info
*second_win
;
1473 if (cur_layout
== SRC_DISASSEM_COMMAND
)
1475 first_win
= TUI_SRC_WIN
;
1476 second_win
= TUI_DISASM_WIN
;
1480 first_win
= TUI_DATA_WIN
;
1481 second_win
= (tui_source_windows ())->list
[0];
1483 /* We could simply add all the heights to obtain the same
1484 result but below is more explicit since we subtract 1 for
1485 the line that the first and second windows share, and add
1486 one for the locator. */
1487 total_height
= cur_total_height
=
1488 (first_win
->generic
.height
+ second_win
->generic
.height
- 1)
1489 + TUI_CMD_WIN
->generic
.height
+ 1; /* Locator. */
1490 if (primary_win_info
== TUI_CMD_WIN
)
1492 /* Locator included since first & second win share a line. */
1493 ok
= ((first_win
->generic
.height
+
1494 second_win
->generic
.height
+ diff
) >=
1495 (MIN_WIN_HEIGHT
* 2)
1496 && new_height
>= MIN_CMD_WIN_HEIGHT
);
1499 total_height
= new_height
+
1500 (first_win
->generic
.height
+
1501 second_win
->generic
.height
+ diff
);
1502 min_height
= MIN_CMD_WIN_HEIGHT
;
1507 min_height
= MIN_WIN_HEIGHT
;
1509 /* First see if we can increase/decrease the command
1510 window. And make sure that the command window is at
1512 ok
= ((TUI_CMD_WIN
->generic
.height
+ diff
) > 0);
1514 { /* Looks like we have to increase/decrease one of
1515 the other windows. */
1516 if (primary_win_info
== first_win
)
1517 ok
= (second_win
->generic
.height
+ diff
) >= min_height
;
1519 ok
= (first_win
->generic
.height
+ diff
) >= min_height
;
1523 if (primary_win_info
== first_win
)
1524 total_height
= new_height
+
1525 second_win
->generic
.height
+
1526 TUI_CMD_WIN
->generic
.height
+ diff
;
1528 total_height
= new_height
+
1529 first_win
->generic
.height
+
1530 TUI_CMD_WIN
->generic
.height
+ diff
;
1533 /* Now make sure that the proposed total height doesn't
1534 exceed the old total height. */
1536 ok
= (new_height
>= min_height
1537 && total_height
<= cur_total_height
);
1546 parse_scrolling_args (char *arg
,
1547 struct tui_win_info
**win_to_scroll
,
1552 *win_to_scroll
= tui_win_with_focus ();
1554 /* First set up the default window to scroll, in case there is no
1556 if (arg
!= (char *) NULL
)
1558 char *buf
, *buf_ptr
;
1560 /* Process the number of lines to scroll. */
1561 buf
= buf_ptr
= xstrdup (arg
);
1562 if (isdigit (*buf_ptr
))
1567 buf_ptr
= strchr (buf_ptr
, ' ');
1568 if (buf_ptr
!= (char *) NULL
)
1570 *buf_ptr
= (char) 0;
1572 *num_to_scroll
= atoi (num_str
);
1575 else if (num_to_scroll
)
1576 *num_to_scroll
= atoi (num_str
);
1579 /* Process the window name if one is specified. */
1580 if (buf_ptr
!= (char *) NULL
)
1585 if (*buf_ptr
== ' ')
1586 while (*(++buf_ptr
) == ' ')
1589 if (*buf_ptr
!= (char) 0)
1593 /* Validate the window name. */
1594 for (i
= 0; i
< strlen (wname
); i
++)
1595 wname
[i
] = toupper (wname
[i
]);
1600 *win_to_scroll
= tui_partial_win_by_name (wname
);
1602 if (*win_to_scroll
== (struct tui_win_info
*) NULL
1603 || !(*win_to_scroll
)->generic
.is_visible
)
1604 error (_("Invalid window specified. \n\
1605 The window name specified must be valid and visible.\n"));
1606 else if (*win_to_scroll
== TUI_CMD_WIN
)
1607 *win_to_scroll
= (tui_source_windows ())->list
[0];