-
Notifications
You must be signed in to change notification settings - Fork 695
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixes #2865. Unknown character sequence while resizing terminal. #2951
Fixes #2865. Unknown character sequence while resizing terminal. #2951
Conversation
Thanks. The problem is when I resize the terminal the app doesn't resize. It seem that some method is missing. Can you find what? Maybe |
I added a definition for toggle the use of |
I can't make it work with c#
Untitled.movBut C++ will always print correct size.
|
Your last commit fixes the problem. No more issues. |
Try with this value Edit: |
Now ioctl returns -1, and win32error is 0. |
Do you know why you're having the error before? |
In this situation you still have used |
Before 2411b8a ioctl was enabled but always return empty winsize and somehow it leaded to EntryPointNotFoundException. The correct |
Now I'm confused. You said before |
switch (wch2) { | ||
case 16: | ||
keyModifiers.Shift = true; | ||
break; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may be smart enough, or have a good enough memory to remember what all these integers are, but I'm not.
Where do these codes come from? They're not ASCII codes. What are they?
I'm asking you to please make this code more readable and maintainable while you are in here.
We should always be making code we touch simpler and more readable, even if we understand it ourselves.
I have just spent 10 minutes trying to figure out where 108, 109, ...121 come from. No reader of the code should need to do that! And I still don't have a clue other than what the curses get_wch
docs say: https://invisible-island.net/ncurses/man/curs_get_wch.3x.html (and that wasn't helpful).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Found this:
Seems to imply shift is 56
.
Anyway, I thought the whole point of ncurses was to map things up to the API.
I think there is some sort of termcap setting that will cause ncurses on the mac to surface these using the Curses.Key
defines?
@@ -388,8 +408,6 @@ void ProcessInput () | |||
|
|||
// Special handling for ESC, we want to try to catch ESC+letter to simulate alt-letter as well as Alt-Fkey | |||
if (wch == 27) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As an example, this would be more readable if it were if (wch == (int)Key.Esc)
.
Fixes #2865 - On macOS Ansi escape sequences are send after the terminal resizing but they are corrupted. Thus is needed to restore them correctly. Also this fix includes some keys that aren't handled on macOS if a
Wiindows
numeric keyboard is used, like the Home, End, PgUp, PgDn, etc.... Another issue is that macOS doesn't rely on the curseslines_ptr
andcols_ptr
pointers to return the current size on resizing and now it's needed to useioctl
andresizeterm
to get and set the current size. The better way to wait a Esc or an Ansi escape sequence, is use thenodelay
method. I also added a new scenario to test theTerminal.Gui
doesn't freeze while resizing.Pull Request checklist:
CTRL-K-D
to automatically reformat your files before committing.dotnet test
before commit///
style comments)