Skip to content

Line count often is off by one #1

@cfeied

Description

@cfeied

Incredibly helpful extension!!! Small bug.

If I click in the left margin to select an entire line, the line count shows 2 lines rather than one. This is because the cursor has been placed in column one of the next line, and the code does not recognize this edge case (it merely subtracts the line numbers and adds one).

This off-by-one scenario arises any time a selection includes the invisible EOL character that follows the last visible character on a line. For one humorous manifestation, put your cursor anywhere in a line of code and press the END key. You will see the normal status bar showing the total lines in the file. Now hold down the shift key and hit the right arrow. A single empty-appearing character space will be highlighted, and the status bar shows "Chars: 0 Words: 0 Lines: 2"

Hilarious, but possibly worth fixing.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions