mirror of
https://github.com/microsoft/terminal.git
synced 2026-02-04 05:35:20 +00:00
Auto prompt detection on enter
This commit is contained in:
@@ -25,6 +25,9 @@ namespace Microsoft.Terminal.Core
|
||||
|
||||
Windows.Foundation.IReference<Microsoft.Terminal.Core.Color> TabColor;
|
||||
Windows.Foundation.IReference<Microsoft.Terminal.Core.Color> StartingTabColor;
|
||||
|
||||
Boolean AutoMarkPrompts;
|
||||
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -48,7 +48,8 @@ Terminal::Terminal() :
|
||||
_selection{ std::nullopt },
|
||||
_taskbarState{ 0 },
|
||||
_taskbarProgress{ 0 },
|
||||
_trimBlockSelection{ false }
|
||||
_trimBlockSelection{ false },
|
||||
_autoMarkPrompts{ false }
|
||||
{
|
||||
auto dispatch = std::make_unique<TerminalDispatch>(*this);
|
||||
auto engine = std::make_unique<OutputStateMachineEngine>(std::move(dispatch));
|
||||
@@ -121,6 +122,7 @@ void Terminal::UpdateSettings(ICoreSettings settings)
|
||||
_suppressApplicationTitle = settings.SuppressApplicationTitle();
|
||||
_startingTitle = settings.StartingTitle();
|
||||
_trimBlockSelection = settings.TrimBlockSelection();
|
||||
_autoMarkPrompts = settings.AutoMarkPrompts();
|
||||
|
||||
_terminalInput->ForceDisableWin32InputMode(settings.ForceVTInput());
|
||||
|
||||
@@ -676,6 +678,14 @@ bool Terminal::SendKeyEvent(const WORD vkey,
|
||||
return false;
|
||||
}
|
||||
|
||||
//if (_autoMarkPrompts && vkey == VK_RETURN && !_inAltBuffer())
|
||||
//{
|
||||
// DispatchTypes::ScrollMark mark;
|
||||
// mark.category = DispatchTypes::MarkCategory::Prompt;
|
||||
// mark.color = til::color(255, 255, 255); // should this be configurable?
|
||||
// AddMark(mark);
|
||||
//}
|
||||
|
||||
KeyEvent keyEv{ keyDown, 1, vkey, sc, ch, states.Value() };
|
||||
return _terminalInput->HandleKey(&keyEv);
|
||||
}
|
||||
@@ -730,6 +740,15 @@ bool Terminal::SendCharEvent(const wchar_t ch, const WORD scanCode, const Contro
|
||||
vkey = _VirtualKeyFromCharacter(ch);
|
||||
}
|
||||
|
||||
|
||||
if (_autoMarkPrompts && vkey == VK_RETURN && !_inAltBuffer())
|
||||
{
|
||||
DispatchTypes::ScrollMark mark;
|
||||
mark.category = DispatchTypes::MarkCategory::Prompt;
|
||||
mark.color = til::color(255, 255, 255); // should this be configurable?
|
||||
AddMark(mark);
|
||||
}
|
||||
|
||||
// Unfortunately, the UI doesn't give us both a character down and a
|
||||
// character up event, only a character received event. So fake sending both
|
||||
// to the terminal input translator. Unless it's in win32-input-mode, it'll
|
||||
|
||||
@@ -304,6 +304,7 @@ private:
|
||||
bool _suppressApplicationTitle;
|
||||
bool _bracketedPasteMode;
|
||||
bool _trimBlockSelection;
|
||||
bool _autoMarkPrompts;
|
||||
|
||||
size_t _taskbarState;
|
||||
size_t _taskbarProgress;
|
||||
|
||||
@@ -76,7 +76,8 @@ Author(s):
|
||||
X(Model::BellStyle, BellStyle, "bellStyle", BellStyle::Audible) \
|
||||
X(bool, UseAtlasEngine, "experimental.useAtlasEngine", false) \
|
||||
X(Windows::Foundation::Collections::IVector<winrt::hstring>, BellSound, "bellSound", nullptr) \
|
||||
X(bool, Elevate, "elevate", false)
|
||||
X(bool, Elevate, "elevate", false) \
|
||||
X(bool, AutoMarkPrompts, "experimental.autoMarkPrompts", false)
|
||||
|
||||
// Intentionally omitted Profile settings:
|
||||
// * Name
|
||||
|
||||
@@ -83,5 +83,6 @@ namespace Microsoft.Terminal.Settings.Model
|
||||
INHERITABLE_PROFILE_SETTING(Windows.Foundation.Collections.IVector<String>, BellSound);
|
||||
|
||||
INHERITABLE_PROFILE_SETTING(Boolean, Elevate);
|
||||
INHERITABLE_PROFILE_SETTING(Boolean, AutoMarkPrompts);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -265,6 +265,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
}
|
||||
|
||||
_Elevate = profile.Elevate();
|
||||
_AutoMarkPrompts = profile.AutoMarkPrompts();
|
||||
}
|
||||
|
||||
// Method Description:
|
||||
|
||||
@@ -154,6 +154,8 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
|
||||
|
||||
INHERITABLE_SETTING(Model::TerminalSettings, bool, Elevate, false);
|
||||
|
||||
INHERITABLE_SETTING(Model::TerminalSettings, bool, AutoMarkPrompts, false);
|
||||
|
||||
private:
|
||||
std::optional<std::array<Microsoft::Terminal::Core::Color, COLOR_TABLE_SIZE>> _ColorTable;
|
||||
gsl::span<Microsoft::Terminal::Core::Color> _getColorTableImpl();
|
||||
|
||||
@@ -45,7 +45,8 @@
|
||||
X(bool, SuppressApplicationTitle) \
|
||||
X(bool, ForceVTInput, false) \
|
||||
X(winrt::hstring, StartingTitle) \
|
||||
X(bool, DetectURLs, true)
|
||||
X(bool, DetectURLs, true) \
|
||||
X(bool, AutoMarkPrompts)
|
||||
|
||||
// --------------------------- Control Settings ---------------------------
|
||||
// All of these settings are defined in IControlSettings.
|
||||
|
||||
Reference in New Issue
Block a user