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

Line-based movement matches line numbers as displayed in output, not numbers from original file #2395

Open
JarredAllen opened this issue Nov 4, 2022 · 0 comments
Labels
bug Something isn't working

Comments

@JarredAllen
Copy link

JarredAllen commented Nov 4, 2022

What steps will reproduce the bug?

  1. Open up a file with a lot of lines too long to fit in the width of your terminal
  2. Try to use movement commands based on line numbers (e.g. 1000G or 500j)

What happens?

The movement appears to be based on line numbers in the displayed output, not line numbers of the original file. In the case of the big file I am looking at right now that caused me to notice this behavior, running 1000G took me to line 678, and then 500j took me from there to line 1105.

What did you expect to happen instead?

I expected 1000G to take me to the 1000th line in the original file, and for 500j to move me down 500 lines from the original file (e.g. from line 1000 to 1500).

I'm not sure if there's anything that could be done here, or if it would require work done in the pager (I'm not familiar with the inner workings of less), and I also don't know how hard it would be to make a new pager that supports this if less can't, but I thought I'd document here that the behavior isn't what I expected in a way that makes it harder for me to use this tool on long files with long lines.

How did you install bat?

Through cargo install bat


bat version and environment

Software version

bat 0.22.1

Operating system

macOS 13.0 (Darwin 22.1.0)

Command-line

bat --diagnostic bigfile.txt

Environment variables

SHELL=/bin/bash 
PAGER=<not set>                                   
LESS=<not set>                                                                                                                                                                                             
LANG=en_US.UTF-8                                  
LC_ALL=<not set>           
BAT_PAGER=<not set>                                                                                  
BAT_CACHE_PATH=<not set>                                                                                                                                                                                   
BAT_CONFIG_PATH=<not set>                                                                            
BAT_OPTS=<not set>                           
BAT_STYLE=<not set>                               
BAT_TABS=<not set>                  
BAT_THEME=<not set>
XDG_CONFIG_HOME=<not set>    
XDG_CACHE_HOME=<not set>
COLORTERM=<not set>
NO_COLOR=<not set>
MANPAGER=<not set>

System Config file

Could not read contents of '/etc/bat/config': No such file or directory (os error 2).

Config file

Could not read contents of '~/.config/bat/config': No such file or directory (os error 2).

Custom assets metadata

Could not read contents of '~/.cache/bat/metadata.yaml': No such file or directory (os error 2).

Custom assets

'~/.cache/bat' not found

Compile time information

  • Profile: release
  • Target triple: aarch64-apple-darwin
  • Family: unix
  • OS: macos
  • Architecture: aarch64
  • Pointer width: 64
  • Endian: little
  • CPU features: aes,crc,dit,dotprod,dpb,dpb2,fcma,fhm,flagm,fp16,frintts,jsconv,lor,lse,neon,paca,pacg,pan,pmuv3,ras,rcpc,rcpc2,rdm,sb,sha2,sha3,ssbs,vh
  • Host: aarch64-apple-darwin

Less version

> less --version 
less 581.2 (POSIX regular expressions)
Copyright (C) 1984-2021  Mark Nudelman

less comes with NO WARRANTY, to the extent permitted by law.
For information about the terms of redistribution,
see the file named README in the less distribution.
Home page: https://greenwoodsoftware.com/less

(note: I replaced my home path with ~ every time it showed up, also this isn't specific to one file, but any file with many long lines).

@JarredAllen JarredAllen added the bug Something isn't working label Nov 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant