<!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request Conhost can now support OSC8 sequences (as specified [here](https://gist.github.com/egmontkob/eb114294efbcd5adb1944c9f3cb5feda)). Terminal also supports those sequences and additionally hyperlinks can be opened by Ctrl+LeftClicking on them. <!-- Other than the issue solved, is this relevant to any other issues/existing PRs? --> ## References #204 <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [X] Closes #204 * [ ] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [ ] Tests added/passed * [ ] Documentation updated. If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/terminal) and link it here: #xxx * [ ] Schema updated. * [ ] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #xxx <!-- Provide a more detailed description of the PR, other things fixed or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments Added support to: - parse OSC8 sequences and extract URIs from them (conhost and terminal) - add hyperlink uri data to textbuffer/screeninformation, associated with a hyperlink id (conhost and terminal) - attach hyperlink ids to text to allow for uri extraction from the textbuffer/screeninformation (conhost and terminal) - process ctrl+leftclick to open a hyperlink in the clicked region if present <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed Open up a PowerShell tab and type ```PowerShell ${ESC}=[char]27 Write-Host "${ESC}]8;;https://github.com/microsoft/terminal${ESC}\This is a link!${ESC}]8;;${ESC}\" ``` Ctrl+LeftClick on the link correctly brings you to the terminal page on github ![hyperlink](https://user-images.githubusercontent.com/26824113/89953536-45a6f580-dbfd-11ea-8e0d-8a3cd25c634a.gif)
90 lines
3.9 KiB
C++
90 lines
3.9 KiB
C++
/*++
|
|
Copyright (c) Microsoft Corporation
|
|
Licensed under the MIT license.
|
|
|
|
Module Name:
|
|
- getset.h
|
|
|
|
Abstract:
|
|
- This file implements the NT console server console state API.
|
|
|
|
Author:
|
|
- Therese Stowell (ThereseS) 5-Dec-1990
|
|
|
|
Revision History:
|
|
--*/
|
|
|
|
#pragma once
|
|
#include "../inc/conattrs.hpp"
|
|
class SCREEN_INFORMATION;
|
|
|
|
[[nodiscard]] NTSTATUS DoSrvPrivateSetCursorKeysMode(_In_ bool fApplicationMode);
|
|
[[nodiscard]] NTSTATUS DoSrvPrivateSetKeypadMode(_In_ bool fApplicationMode);
|
|
void DoSrvPrivateEnableWin32InputMode(const bool win32InputMode);
|
|
|
|
[[nodiscard]] NTSTATUS DoSrvPrivateSetScreenMode(const bool reverseMode);
|
|
[[nodiscard]] NTSTATUS DoSrvPrivateSetAutoWrapMode(const bool wrapAtEOL);
|
|
|
|
void DoSrvPrivateShowCursor(SCREEN_INFORMATION& screenInfo, const bool show) noexcept;
|
|
void DoSrvPrivateAllowCursorBlinking(SCREEN_INFORMATION& screenInfo, const bool fEnable);
|
|
|
|
[[nodiscard]] NTSTATUS DoSrvPrivateSetScrollingRegion(SCREEN_INFORMATION& screenInfo, const SMALL_RECT& scrollMargins);
|
|
[[nodiscard]] NTSTATUS DoSrvPrivateLineFeed(SCREEN_INFORMATION& screenInfo, const bool withReturn);
|
|
[[nodiscard]] NTSTATUS DoSrvPrivateReverseLineFeed(SCREEN_INFORMATION& screenInfo);
|
|
|
|
[[nodiscard]] NTSTATUS DoSrvPrivateUseAlternateScreenBuffer(SCREEN_INFORMATION& screenInfo);
|
|
void DoSrvPrivateUseMainScreenBuffer(SCREEN_INFORMATION& screenInfo);
|
|
|
|
void DoSrvPrivateEnableVT200MouseMode(const bool fEnable);
|
|
void DoSrvPrivateEnableUTF8ExtendedMouseMode(const bool fEnable);
|
|
void DoSrvPrivateEnableSGRExtendedMouseMode(const bool fEnable);
|
|
void DoSrvPrivateEnableButtonEventMouseMode(const bool fEnable);
|
|
void DoSrvPrivateEnableAnyEventMouseMode(const bool fEnable);
|
|
void DoSrvPrivateEnableAlternateScroll(const bool fEnable);
|
|
|
|
[[nodiscard]] HRESULT DoSrvPrivateEraseAll(SCREEN_INFORMATION& screenInfo);
|
|
|
|
void DoSrvSetCursorStyle(SCREEN_INFORMATION& screenInfo,
|
|
const CursorType cursorType);
|
|
void DoSrvSetCursorColor(SCREEN_INFORMATION& screenInfo,
|
|
const COLORREF cursorColor);
|
|
|
|
void DoSrvAddHyperlink(SCREEN_INFORMATION& screenInfo,
|
|
const std::wstring_view uri,
|
|
const std::wstring_view params);
|
|
|
|
void DoSrvEndHyperlink(SCREEN_INFORMATION& screenInfo);
|
|
|
|
void DoSrvPrivateRefreshWindow(const SCREEN_INFORMATION& screenInfo);
|
|
|
|
[[nodiscard]] HRESULT DoSrvSetConsoleOutputCodePage(const unsigned int codepage);
|
|
void DoSrvGetConsoleOutputCodePage(unsigned int& codepage);
|
|
|
|
[[nodiscard]] NTSTATUS DoSrvPrivateSuppressResizeRepaint();
|
|
|
|
void DoSrvIsConsolePty(bool& isPty);
|
|
|
|
void DoSrvPrivateDeleteLines(const size_t count);
|
|
void DoSrvPrivateInsertLines(const size_t count);
|
|
|
|
void DoSrvPrivateMoveToBottom(SCREEN_INFORMATION& screenInfo);
|
|
|
|
[[nodiscard]] HRESULT DoSrvPrivateGetColorTableEntry(const size_t index, COLORREF& value) noexcept;
|
|
[[nodiscard]] HRESULT DoSrvPrivateSetColorTableEntry(const size_t index, const COLORREF value) noexcept;
|
|
|
|
[[nodiscard]] HRESULT DoSrvPrivateSetDefaultForegroundColor(const COLORREF value) noexcept;
|
|
|
|
[[nodiscard]] HRESULT DoSrvPrivateSetDefaultBackgroundColor(const COLORREF value) noexcept;
|
|
|
|
[[nodiscard]] HRESULT DoSrvPrivateFillRegion(SCREEN_INFORMATION& screenInfo,
|
|
const COORD startPosition,
|
|
const size_t fillLength,
|
|
const wchar_t fillChar,
|
|
const bool standardFillAttrs) noexcept;
|
|
|
|
[[nodiscard]] HRESULT DoSrvPrivateScrollRegion(SCREEN_INFORMATION& screenInfo,
|
|
const SMALL_RECT scrollRect,
|
|
const std::optional<SMALL_RECT> clipRect,
|
|
const COORD destinationOrigin,
|
|
const bool standardFillAttrs) noexcept;
|