[extensions-web] Guard diffview against an empty region
- From: Jasper St. Pierre <jstpierre src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [extensions-web] Guard diffview against an empty region
- Date: Sat, 19 Nov 2011 19:17:24 +0000 (UTC)
commit 1d4d331b11b65c581f5f70667d856f69d7ea7ac5
Author: Jasper St. Pierre <jstpierre mecheye net>
Date: Sat Nov 19 14:17:16 2011 -0500
Guard diffview against an empty region
sweettooth/review/diffview.py | 16 ++++++++++++----
1 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/sweettooth/review/diffview.py b/sweettooth/review/diffview.py
index b6fc431..6598ec2 100644
--- a/sweettooth/review/diffview.py
+++ b/sweettooth/review/diffview.py
@@ -71,10 +71,18 @@ def get_replaced_markup(chunk, old, new):
newcontent = new[line[2] - 1]
oldregion = line[3]
newregion = line[4]
- oldlines.append(REPLACED_REGION % \
- (''.join(get_line_region_markup(oldcontent, oldregion)),))
- newlines.append(REPLACED_REGION % \
- (''.join(get_line_region_markup(newcontent, newregion)),))
+
+ if oldregion is not None:
+ oldlines.append(REPLACED_REGION % \
+ (''.join(get_line_region_markup(oldcontent, oldregion)),))
+ else:
+ oldlines.append(REPLACED_REGION % (oldcontent,))
+
+ if newregion is not None:
+ newlines.append(REPLACED_REGION % \
+ (''.join(get_line_region_markup(newcontent, newregion)),))
+ else:
+ newlines.append(REPLACED_REGION % (newcontent,))
return oldlines, newlines
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]