From 4ebd6bfd867afeea13051bfbfcdedb208f997382 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergio=20Mart=C3=ADnez=20Portela?= Date: Thu, 10 Dec 2020 00:24:10 +0100 Subject: [PATCH] Make line numbers start on 1 (not 0). This is the behavior on most tools and starting with 0 was confusing at times. --- org_dom/org_dom.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/org_dom/org_dom.py b/org_dom/org_dom.py index 2ea484a..8745601 100644 --- a/org_dom/org_dom.py +++ b/org_dom/org_dom.py @@ -1044,10 +1044,9 @@ class OrgDomReader: line_count = len(lines) reader = enumerate(lines) - for linenum, line in reader: + for lnum, line in reader: + linenum = lnum + 1 try: - last_line = linenum + 1 == line_count - if m := RAW_LINE_RE.match(line): self.add_raw_line(linenum, line) elif m := HEADLINE_RE.match(line):