summaryrefslogtreecommitdiff
path: root/gdb/ui-file.h
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2021-12-30 10:23:18 -0700
committerTom Tromey <tom@tromey.com>2022-01-26 15:19:13 -0700
commit7016a382b0dc48001cb5c36e56b42fc41b1303a8 (patch)
tree5190cb314252a75138fabb04aa925355e8f9f0a4 /gdb/ui-file.h
parent6c92c339539ec87dc12783e9c8f1688a4a370c03 (diff)
downloadbinutils-gdb-7016a382b0dc48001cb5c36e56b42fc41b1303a8.tar.gz
Add ui_file::wrap_here
Right now, wrap_here is a global function. In the long run, we'd like output streams to be relatively self-contained objects, and having a global function like this is counter to that goal. Also, existing code freely mixes writes to some parameterized stream with calls to wrap_here -- but wrap_here only really affects gdb_stdout, so this is also incoherent. This step is a patch toward making wrap_here more sane. It adds a wrap_here method to ui_file and changes ui_out implementations to use it.
Diffstat (limited to 'gdb/ui-file.h')
-rw-r--r--gdb/ui-file.h17
1 files changed, 17 insertions, 0 deletions
diff --git a/gdb/ui-file.h b/gdb/ui-file.h
index 7c7b00d91c6..3df9f936da5 100644
--- a/gdb/ui-file.h
+++ b/gdb/ui-file.h
@@ -107,6 +107,23 @@ public:
return false;
}
+ /* Indicate that if the next sequence of characters overflows the
+ line, a newline should be inserted here rather than when it hits
+ the end. If INDENT is non-zero, it is a number of spaces to be
+ printed to indent the wrapped part on the next line.
+
+ If the line is already overfull, we immediately print a newline and
+ the indentation, and disable further wrapping.
+
+ If we don't know the width of lines, but we know the page height,
+ we must not wrap words, but should still keep track of newlines
+ that were explicitly printed.
+
+ This routine is guaranteed to force out any output which has been
+ squirreled away in the wrap_buffer, so wrap_here (0) can be
+ used to force out output from the wrap_buffer. */
+ void wrap_here (int indent);
+
private:
/* Helper function for putstr and putstrn. Print the character C on