mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-15 23:48:15 +08:00
Bugfix Input use std::string (#279)
Use std::string by default for the implementation of FTXUI's input component. Along the way: - Give a correct implementation for fullwidth characters. - Add tests - Modify the way the cursor is drawn.
This commit is contained in:
@@ -14,7 +14,20 @@ std::wstring to_wstring(T s) {
|
||||
}
|
||||
|
||||
int string_width(const std::string&);
|
||||
// Split the string into a its glyphs. An empty one is inserted ater fullwidth
|
||||
// ones.
|
||||
std::vector<std::string> Utf8ToGlyphs(const std::string& input);
|
||||
// If |input| was an array of glyphs, this returns the number of char to eat
|
||||
// before reaching the glyph at index |glyph_index|.
|
||||
int GlyphPosition(const std::string& input,
|
||||
size_t glyph_index,
|
||||
size_t start = 0);
|
||||
// Returns the number of glyphs in |input|.
|
||||
int GlyphCount(const std::string& input);
|
||||
|
||||
// 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);
|
||||
|
||||
} // namespace ftxui
|
||||
|
||||
|
Reference in New Issue
Block a user