• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

GNU Binutils with patches for OS216


Commit MetaInfo

Revisioneb9c88745686d46c5100bdf1c2f112d699c7f702 (tree)
Time2020-02-23 03:48:35
AuthorTom Tromey <tom@trom...>
CommiterTom Tromey

Log Message

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

Change Summary

Incremental Difference

--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,5 +1,9 @@
11 2020-02-22 Tom Tromey <tom@tromey.com>
22
3+ * tui/tui-data.c (tui_next_win, tui_prev_win): Reimplement.
4+
5+2020-02-22 Tom Tromey <tom@tromey.com>
6+
37 * tui/tui-winsource.h (struct tui_source_window_iterator)
48 <inner_iterator>: New etytypedef.
59 <tui_source_window_iterator>: Take "end" parameter.
--- a/gdb/tui/tui-data.c
+++ b/gdb/tui/tui-data.c
@@ -26,6 +26,7 @@
2626 #include "tui/tui-wingeneral.h"
2727 #include "tui/tui-winsource.h"
2828 #include "gdb_curses.h"
29+#include <algorithm>
2930
3031 struct tui_win_info *tui_win_list[MAX_MAJOR_WINDOWS];
3132
@@ -103,28 +104,13 @@ tui_set_term_width_to (int w)
103104 struct tui_win_info *
104105 tui_next_win (struct tui_win_info *cur_win)
105106 {
106- int type = cur_win->type;
107- struct tui_win_info *next_win = NULL;
108-
109- if (cur_win->type == CMD_WIN)
110- type = SRC_WIN;
111- else
112- type = cur_win->type + 1;
113- while (type != cur_win->type && (next_win == NULL))
114- {
115- if (tui_win_list[type]
116- && tui_win_list[type]->is_visible ())
117- next_win = tui_win_list[type];
118- else
119- {
120- if (type == CMD_WIN)
121- type = SRC_WIN;
122- else
123- type++;
124- }
125- }
107+ auto iter = std::find (tui_windows.begin (), tui_windows.end (), cur_win);
108+ gdb_assert (iter != tui_windows.end ());
126109
127- return next_win;
110+ ++iter;
111+ if (iter == tui_windows.end ())
112+ return tui_windows[0];
113+ return *iter;
128114 }
129115
130116
@@ -133,28 +119,13 @@ tui_next_win (struct tui_win_info *cur_win)
133119 struct tui_win_info *
134120 tui_prev_win (struct tui_win_info *cur_win)
135121 {
136- int type = cur_win->type;
137- struct tui_win_info *prev = NULL;
138-
139- if (cur_win->type == SRC_WIN)
140- type = CMD_WIN;
141- else
142- type = cur_win->type - 1;
143- while (type != cur_win->type && (prev == NULL))
144- {
145- if (tui_win_list[type]
146- && tui_win_list[type]->is_visible ())
147- prev = tui_win_list[type];
148- else
149- {
150- if (type == SRC_WIN)
151- type = CMD_WIN;
152- else
153- type--;
154- }
155- }
122+ auto iter = std::find (tui_windows.begin (), tui_windows.end (), cur_win);
123+ gdb_assert (iter != tui_windows.end ());
156124
157- return prev;
125+ if (iter == tui_windows.begin ())
126+ return tui_windows.back ();
127+ --iter;
128+ return *iter;
158129 }
159130
160131