Fixed issue #124

Off-by-one bug when parsing document up to current line. See issue #124 for details.