Add "start" and "end" properties
This gives the starting (lineno, column) and ending (lineno, column) for
a logical line.
diff --git a/yapf/yapflib/unwrapped_line.py b/yapf/yapflib/unwrapped_line.py
index 778cd8e..3b480a0 100644
--- a/yapf/yapflib/unwrapped_line.py
+++ b/yapf/yapflib/unwrapped_line.py
@@ -212,6 +212,24 @@
return self.first.lineno
@property
+ def start(self):
+ """The start of the logical line.
+
+ Returns:
+ A tuple of the starting line number and column.
+ """
+ return (self.first.lineno, self.first.column)
+
+ @property
+ def end(self):
+ """The end of the logical line.
+
+ Returns:
+ A tuple of the ending line number and column.
+ """
+ return (self.last.lineno, self.last.column + len(self.last.value))
+
+ @property
def is_comment(self):
return self.first.is_comment