mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-15 23:48:15 +08:00
Featre: Support ctrl+arrow in input. (#494)
CTRL+LEFT: Move the cursor to the beginning of the word. CTRL+RIGHT: Move the cursor to the beginning of the word. This was requested by: https://github.com/ArthurSonzogni/FTXUI/issues/490
This commit is contained in:
@@ -38,6 +38,11 @@ struct Event {
|
||||
static const Event ArrowUp;
|
||||
static const Event ArrowDown;
|
||||
|
||||
static const Event ArrowLeftCtrl;
|
||||
static const Event ArrowRightCtrl;
|
||||
static const Event ArrowUpCtrl;
|
||||
static const Event ArrowDownCtrl;
|
||||
|
||||
// --- Other ---
|
||||
static const Event Backspace;
|
||||
static const Event Delete;
|
||||
|
@@ -26,6 +26,33 @@ int GlyphPosition(const std::string& input,
|
||||
// Returns the number of glyphs in |input|.
|
||||
int GlyphCount(const std::string& input);
|
||||
|
||||
// Properties from:
|
||||
// https://www.unicode.org/Public/UCD/latest/ucd/auxiliary/WordBreakProperty.txt
|
||||
enum class WordBreakProperty {
|
||||
ALetter,
|
||||
CR,
|
||||
Double_Quote,
|
||||
Extend,
|
||||
ExtendNumLet,
|
||||
Format,
|
||||
Hebrew_Letter,
|
||||
Katakana,
|
||||
LF,
|
||||
MidLetter,
|
||||
MidNum,
|
||||
MidNumLet,
|
||||
Newline,
|
||||
Numeric,
|
||||
Regional_Indicator,
|
||||
Single_Quote,
|
||||
WSegSpace,
|
||||
ZWJ,
|
||||
};
|
||||
std::vector<WordBreakProperty> Utf8ToWordBreakProperty(
|
||||
const std::string& input);
|
||||
|
||||
bool IsWordBreakingCharacter(const std::string& input, size_t glyph_index);
|
||||
|
||||
// Map every cells drawn by |input| to their corresponding Glyphs. Half-size
|
||||
// Glyphs takes one cell, full-size Glyphs take two cells.
|
||||
std::vector<int> CellToGlyphIndex(const std::string& input);
|
||||
|
Reference in New Issue
Block a user