mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-15 23:48:15 +08:00
Move the cursor to the input location.
Most CJK users use IME (input method) to type CJK characters. They need the cursor to be at the correct location, not in the bottom right corner. This CL does: * Move the cursor the focus() element. * Hide the cursor (and show it at exit) * Intercept SIGINT to guarantee proper cleanup all the time. This should fix the second issue mentionned on: https://github.com/ArthurSonzogni/FTXUI/issues/2
This commit is contained in:
@@ -44,6 +44,9 @@ class ScreenInteractive : public Screen {
|
||||
std::mutex events_queue_mutex;
|
||||
std::queue<Event> events_queue;
|
||||
std::atomic<bool> quit_ = false;
|
||||
|
||||
std::string set_cursor_position;
|
||||
std::string reset_cursor_position;
|
||||
};
|
||||
|
||||
} // namespace ftxui
|
||||
|
@@ -29,7 +29,7 @@ class Node {
|
||||
// Step 3: Draw this element.
|
||||
virtual void Render(Screen& screen);
|
||||
|
||||
std::vector<std::unique_ptr<Node>> children;
|
||||
std::vector<std::unique_ptr<Node>> children;
|
||||
protected:
|
||||
Requirement requirement_;
|
||||
Box box_;
|
||||
|
@@ -61,10 +61,18 @@ class Screen {
|
||||
void ApplyShader();
|
||||
Box stencil;
|
||||
|
||||
struct Cursor {
|
||||
int x;
|
||||
int y;
|
||||
};
|
||||
Cursor cursor() const { return cursor_; }
|
||||
void SetCursor(Cursor cursor) { cursor_ = cursor; }
|
||||
|
||||
protected:
|
||||
int dimx_;
|
||||
int dimy_;
|
||||
std::vector<std::vector<Pixel>> pixels_;
|
||||
Cursor cursor_;
|
||||
};
|
||||
|
||||
}; // namespace ftxui
|
||||
|
Reference in New Issue
Block a user