这是indexloc提供的服务,不要输入任何密码
Skip to content

Added support for pageup/pagedown using Fn-Up and Fn-Dn key combos on… #783

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

Closed
wants to merge 1 commit into from

Conversation

zevv
Copy link
Contributor

@zevv zevv commented Jul 24, 2018

This fixes issue #731

@tomty89
Copy link
Contributor

tomty89 commented Jul 24, 2018

You only fixed half of the OP. Fn+Left/Right were expected to be Home/End respectively.

Though I am not sure if it's really our problem to fix anyway. While the modifications might sound sensible, I don't know if they are universal enough that it's fine to hard code them in the app...

@zevv
Copy link
Contributor Author

zevv commented Jul 24, 2018 via email

@Razumihin
Copy link

I feel like there are quite a many Gemini PDA users that are at the same time Termux users, me included, that are pretty frustrated by the pgup/pgdown issue that this fixes and thought that it might make a difference. It might not be ideal way to fix this but sadly Android is the cause of that some text editors have made this functionality in the way that Zevv proposes.

Regards,

Sami

@zevv
Copy link
Contributor Author

zevv commented Jul 25, 2018

I just added support for Home and End and proper handling of modifier keys on all keys.

@zevv zevv force-pushed the hardware-pgup-pgdown branch 3 times, most recently from 4c8cf13 to 03168fa Compare July 25, 2018 17:08
case KEYCODE_DPAD_RIGHT:
return (keyMode == 0) ? (cursorApp ? "\033OC" : "\033[C") : transformForModifiers("\033[1", keyMode, 'C');
if((keyMode & KEYMOD_FUNCTION) != 0) {
return transformForModifiers("\033[1", keyMode, 'F');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know if you need the 1 when Ctrl/Alt/Shift is involved but when neither of them is, it will return \033[1F, which is wrong?

case KEYCODE_DPAD_LEFT:
return (keyMode == 0) ? (cursorApp ? "\033OD" : "\033[D") : transformForModifiers("\033[1", keyMode, 'D');
if((keyMode & KEYMOD_FUNCTION) != 0) {
return transformForModifiers("\033[1", keyMode, 'H');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

…ard, Fixes termux#731.

  Fn+Left  -> Home
  Fn+Right -> End
  Fn+Up    -> Page Up
  Fn+Down  -> Page Down
@zevv zevv force-pushed the hardware-pgup-pgdown branch from 03168fa to 50fe003 Compare July 25, 2018 17:52
@zevv
Copy link
Contributor Author

zevv commented Jul 25, 2018 via email

@Konehaltia
Copy link

I think I've found the reason why these combinations don't work in Termux.

When there's a key event, Termux checks if it has any Ctrl/Alt/Shift modifiers. It doesn't check other modifiers, like Function. This causes Termux to mistake Fn+Up for Up, and handle it as such.

If the bug is fixed so that Termux correctly tells Android it has no idea what this Fn+Up combination is, Android will then check if the keyboard config defines a fallback key. In case of Gemini, the fallback is Page Up. So Android gives Termux a Page Up event, which Termux already knows how to handle, and everything works.

See my longer explanation: #731 (comment)

@fornwall
Copy link
Member

fornwall commented Aug 1, 2018

Closed in favour of #794.

@fornwall fornwall closed this Aug 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants