From bb157ab1b9f374f2bd795ef825213f422206af39 Mon Sep 17 00:00:00 2001
From: Kevin Lyda <kevin@ie.suberic.net>
Date: Wed, 20 Sep 2017 21:56:55 +0100
Subject: [PATCH] Handle blank lines of < 6 chars.

Also emit a better warning for bad lines - identify the line number.
---
 plugin/cobol.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/plugin/cobol.py b/plugin/cobol.py
index 20c1031..9d940f0 100755
--- a/plugin/cobol.py
+++ b/plugin/cobol.py
@@ -47,7 +47,7 @@ def cobol_Renumber():
 
   # Look for gaps.
   for i in xrange(len(lines)):
-    if len(lines[i]) == 0 or lines[i][:6] == '      ':
+    if len(lines[i]) == 0 or lines[i][:6].isspace():
       if not gap:
         gap['i'] = i
         gap['last_line_no'] = last_line_no
@@ -55,7 +55,7 @@ def cobol_Renumber():
       try:
         last_line_no = int(lines[i][:6])
       except ValueError:
-          print('Malformed line - has non-numbers in columns 1-6')
+          print('Malformed line (%d) - has non-numbers in columns 1-6' % i - 1)
           return
       if gap:
         delta = math.floor((last_line_no - gap['last_line_no']) /
-- 
GitLab