Skip to content

Keyboard arrow keys not working for scrolling from STDIN, rather shows keycode of the key pressed #1006

@yedhink

Description

@yedhink

What version of bat are you using?
bat 0.15.0

Describe the bug you encountered:
Using keys to scroll through the long STDIN is emitting keycodes, rather than actually scrolling down. Some terminal details:-

terminal
--------
kitty 0.17.4 created by Kovid Goyal

exports(relevant ones)
---------------------
export BAT_PAGER="less -RF"
export EDITOR="nvim"
export TERMINAL="kitty"

Context

I was trying to pass the stdin from the node/npm package makemehapi to bat.

npx makemehapi print | bat

The content was a lengthy output. Thus i tried scrolling with arrow keys like i usually do. But currently the keycodes of the key pressed is displayed rather than actually scrolling down.

  • Pressing Enter key somehow forwards down the line, but still some junk characters are added
  • cat longFile | bat works just fine. Arrow keys work there.
Content with paging and error - keycodes of arrow keys displayed at bottom

28:23:18_2020-05-18_1366x768

Content with paging and --show-all and error - keycodes of arrow keys displayed at bottom

15:24:18_2020-05-18_1366x768

Things I have tried

  • commented the whole bashrc and error persists
  • tried bat --pager=never still no use
  • tried bat --no-config still no use

...

Describe what you expected to happen?
...
To be able to scroll through the long content using arrow keys or even Page Down/UP keys without having to press ENTER for each line.

How did you install bat?
yay -S bat


Info.sh

system

$ uname -srm
Linux 5.6.13-arch1-1 x86_64

bat

$ bat --version
bat 0.15.0

$ env
BAT_PAGER=less -RF

bat_config

$ cat /home/ikigai/.config/bat/config

--pager="less -RF"

bat_wrapper

No wrapper script for 'bat'.

bat_wrapper_function

No wrapper function for 'bat'.

No wrapper function for 'cat'.

tool

$ less --version
less 551 (PCRE regular expressions)

Full STDOUT of npx makemehapi print

  Create a server which responds to requests to /?name=Handling using a  
  template located at templates/index.html which outputs the following HTML:  
   
     <html>  
         <head><title>Hello Handling</title></head>  
         <body>  
             Hello Handling  
         </body>  
     </html>  
   
 ─────────────────────────────────────────────────────────────────────────────  
  ##HINTS  
   
  This exercise requires you to install the vision module, which is a hapi  
  plugin for rendering templates. You'll need to register the plugin in your  
  code in order to render your templates:  
   
     var Vision = require('vision');  
       
     await server.register(Vision);  
   
  The view key can be used to define the template to be used to generate the  
  response.  
   
     handler: {  
         view: "index.html"  
     }  
   
  server.views() is the server method that we use to configure the templates  
  used on our server. This method receives a configuration object in which  
  we can set different engines based on file extension. This object can also  
  set a directory path for your templates.  
   
     server.views({  
         engines: {  
             html: require('handlebars')  
         },  
         path: Path.join(__dirname, 'templates')  
     });  
   
  In this exercise, we'll be using Handlebars. To install handlebars:  
   
     npm install handlebars  
   
  With Handlebars templates, you can render a variable directly in HTML by  
  surrounding the variable with curly braces, e.g. {{foo}}.  
   
  The template receives some information from the request. For example, the  
  query parameters that were passed in via the URL are available in the  
  query object. These parameters can then be used in the template.  Query  
  params get automatically parsed and aren't declared in the route path.  
   
     <div>{{query.paramName}}</div>  
   

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions