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

Allow indexing from end #2517

Open
XtremeOwnageDotCom opened this issue Oct 24, 2024 · 1 comment
Open

Allow indexing from end #2517

XtremeOwnageDotCom opened this issue Oct 24, 2024 · 1 comment
Labels
S: triage Issue needs triage. T: feature Feature.

Comments

@XtremeOwnageDotCom
Copy link

Description

In the current state, when including specific line numbers, we can target specific lines.

  1. To set starting line number: myfile:3
    • This will include the entire file STARTING at line number 3.
  2. For lines up to a specific line: myfile::10
    • This will include lines 1 - 10
  3. For a range of lines: myfile:4:12
    • This will include lines 4 - 12.
  4. To include a SPECIFIC line: myfile:3:3
    • This will only include line number 3

BUT, what if we wanted to include the last 10 lines of the file. There currently is not a way to index from the end of the file.

Benefits

Easy feature, which adds more utility, for potentially niche use-cases.

Solution Idea

Add the ability to do negative indexing:

Given, a file that is 100 lines long-

  1. To set starting line number: myfile:-3
    • This will include lines 97-100
  2. For lines up to a specific line: myfile::-51
    • This will include lines 1 - 49
  3. For a range of lines: myfile:4:-25
    • This will include lines 4 - 75.
  4. To include a SPECIFIC line: myfile:-0:-0
    • This will only include the very last line.
@gir-bot gir-bot added the S: triage Issue needs triage. label Oct 24, 2024
@XtremeOwnageDotCom
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S: triage Issue needs triage. T: feature Feature.
Projects
None yet
Development

No branches or pull requests

2 participants