mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
correct link offsets in TeamCity notifications
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -107,4 +107,14 @@ class EventLogTest extends LightPlatformTestCase {
|
||||
\tbar'''
|
||||
}
|
||||
|
||||
public void testTeamCityLink() {
|
||||
def entry = format('title', '''<p>You are assigned for investigation of a test failure<br/>FtlFixesTest.testToplevelVariableLocal (IDEA Trunk), assigned by Roman Shevchenko<br/></p>
|
||||
<p><a href='#'>Details »</a></p>''')
|
||||
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)]
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user