mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 22:48:11 +00:00
LibLine: Implement support for C-V<key>
This commit adds support for inserting in a "verbatim" mode where a single uninterpreted key is appended to the buffer. As this allows the user to input control characters, all control characters except \n (^M) are rendered in their caret form, with reverse video (SGR 7) applied to it. To not break cursor movement, the concept of "masked" characters is introduced to the StringMetrics interface, which can be mostly ignored by the rest of the system. It should be noted that unlike some other line editing libraries, LibLine does _not_ render a hard tab as a tab, but rather as '^I', which greatly simplifies cursor handling.
This commit is contained in:
parent
44305ea214
commit
43199e5613
5 changed files with 100 additions and 42 deletions
|
@ -1,5 +1,6 @@
|
|||
/*
|
||||
* Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
|
||||
* Copyright (c) 2021, the SerenityOS developers.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
|
@ -261,7 +262,7 @@ private:
|
|||
Title = 9,
|
||||
};
|
||||
|
||||
static VTState actual_rendered_string_length_step(StringMetrics&, size_t& length, u32, u32, VTState);
|
||||
static VTState actual_rendered_string_length_step(StringMetrics&, size_t, StringMetrics::LineMetrics& current_line, u32, u32, VTState);
|
||||
|
||||
enum LoopExitCode {
|
||||
Exit = 0,
|
||||
|
@ -456,6 +457,7 @@ private:
|
|||
|
||||
enum class InputState {
|
||||
Free,
|
||||
Verbatim,
|
||||
GotEscape,
|
||||
CSIExpectParameter,
|
||||
CSIExpectIntermediate,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue