From b178b9599279ec03c4295c36f958d94759d47e2e Mon Sep 17 00:00:00 2001 From: peter Date: Mon, 20 Feb 2012 17:08:26 +0100 Subject: [PATCH] correct link offsets in TeamCity notifications --- .../src/com/intellij/notification/EventLog.java | 3 ++- .../com/intellij/notification/EventLogTest.groovy | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/platform/platform-impl/src/com/intellij/notification/EventLog.java b/platform/platform-impl/src/com/intellij/notification/EventLog.java index bfd2dfc15bd9..3a72da112979 100644 --- a/platform/platform-impl/src/com/intellij/notification/EventLog.java +++ b/platform/platform-impl/src/com/intellij/notification/EventLog.java @@ -234,8 +234,9 @@ public class EventLog implements Notifications { int linkEnd = content.indexOf(A_CLOSING, tagMatcher.end()); if (linkEnd > 0) { String linkText = content.substring(tagMatcher.end(), linkEnd).replaceAll(TAG_PATTERN.pattern(), ""); + int linkStart = document.getTextLength(); appendText(document, linkText); - links.put(document.createRangeMarker(new TextRange(document.getTextLength() - linkText.length(), document.getTextLength())), + links.put(document.createRangeMarker(new TextRange(linkStart, document.getTextLength())), new NotificationHyperlinkInfo(notification, href)); content = content.substring(linkEnd + A_CLOSING.length()); continue; diff --git a/platform/platform-tests/testSrc/com/intellij/notification/EventLogTest.groovy b/platform/platform-tests/testSrc/com/intellij/notification/EventLogTest.groovy index a974d308537b..4aea3283eb28 100644 --- a/platform/platform-tests/testSrc/com/intellij/notification/EventLogTest.groovy +++ b/platform/platform-tests/testSrc/com/intellij/notification/EventLogTest.groovy @@ -107,4 +107,14 @@ class EventLogTest extends LightPlatformTestCase { \tbar''' } + public void testTeamCityLink() { + def entry = format('title', '''

You are assigned for investigation of a test failure
FtlFixesTest.testToplevelVariableLocal (IDEA Trunk), assigned by Roman Shevchenko

+

Details »

''') + assert entry.message == '''title +\tYou are assigned for investigation of a test failure +\tFtlFixesTest.testToplevelVariableLocal (IDEA Trunk), assigned by Roman Shevchenko +\tDetails >>''' + assert entry.links.collect { it.first } == [new TextRange(144, 154)] + } + }