Method for reading user input #8

Closed
opened 2022-04-07 14:46:52 +02:00 by christian · 1 comment
Owner

At the moment you can write any input to the PTY client with writeToClient(). So a program can process the user input itself and decide

Implement a method reading user input from the PTY window with getch() (with a tiny string buffer) or get_wch(). The buffer would be for pasted input and because one UTF-8 character can consist of multiple 8-bit characters and getch() only reads one of those 8-bit characters. get_wch() could read one UTF-8 at once — but it seems to much of a hassle.

Put reading user input in a thread?

Together with reading output from the PTY client? (i. e. readFromPtyClientThreadMethod())

How to deal with focus? If reading user input is dealt with by a separate thread or method. There must be a special key or key combination (configured by the application) giving up the keyboard focus for other windows in the ncurses application to grab.

At the moment you can write any input to the PTY client with `writeToClient()`. So a program can process the user input itself and decide Implement a method reading user input from the PTY window with `getch()` (with a tiny string buffer) or `get_wch()`. The buffer would be for pasted input and because one UTF-8 character can consist of multiple 8-bit characters and `getch()` only reads one of those 8-bit characters. `get_wch()` could read one UTF-8 at once — but it seems to much of a hassle. Put reading user input in a thread? Together with reading output from the PTY client? (i. e. `readFromPtyClientThreadMethod()`) How to deal with focus? If reading user input is dealt with by a separate thread or method. There must be a special key or key combination (configured by the application) giving up the keyboard focus for other windows in the ncurses application to grab.
christian referenced this issue from a commit 2022-04-13 10:48:23 +02:00
Author
Owner

Decided to use get_wch() for reading user input. It seemed easier to interface with libvterm that way.

But in general, this feature does not appear to make sense for the time being. It's better for the application to receive the user's input and redirect it to the terminal window if it has the focus. The application knows better and not always the focus shifts on a key combination pressed, but on another event not connected to the user input.

Decided to use `get_wch()` for reading user input. It seemed easier to interface with libvterm that way. But in general, this feature does not appear to make sense for the time being. It's better for the application to receive the user's input and redirect it to the terminal window if it has the focus. The application knows better and not always the focus shifts on a key combination pressed, but on another event not connected to the user input.
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: christian/kNCurses#8
No description provided.