gerrvim2json.pl | 14 +++++++------- diff --git a/gerrvim2json.pl b/gerrvim2json.pl index 0cf9c869e6410a856ec82533e3242399a200945a..bd52c4201a180a1c83530a286a807a752a12b952 100755 --- a/gerrvim2json.pl +++ b/gerrvim2json.pl @@ -54,10 +54,7 @@ } }, { "message": "Remove that.", - "range": { - "end_line": "2", - "start_line": "1" - } + "line": 1 } ] } @@ -115,10 +112,13 @@ }; sub comment_done { ($comments{$filename} = []) unless defined $comments{$filename}; - push @{$comments{$filename}}, { - range => {start_line => $linebgn, end_line => $lineend}, - message => buf2str, + my %c = ("message" => buf2str); + if ($lineend - $linebgn == 1) { + $c{"line"} = $linebgn; + } else { + $c{"range"} = {start_line => $linebgn, end_line => $lineend}; }; + push @{$comments{$filename}}, \%c; } while (<>) {