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

pageup and pagedown keys don't work #8

Closed
peterjschroeder opened this Issue Aug 22, 2017 · 8 comments

Comments

Projects
None yet
2 participants
@peterjschroeder

peterjschroeder commented Aug 22, 2017

For some reason these keys don't work. I'm using the current git on Debian Unstable in urxvt. I tried in xterm, still doesn't work. They should jump down some lines.

@larrykollar

This comment has been minimized.

Show comment
Hide comment
@larrykollar

larrykollar Aug 30, 2017

Owner

Confirmed in Cygwin as well. However, in Cygwin, the scroll wheel acts like up/down arrow, which is kind of cool. My Mac's Bluetooth keyboard doesn't have PgUp/PgDn keys. I suspect it has to do with Tines inheriting hnb's hard-coded assumption that it's living in a Latin-1 environment while the rest of the world has moved on to UTF-8. Making Tines UTF-8 friendly is a long-term fix I have planned, and the fix for this particular issue should come along for the ride.

Try these two things to verify:

  • Tines has an undocumented feature called "keygrab," invoked by running tines --ui=keygrab — it returns the keypress and its associated value until you press q to quit. Right now, curses has to pass Tines a single character for it to recognize a keypress. If you see some funky multiline stuff instead of npage and ppage, the keys aren't getting interpreted properly.
  • Set your terminal environment to Latin-1, ISO-8859-1, or even ASCII, and see if Tines works better (the LANG environment variable). On my Mac, LANG's definition is en_US.UTF-8

As a workaround, you could bind a control or option key to pageup and pagedown in your RC file. I've been toying with the idea of setting up a vi-based set of keybindings, for example. Now, if keygrab mode returns values for PgDn/PgUp you're not otherwise using, you could map those values and have at least a fix for your own use. But as I said above, I think the real solution is making Tines UTF-8 friendly.

Owner

larrykollar commented Aug 30, 2017

Confirmed in Cygwin as well. However, in Cygwin, the scroll wheel acts like up/down arrow, which is kind of cool. My Mac's Bluetooth keyboard doesn't have PgUp/PgDn keys. I suspect it has to do with Tines inheriting hnb's hard-coded assumption that it's living in a Latin-1 environment while the rest of the world has moved on to UTF-8. Making Tines UTF-8 friendly is a long-term fix I have planned, and the fix for this particular issue should come along for the ride.

Try these two things to verify:

  • Tines has an undocumented feature called "keygrab," invoked by running tines --ui=keygrab — it returns the keypress and its associated value until you press q to quit. Right now, curses has to pass Tines a single character for it to recognize a keypress. If you see some funky multiline stuff instead of npage and ppage, the keys aren't getting interpreted properly.
  • Set your terminal environment to Latin-1, ISO-8859-1, or even ASCII, and see if Tines works better (the LANG environment variable). On my Mac, LANG's definition is en_US.UTF-8

As a workaround, you could bind a control or option key to pageup and pagedown in your RC file. I've been toying with the idea of setting up a vi-based set of keybindings, for example. Now, if keygrab mode returns values for PgDn/PgUp you're not otherwise using, you could map those values and have at least a fix for your own use. But as I said above, I think the real solution is making Tines UTF-8 friendly.

@peterjschroeder

This comment has been minimized.

Show comment
Hide comment
@peterjschroeder

peterjschroeder Aug 30, 2017

Keygrab shows [339] [S] for PgUp and [338] [R] for PgDown. 338 and 339 are the correct values.

If you hit PgUp or PgDown while editing an entry it says.

No action assigned to 'npage'(338d) in nodeedit-mode

Which means its reading it right.

So the problem seems to be in the non-nodeedit-mode. Probably the actual npage and ppage functions are borked.

Changing the LANG environment variable to the ones you suggested have no effect.

peterjschroeder commented Aug 30, 2017

Keygrab shows [339] [S] for PgUp and [338] [R] for PgDown. 338 and 339 are the correct values.

If you hit PgUp or PgDown while editing an entry it says.

No action assigned to 'npage'(338d) in nodeedit-mode

Which means its reading it right.

So the problem seems to be in the non-nodeedit-mode. Probably the actual npage and ppage functions are borked.

Changing the LANG environment variable to the ones you suggested have no effect.

@larrykollar

This comment has been minimized.

Show comment
Hide comment
@larrykollar

larrykollar Aug 30, 2017

Owner

I think I found the problem.

In evilloop.c, starting at line 205, is the code that handles pagedown & pageup. It moves the number of lines specified by the integer variables tines_nodes_down and tines_nodes_up, respectively—but their values are set to 0 and never changed anywhere in the code that I can find.

I can fix that by setting them to (LINES-2), reading the height from curses. I might not be able to get to it tonight, but I should be able to tomorrow. I kind of think hnb never had that working, it's not code I've messed with much other than changing a couple variable names.

Owner

larrykollar commented Aug 30, 2017

I think I found the problem.

In evilloop.c, starting at line 205, is the code that handles pagedown & pageup. It moves the number of lines specified by the integer variables tines_nodes_down and tines_nodes_up, respectively—but their values are set to 0 and never changed anywhere in the code that I can find.

I can fix that by setting them to (LINES-2), reading the height from curses. I might not be able to get to it tonight, but I should be able to tomorrow. I kind of think hnb never had that working, it's not code I've messed with much other than changing a couple variable names.

@peterjschroeder

This comment has been minimized.

Show comment
Hide comment
@peterjschroeder

peterjschroeder Aug 30, 2017

I'll try in a few hours. The page keys work in both vanilla hnb and lhnb.

EDIT: I'll wait on your fix, i misread that as just needing to change variables. I grepped all instanced of pageup and compared to lhnb. Everything looks the same.

peterjschroeder commented Aug 30, 2017

I'll try in a few hours. The page keys work in both vanilla hnb and lhnb.

EDIT: I'll wait on your fix, i misread that as just needing to change variables. I grepped all instanced of pageup and compared to lhnb. Everything looks the same.

@larrykollar

This comment has been minimized.

Show comment
Hide comment
@larrykollar

larrykollar Aug 31, 2017

Owner

Try this patch. It goes to the top or bottom of the current level you're in, which might be useful if you've done "Expand All."

diff --git a/src/evilloop.c b/src/evilloop.c
index 4cdd64b..ecda84e 100644
--- a/src/evilloop.c
+++ b/src/evilloop.c
@@ -207,6 +207,7 @@ Node *evilloop (Node *pos)
                                        inputbuf[0] = 0;
                                        {
                                                int n;
+                                               tines_nodes_down = LINES - 2;

                                                for (n = 0; n < tines_nodes_down; n++)
                                                        if (node_down (pos)) {
@@ -219,6 +220,7 @@ Node *evilloop (Node *pos)
                                        inputbuf[0] = 0;
                                        {
                                                int n;
+                                               tines_nodes_up = LINES - 2;

                                                for (n = 0; n < tines_nodes_up; n++)
                                                        if (node_up (pos))

Give it a try and see if it works for you. BTW, my Mac keyboard seems to recognize Fn+up/down as PageUp/PageDown.

Owner

larrykollar commented Aug 31, 2017

Try this patch. It goes to the top or bottom of the current level you're in, which might be useful if you've done "Expand All."

diff --git a/src/evilloop.c b/src/evilloop.c
index 4cdd64b..ecda84e 100644
--- a/src/evilloop.c
+++ b/src/evilloop.c
@@ -207,6 +207,7 @@ Node *evilloop (Node *pos)
                                        inputbuf[0] = 0;
                                        {
                                                int n;
+                                               tines_nodes_down = LINES - 2;

                                                for (n = 0; n < tines_nodes_down; n++)
                                                        if (node_down (pos)) {
@@ -219,6 +220,7 @@ Node *evilloop (Node *pos)
                                        inputbuf[0] = 0;
                                        {
                                                int n;
+                                               tines_nodes_up = LINES - 2;

                                                for (n = 0; n < tines_nodes_up; n++)
                                                        if (node_up (pos))

Give it a try and see if it works for you. BTW, my Mac keyboard seems to recognize Fn+up/down as PageUp/PageDown.

@peterjschroeder

This comment has been minimized.

Show comment
Hide comment
@peterjschroeder

peterjschroeder Aug 31, 2017

Yep, that works. Thank you.

Maybe be a good idea to leave a comment in the patch that it's a temporary fix. Because something, somewhere was changed that affected it.

No go on the Fn.

peterjschroeder commented Aug 31, 2017

Yep, that works. Thank you.

Maybe be a good idea to leave a comment in the patch that it's a temporary fix. Because something, somewhere was changed that affected it.

No go on the Fn.

@peterjschroeder

This comment has been minimized.

Show comment
Hide comment
@peterjschroeder

peterjschroeder Aug 31, 2017

I did notice that tines_nodes_up and tines_nodes_down are still named hnb_nodes in ui_draw. I changed all the instances as I figured the value wasn't being passed, but no go.

EDIT: Yep, something is definitely funked up. If you arrow down 1 past the last entry, it collapses the node. That's not how it used to work. It used to just stop.

peterjschroeder commented Aug 31, 2017

I did notice that tines_nodes_up and tines_nodes_down are still named hnb_nodes in ui_draw. I changed all the instances as I figured the value wasn't being passed, but no go.

EDIT: Yep, something is definitely funked up. If you arrow down 1 past the last entry, it collapses the node. That's not how it used to work. It used to just stop.

@larrykollar

This comment has been minimized.

Show comment
Hide comment
@larrykollar

larrykollar Oct 15, 2017

Owner

I made the correct fix (it was misnamed variables in ui_draw.c).

The "arrow down = keeps going" thing can be fixed by setting forced_down 0 and forced_up 0 in .tinesrc. I changed the defaults to 1.

Owner

larrykollar commented Oct 15, 2017

I made the correct fix (it was misnamed variables in ui_draw.c).

The "arrow down = keeps going" thing can be fixed by setting forced_down 0 and forced_up 0 in .tinesrc. I changed the defaults to 1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment