Skip to content
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 stopped working after 9ea90038ef19cb264ea907177c2613b6b3a16685 #549

Open
trofi opened this issue Jul 29, 2024 · 4 comments
Open

PageUp stopped working after 9ea90038ef19cb264ea907177c2613b6b3a16685 #549

trofi opened this issue Jul 29, 2024 · 4 comments

Comments

@trofi
Copy link

trofi commented Jul 29, 2024

After a less update in my distribution I noticed that PageUp / PageDown keys stopped working in less. The bisect says that it stopped working after 9ea9003 commit.

Reverting the commit on top of master also fixes PageUp / PageDown keys for me:

--- a/decode.c
+++ b/decode.c
@@ -699,9 +699,7 @@ static int cmd_search(constant char *cmd, constant char *table, constant char *e
                         * but not the end of the string in the command table.
                         * The user's command is incomplete.
                         */
-                       if (a == A_INVALID)
-                               a = A_PREFIX;
-                       q = cmd-1;
+                       return A_PREFIX;
                } else
                {
                        /*

The system is linux with alacritty terminal.

@gwsw
Copy link
Owner

gwsw commented Jul 29, 2024

I am unable to reproduce this. I installed alacritty and ran it, and then ran "less main.c" and pressed PgDn and it scrolled down as expected. Do you have a lesskey file? If so, does it work if you temporarily remove that file? If removing your lesskey file fixes the issue, please post a copy of your lesskey file here.

@trofi
Copy link
Author

trofi commented Jul 29, 2024

Oh, yes it's my ancient ~/.lesskey. Removing it restores Page Down for me in both alacritty and xterm. Is it invalid in some way? Full contents:

$ cat .lesskey 

#command
\r        forw-line
\n        forw-line
e         forw-line
j         forw-line
\kd       forw-line
^E        forw-line
^N        forw-line
k         back-line
y         back-line
^Y        back-line
^K        back-line
^P        back-line
J         forw-line-force
K         back-line-force
Y         back-line-force
d         forw-scroll
^D        forw-scroll
u         back-scroll
^U        back-scroll
\40       forw-screen
f         forw-screen
^F        forw-screen
^V        forw-screen
\kD       forw-screen
b         back-screen
^B        back-screen
\ev       back-screen
\kU       back-screen
z         forw-window
w         back-window
\e\40     forw-screen-force
F         forw-forever
R         repaint-flush
r         repaint
^R        repaint
^L        repaint
\eu       undo-hilite
g         goto-line
\kh       goto-line
<         goto-line
\e<       goto-line
p         percent
%         percent
\e[       left-scroll
\e]       right-scroll
\e(       left-scroll
\e)       right-scroll
{         forw-bracket {}
}         back-bracket {}
(         forw-bracket ()
)         back-bracket ()
[         forw-bracket []
]         back-bracket []
\e^F      forw-bracket
\e^B      back-bracket
G         goto-end
\e>       goto-end
>         goto-end
\ke       goto-end
=         status
^G        status
:f        status
/         forw-search
?         back-search
\e/       forw-search *
\e?       back-search *
n         repeat-search
\en       repeat-search-all
N         reverse-search
\eN       reverse-search-all
m         set-mark
'         goto-mark
^X^X      goto-mark
E         examine
:e        examine
^X^V      examine
:n        next-file
:p        prev-file
t         next-tag
T         prev-tag
:x        index-file
:d        remove-file
-         toggle-option
:t        toggle-option t
s         toggle-option o
_         display-option
|         pipe
v         visual
!         shell
+         firstcmd
H         help
h         help
V         version
0         digit
1         digit
2         digit
3         digit
4         digit
5         digit
6         digit
7         digit
8         digit
9         digit
q         quit
Q         quit
:q        quit
:Q        quit
ZZ        quit
#home & end ;]
\eOH      goto-line
\eOF      goto-end


#line-edit
\t        forw-complete
\17       back-complete
\e\t      back-complete
^L        expand
^V        literal
^A        literal
\el       right
\kr       right
\eh       left
\kl       left
\eb       word-left
\e\kl     word-left
\ew       word-right
\e\kr     word-right
\ei       insert
\ex       delete
\kx       delete
\eX       word-delete
\ekx      word-delete
\e\b      word-backspace
\e0       home
\kh       home
\e$       end
\ke       end
\ek       up
\ku       up
\ej       down

#env
LESS = -isR

@gwsw
Copy link
Owner

gwsw commented Jul 29, 2024

The problem is caused by this line

\e[       left-scroll

On alacritty (and many terminals) PgUp sends "\e[5~". Your lesskey entry is making less think that when you press PgUp you're sending a left-scroll command followed by "5~".

I don't yet fully understand the details of what's happening, but removing that line from lesskey file makes PgUp and PgDn work. I'll keep this issue open while I investigate it.

@trofi
Copy link
Author

trofi commented Jul 29, 2024

Aha. Yeah, one key being a full prefix of another sounds problematic. I deleted local ~/.lesskey in favour of the default.

Thank you!

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

No branches or pull requests

2 participants