aboutsummaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorPedro F. Giffuni <pfg@FreeBSD.org>2016-11-27 20:30:09 +0000
committerPedro F. Giffuni <pfg@FreeBSD.org>2016-11-27 20:30:09 +0000
commit6daffe6ebf8ac89699787b7a6598bfafc41b7eed (patch)
tree04b8d46ca31a03fbfe3d9443b36b713d87c61d80 /usr.bin
parent743210efd640aa6673f792e01422fd5fc0faa31c (diff)
Notes
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/indent/pr_comment.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/usr.bin/indent/pr_comment.c b/usr.bin/indent/pr_comment.c
index 7fc9171d6e7b4..91f806ab8db4c 100644
--- a/usr.bin/indent/pr_comment.c
+++ b/usr.bin/indent/pr_comment.c
@@ -162,15 +162,19 @@ pr_comment(void)
if (*buf_ptr != ' ' && !ps.box_com)
*e_com++ = ' ';
- /* Don't put a break delimiter if this comment is a one-liner */
- for (t_ptr = buf_ptr; *t_ptr != '\0' && *t_ptr != '\n'; t_ptr++) {
- if (t_ptr >= buf_end)
- fill_buffer();
- if (t_ptr[0] == '*' && t_ptr[1] == '/') {
- break_delim = false;
- break;
+ /*
+ * Don't put a break delimiter if this is a one-liner that won't wrap.
+ */
+ if (break_delim)
+ for (t_ptr = buf_ptr; *t_ptr != '\0' && *t_ptr != '\n'; t_ptr++) {
+ if (t_ptr >= buf_end)
+ fill_buffer();
+ if (t_ptr[0] == '*' && t_ptr[1] == '/') {
+ if (adj_max_col >= count_spaces_until(ps.com_col, buf_ptr, t_ptr + 2))
+ break_delim = false;
+ break;
+ }
}
- }
if (break_delim) {
char *t = e_com;