1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-30 21:38:11 +00:00
serenity/Userland/Applications/TerminalSettings/MainWidget.h
Ali Mohammad Pur 54ab6fe5b9 LibVT+Everywhere: Introduce 'automarks' and 'clear previous command'
Automarks are similar to bookmarks placed by the terminal, allowing the
user to selectively remove a single command and its output from the
terminal scrollback.
This commit implements a single way to add marks: automatically placing
them when the shell becomes interactive.

To make sure the shell behaves correctly after its expected prompt
position changes, the terminal layer forces a resize event to be passed
to the shell on such (possibly) partial clears; this also has the nice
side effect of fixing the disappearing prompt on the preexisting "clear
including history" action: Fixes #4192.
2024-02-07 00:43:11 +01:00

44 lines
1.5 KiB
C++

/*
* Copyright (c) 2018-2021, the SerenityOS developers.
*
* SPDX-License-Identifier: BSD-2-Clause
*/
#pragma once
#include <LibGUI/Button.h>
#include <LibGUI/CheckBox.h>
#include <LibGUI/ComboBox.h>
#include <LibGUI/SettingsWindow.h>
#include <LibGUI/TextEditor.h>
#include <LibVT/TerminalWidget.h>
namespace TerminalSettings {
class MainWidget final : public GUI::SettingsWindow::Tab {
C_OBJECT_ABSTRACT(TerminalSettingsMainWidget)
public:
static ErrorOr<NonnullRefPtr<MainWidget>> create();
virtual void apply_settings() override;
virtual void cancel_settings() override;
private:
static ErrorOr<NonnullRefPtr<MainWidget>> try_create();
MainWidget() = default;
ErrorOr<void> setup();
void write_back_settings() const;
static VT::TerminalWidget::BellMode parse_bell(StringView bell_string);
static VT::TerminalWidget::AutoMarkMode parse_automark_mode(StringView automark_mode);
static ByteString stringify_bell(VT::TerminalWidget::BellMode bell_mode);
static ByteString stringify_automark_mode(VT::TerminalWidget::AutoMarkMode automark_mode);
VT::TerminalWidget::BellMode m_bell_mode { VT::TerminalWidget::BellMode::Disabled };
VT::TerminalWidget::AutoMarkMode m_automark_mode { VT::TerminalWidget::AutoMarkMode::MarkInteractiveShellPrompt };
bool m_confirm_close { true };
VT::TerminalWidget::BellMode m_original_bell_mode;
VT::TerminalWidget::AutoMarkMode m_original_automark_mode;
bool m_orignal_confirm_close { true };
};
}