+2019-08-15 Tom Tromey <tom@tromey.com>
+
+ * tui/tui-winsource.h (tui_line_is_displayed): Don't declare.
+ * tui/tui-winsource.c (tui_line_is_displayed): Move to
+ tui-source.c.
+ * tui/tui-source.h (struct tui_source_window) <line_is_displayed>:
+ Declare.
+ * tui/tui-source.c (tui_source_window::line_is_displayed): New
+ method.
+ (tui_source_window::maybe_update): Update.
+
2019-08-15 Tom Tromey <tom@tromey.com>
* tui/tui-winsource.h (tui_addr_is_displayed): Don't declare.
symtab_to_fullname (loc->symtab)) == 0);
}
+/* See tui-source.h. */
+
+bool
+tui_source_window::line_is_displayed (int line) const
+{
+ bool is_displayed = false;
+ int threshold = SCROLL_THRESHOLD;
+ int i = 0;
+ while (i < content.size () - threshold && !is_displayed)
+ {
+ is_displayed
+ = (content[i].line_or_addr.loa == LOA_LINE
+ && content[i].line_or_addr.u.line_no == line);
+ i++;
+ }
+
+ return is_displayed;
+}
+
void
tui_source_window::maybe_update (struct frame_info *fi, symtab_and_line sal,
int line_no, CORE_ADDR addr)
l.loa = LOA_LINE;
l.u.line_no = start_line;
if (!(source_already_displayed
- && tui_line_is_displayed (line_no, this, TRUE)))
+ && line_is_displayed (line_no)))
tui_update_source_window (this, get_frame_arch (fi),
sal.symtab, l, TRUE);
else
void style_changed ();
+ /* Answer whether a particular line number or address is displayed
+ in the current source window. */
+ bool line_is_displayed (int line) const;
+
/* A token used to register and unregister an observer. */
gdb::observers::token m_observable;
};
win_info->content[i].line = (char *) xmalloc (line_width);
}
}
-
-
-/* Answer whether a particular line number or address is displayed
- in the current source window. */
-int
-tui_line_is_displayed (int line,
- struct tui_source_window_base *win_info,
- int check_threshold)
-{
- int is_displayed = FALSE;
- int i, threshold;
-
- if (check_threshold)
- threshold = SCROLL_THRESHOLD;
- else
- threshold = 0;
- i = 0;
- while (i < win_info->content.size () - threshold
- && !is_displayed)
- {
- is_displayed
- = win_info->content[i].line_or_addr.loa == LOA_LINE
- && win_info->content[i].line_or_addr.u.line_no == line;
- i++;
- }
-
- return is_displayed;
-}
extern void tui_erase_source_content (struct tui_source_window_base *);
extern void tui_alloc_source_buffer (struct tui_source_window_base *);
-extern int tui_line_is_displayed (int,
- struct tui_source_window_base *,
- int);
/* Constant definitions. */