Skip to content

[Feature Request]: link clickability #46

@CapSnCrunch

Description

@CapSnCrunch

Hello! Back with another UX request.

Curent UX Experience

  1. Right now, links are not clickable in the browser terminal session.
Image

Proposed Changes

  1. Add URL detection to the existing registerFilePathLinkProvider() in terminal-ui.js. URLs matching https?:// are detected, underlined on hover, and open in a new browser tab when clicked. Also requires a small fix to a pre-existing off-by-one bug where the link provider was reading text from the wrong buffer line (provideLinks passes a 1-based line number, but getLine() expects 0-based).

New URL pattern and handler added to src/web/public/terminal-ui.js:

  // Pattern 0: URLs (https://, http://)                                                                                                                                                                              
  const urlPattern = /https?:\/\/[^\s"'<>|;&)\]\x00-\x1f]+/g;                                                                                                                                                         
                                                                                                                                                                                                                      
  const addUrlLink = (url, matchIndex) => {                                                                                                                                                                           
    // Strip trailing punctuation that's likely not part of the URL                                                                                                                                                   
    const cleaned = url.replace(/[.,;:!?)]+$/, '');                                                                                                                                                                   
    const startCol = lineText.indexOf(cleaned, matchIndex);                                                                                                                                                           
    if (startCol === -1) return;                                                                                                                                                                                      
                                                                                                                                                                                                                      
    if (links.some(l => l.range.start.x === startCol + 1)) return;                                                                                                                                                    
   
    links.push({                                                                                                                                                                                                      
      text: cleaned,                                              
      range: {                                                                                                                                                                                                        
        start: { x: startCol + 1, y: bufferLineNumber },          
      decorations: { pointerCursor: true, underline: true },
      activate(_event, text) {                                                                                                                                                                                        
        window.open(text, '_blank', 'noopener,noreferrer');       
      }                                                                                                                                                                                                               
    });                                                           
  };                                                                                                                                                                                                                  

Off-by-one bugfix:

  - const line = buffer.getLine(bufferLineNumber);
  + // provideLinks passes 1-based line number, getLine expects 0-based                                                                                                                                               
  + const line = buffer.getLine(bufferLineNumber - 1);
  • No new dependencies — extends the existing custom link provider instead of adding the WebLinksAddon
  • URLs are matched first so they take priority over file path patterns
  • Trailing punctuation (. , ; : ! )) is stripped from matched URLs
Screen.Recording.2026-03-23.at.8.51.59.PM.mov

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions