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:
ArthurSonzogni
2019-06-29 18:52:58 +02:00
parent 38df095b4a
commit 86c3b60a6f
6 changed files with 85 additions and 30 deletions

View File

@@ -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