Show selection over inline code; link URLs inside code
An opaque inline-code fill painted over the selection highlight, so a selected code span looked unselected; it now keeps half the fill. Bare URLs inside inline code, fenced blocks and operator messages' backticks are now links like any other. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -118,25 +118,13 @@ String? autolinkTarget(String inner) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Bare links in plain (non-markdown) text, outside `` `code` `` spans and
|
||||
/// ```` ``` ```` fences, so an operator's pasted command is never linkified.
|
||||
/// Bare links anywhere in [text]: plain (non-markdown) text, or the body of a
|
||||
/// `` `code` `` span or fenced block, so a URL an agent quotes in code opens
|
||||
/// like any other. A backtick ends a link, so a quoted URL excludes it.
|
||||
List<ChatTextLink> findTextLinks(String text) {
|
||||
final links = <ChatTextLink>[];
|
||||
var i = 0;
|
||||
while (i < text.length) {
|
||||
if (text.startsWith('```', i)) {
|
||||
final close = text.indexOf('```', i + 3);
|
||||
if (close < 0) break;
|
||||
i = close + 3;
|
||||
continue;
|
||||
}
|
||||
if (text[i] == '`') {
|
||||
final close = text.indexOf('`', i + 1);
|
||||
if (close > i) {
|
||||
i = close + 1;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
final url = bareLinkAt(text, i);
|
||||
if (url != null) {
|
||||
links.add(ChatTextLink(i, i + url.length, url));
|
||||
|
||||
Reference in New Issue
Block a user