← Prev in month
← Prev in thread
Next in thread →
Next in month →
Proposal for regions
Michael, Jim and I worked out a proposal for regions on the phone last Friday. It incorporates Luke’s concern that endColumn wasn’t previously defined consistently (Issue #171). Here’s what I pasted into Issue #93, “Problems with regions”. I’m going to start writing the spec-ese for this and I’ll move it’s adoption at TC #18 on May 30th. FYI @michaelcfanning @kupsch @lukecartey Here is the outcome of our discussion on Friday 5/18. I include a couple of points that we didn't state explicitly, but that I think are obvious (like #3). 1. Column ranges are half-open: they exclude the column specified by endColumn. 2. If endLine is missing, it defaults to startLine. 3. There is no default value for startLine. EXAMPLE: The region startLine = 12, startColumn = 3, endColumn = 6 consists of the three characters in columns 3 through 5 of line 12. 4. If startColumn is missing, it defaults to 1. EXAMPLE: The region startLine = 12, endColumn = 6 consists of the five characters in columns 1 through 5 of line 12. 5. If endColumn is missing, it defaults to the number of characters on the last line of the region (excluding the newline sequence). EXAMPLE: Suppose line 12 consists of the characters "abcd\r\n" (the four characters "abcd" followed by the two-character newline sequence "\r\n"). Then the region startLine = 12, startColumn = 2 consists of the three characters "bcd". 6. As a result of #4 and #5, a region specified solely by startLine consists of the entire line, excluding the newline sequence. EXAMPLE: Suppose line 12 consists of the characters "abcd\r\n". Then the region startLine = 12 consists of the four characters "abcd". 7. To specify an insertion point, explicitly specify both startColumn and endColumn, on the same line, with equal values. EXAMPLE: The region startLine = 12, startColumn = 5, endColumn = 5 specifies an insertion point before column 5 on line 12. EXAMPLE: The region startLine = 12, startColumn = 1, endColumn = 1 specifies an insertion point at the beginning of line 12. NOTE: Omitting endColumn does not specify an insertion point (endColumn does not default to startColumn, contrary to the current spec). 8. Line ranges are closed: they include the line specified by endLine. 9. If a region contains more than one line, it includes the newline sequence for all but the last line. EXAMPLE: The region startLine = 12, startColumn = 3, endLine = 14 includes columns 3 through the end of line 12 (including the newline sequence), all of line 13 (including the newline sequence), and all of line 14 except for the newline sequence. EXAMPLE: The region startLine = 12, endLine = 14 includes all of lines 12 through 14 except for the newline sequence on line 14. EXAMPLE: The region startLine = 12, endLine = 13, endColumn = 1 consists of all of line 12 (including the newline sequence). The "cursor position" is before column 1 on line 13. (-- end --) Thanks, Larry
← Prev in month
← Prev in thread
Next in thread →
Next in month →