Re: [PATCH 01/16] Change wrap buffering to use a std::string

Tom Tromey
2018-12-28T18:47:18Z

>>>>> "Joel" == Joel Brobecker <brobecker@adacore.com> writes:

Joel> The question your patch
Joel> raised as a side-effect is whether we still need the boolean indicating
Joel> whether the wrap buffer has been initialized or not (filter_initalized).
Joel> I tried to explore that question, hence the unexpected entertainment,
Joel> and the answer is still not clear to me, but I *think* that we should
Joel> be able to. It really depends what the semantics of
Joel> filtered_printing_initialized is, and it looks like it might be used for
Joel> two purposes, rather than one. Eg: one meaning is the wrap_buffer is
Joel> indeed iniatilized and therefore can be used; but it looks like the
Joel> other use is to determine whether buffering is done at all.

This is a good point. I've put a note in my to-do list to remind me to
see if it can be removed.

Joel> Small typo in the name of that static global "filter_initalized" ->
Joel> "filter_initialized" :-)

Thanks, I fixed this.

>> @@ -1669,6 +1666,7 @@ fputs_maybe_filtered (const char *linebuffer, struct ui_file *stream,
>> || top_level_interpreter () == NULL
>> || top_level_interpreter ()->interp_ui_out ()->is_mi_like_p ())
>> {
>> + flush_wrap_buffer (stream);
>> fputs_unfiltered (linebuffer, stream);
>> return;
>> }

Joel> I understand why this is needed today; but I can't determine
Joel> whether this is needed as a consequence of your patch, or if this
Joel> was a hole in the previous code. Can you explain what made you
Joel> make this change?

It's probably not needed in this particular patch, but eventually style
changes are just written to the buffer; so to get styles to apply
properly when filtering is not in use, the buffer has to be flushed
here.

Tom