[bugzilla-gnome-org-extensions] Fix problem with commenting on blank lines at start of segment
- From: Krzesimir Nowak <krnowak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [bugzilla-gnome-org-extensions] Fix problem with commenting on blank lines at start of segment
- Date: Thu, 20 Nov 2014 22:24:41 +0000 (UTC)
commit 25de09af9c8407394a70b9ae731fc22f24d174d7
Author: Owen W. Taylor <otaylor fishsoup net>
Date: Tue Oct 27 10:37:17 2009 -0400
Fix problem with commenting on blank lines at start of segment
If the comment is on blank lines at the start of a segment, we would
naturally remove all the lines, but we want to leave one since every
comment is supposed to be about some line; a range like +49,0 to
indicate a comment between lines 48 and 49 doesn't make sense.
(We could handle it in the parser but this is simpler.)
Reported by Marina Zhurakhinskaya
https://bugzilla.gnome.org/show_bug.cgi?id=599693
js/review.js | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
---
diff --git a/js/review.js b/js/review.js
index 2899e6e..30917b4 100644
--- a/js/review.js
+++ b/js/review.js
@@ -185,8 +185,9 @@ File.prototype = {
// Sort them into global order ' ', '-', '+'
patchLines.sort(_compareSegmentLines);
- // Completely blank context isn't useful so remove it
- while (patchLines[0].match(/^\s*$/)) {
+ // Completely blank context isn't useful so remove it; however if we are commenting
+ // on blank lines at the start of a segment, we have to leave something or things break
+ while (patchLines.length > 1 && patchLines[0].match(/^\s*$/)) {
patchLines.shift();
patchOldStart++;
patchNewStart++;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]