From 29303c063656505c692ea19d91d198c2425c9390 Mon Sep 17 00:00:00 2001 From: Martin Robinson Date: Mon, 20 Oct 2014 18:04:48 -0700 Subject: [PATCH] Improve logical geometry formatting Logical geometry is complicated, so the string formatted output is verbose. This means that flow tree dumps often go well beyond the edge of the terminal screen. With a simple notation, we can shorten the output and make it slightly easier to read. This notation also makes it more similar to the formatted output of Rect, Point2D, and Size2D. --- components/util/logical_geometry.rs | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/components/util/logical_geometry.rs b/components/util/logical_geometry.rs index a16dd6a5c8d..67cfb231aca 100644 --- a/components/util/logical_geometry.rs +++ b/components/util/logical_geometry.rs @@ -143,7 +143,7 @@ pub struct LogicalSize { impl Show for LogicalSize { fn fmt(&self, formatter: &mut Formatter) -> Result<(), FormatError> { - write!(formatter, "LogicalSize[{}, {}, {}]", + write!(formatter, "LogicalSize({}, i{}×b{})", self.debug_writing_mode, self.inline, self.block) } } @@ -280,7 +280,7 @@ pub struct LogicalPoint { impl Show for LogicalPoint { fn fmt(&self, formatter: &mut Formatter) -> Result<(), FormatError> { - write!(formatter, "LogicalPoint[{}, {}, {}]", + write!(formatter, "LogicalPoint({} (i{}, b{}))", self.debug_writing_mode, self.i, self.b) } } @@ -456,10 +456,12 @@ pub struct LogicalMargin { impl Show for LogicalMargin { fn fmt(&self, formatter: &mut Formatter) -> Result<(), FormatError> { write!(formatter, - "LogicalMargin[{}, block_start: {}, inline_end: {}, \ - block_end: {}, inline_start: {}]", - self.debug_writing_mode, self.block_start, - self.inline_end, self.block_end, self.inline_start) + "LogicalMargin({}, inline: {}..{} block: {}..{})", + self.debug_writing_mode, + self.inline_start, + self.inline_end, + self.block_start, + self.block_end) } } @@ -736,10 +738,12 @@ pub struct LogicalRect { impl Show for LogicalRect { fn fmt(&self, formatter: &mut Formatter) -> Result<(), FormatError> { write!(formatter, - "LogicalRect[{}, inline_start: {}, block_start: {}, \ - inline: {}, block: {}]", - self.debug_writing_mode, self.start.i, self.start.b, - self.size.inline, self.size.block) + "LogicalRect({}, i{}×b{}, @ (i{},b{}))", + self.debug_writing_mode, + self.size.inline, + self.size.block, + self.start.i, + self.start.b) } }