Reimplement tui_next_win and tui_prev_win
This reimplements tui_next_win and tui_prev_win. Now they account for the possibility of windows not on tui_win_list. gdb/ChangeLog 2020-02-22 Tom Tromey <tom@tromey.com> * tui/tui-data.c (tui_next_win, tui_prev_win): Reimplement. Change-Id: Ifcd402f76fe0a16e0fe9275a185d550279c01660
This commit is contained in:
parent
7eed1a8e83
commit
eb9c887456
|
@ -1,3 +1,7 @@
|
||||||
|
2020-02-22 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
|
* tui/tui-data.c (tui_next_win, tui_prev_win): Reimplement.
|
||||||
|
|
||||||
2020-02-22 Tom Tromey <tom@tromey.com>
|
2020-02-22 Tom Tromey <tom@tromey.com>
|
||||||
|
|
||||||
* tui/tui-winsource.h (struct tui_source_window_iterator)
|
* tui/tui-winsource.h (struct tui_source_window_iterator)
|
||||||
|
|
|
@ -26,6 +26,7 @@
|
||||||
#include "tui/tui-wingeneral.h"
|
#include "tui/tui-wingeneral.h"
|
||||||
#include "tui/tui-winsource.h"
|
#include "tui/tui-winsource.h"
|
||||||
#include "gdb_curses.h"
|
#include "gdb_curses.h"
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
struct tui_win_info *tui_win_list[MAX_MAJOR_WINDOWS];
|
struct tui_win_info *tui_win_list[MAX_MAJOR_WINDOWS];
|
||||||
|
|
||||||
|
@ -103,28 +104,13 @@ tui_set_term_width_to (int w)
|
||||||
struct tui_win_info *
|
struct tui_win_info *
|
||||||
tui_next_win (struct tui_win_info *cur_win)
|
tui_next_win (struct tui_win_info *cur_win)
|
||||||
{
|
{
|
||||||
int type = cur_win->type;
|
auto iter = std::find (tui_windows.begin (), tui_windows.end (), cur_win);
|
||||||
struct tui_win_info *next_win = NULL;
|
gdb_assert (iter != tui_windows.end ());
|
||||||
|
|
||||||
if (cur_win->type == CMD_WIN)
|
++iter;
|
||||||
type = SRC_WIN;
|
if (iter == tui_windows.end ())
|
||||||
else
|
return tui_windows[0];
|
||||||
type = cur_win->type + 1;
|
return *iter;
|
||||||
while (type != cur_win->type && (next_win == NULL))
|
|
||||||
{
|
|
||||||
if (tui_win_list[type]
|
|
||||||
&& tui_win_list[type]->is_visible ())
|
|
||||||
next_win = tui_win_list[type];
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (type == CMD_WIN)
|
|
||||||
type = SRC_WIN;
|
|
||||||
else
|
|
||||||
type++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return next_win;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -133,28 +119,13 @@ tui_next_win (struct tui_win_info *cur_win)
|
||||||
struct tui_win_info *
|
struct tui_win_info *
|
||||||
tui_prev_win (struct tui_win_info *cur_win)
|
tui_prev_win (struct tui_win_info *cur_win)
|
||||||
{
|
{
|
||||||
int type = cur_win->type;
|
auto iter = std::find (tui_windows.begin (), tui_windows.end (), cur_win);
|
||||||
struct tui_win_info *prev = NULL;
|
gdb_assert (iter != tui_windows.end ());
|
||||||
|
|
||||||
if (cur_win->type == SRC_WIN)
|
if (iter == tui_windows.begin ())
|
||||||
type = CMD_WIN;
|
return tui_windows.back ();
|
||||||
else
|
--iter;
|
||||||
type = cur_win->type - 1;
|
return *iter;
|
||||||
while (type != cur_win->type && (prev == NULL))
|
|
||||||
{
|
|
||||||
if (tui_win_list[type]
|
|
||||||
&& tui_win_list[type]->is_visible ())
|
|
||||||
prev = tui_win_list[type];
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (type == SRC_WIN)
|
|
||||||
type = CMD_WIN;
|
|
||||||
else
|
|
||||||
type--;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return prev;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue