Skip to content

Commit

Permalink
Fixed: terminal: Ctrl-Click on a file name that is coloured - does no…
Browse files Browse the repository at this point in the history
…t open in CodeLite

Signed-off-by: Eran Ifrah <[email protected]>
  • Loading branch information
eranif committed Dec 17, 2024
1 parent 10c4108 commit 287ff78
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Plugin/wxTerminalCtrl/wxTerminalOutputCtrl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,14 @@ void wxTerminalOutputCtrl::ProcessIdle()
int pos = m_ctrl->PositionFromPoint(client_pt);
int word_start_pos = m_ctrl->WordStartPosition(pos, true);
int word_end_pos = m_ctrl->WordEndPosition(pos, true);

// Make sure we only pick visible chars (embedded ANSI colour can break the selected word)
for (; word_start_pos < word_end_pos; word_start_pos++) {
if (m_ctrl->StyleGetVisible(m_ctrl->GetStyleAt(word_start_pos))) {
break;
}
}

IndicatorRange range{ word_start_pos, word_end_pos };
if (m_indicatorHyperlink.ok() && m_indicatorHyperlink == range) {
// already marked
Expand Down Expand Up @@ -327,7 +335,9 @@ void wxTerminalOutputCtrl::OnLeftUp(wxMouseEvent& event)

// fire an event
wxString pattern = m_ctrl->GetTextRange(m_indicatorHyperlink.start(), m_indicatorHyperlink.end());
CallAfter(&wxTerminalOutputCtrl::DoPatternClicked, pattern);
wxString modbuffer;
StringUtils::StripTerminalColouring(pattern, modbuffer);
CallAfter(&wxTerminalOutputCtrl::DoPatternClicked, modbuffer);
}

void wxTerminalOutputCtrl::OnEnterWindow(wxMouseEvent& event)
Expand Down

0 comments on commit 287ff78

Please sign in to comment.