Skip to content

Setting a mark does not take sections into account #620

@bprb

Description

@bprb

When setting a mark, the mark is set on the wrong line if there is a section on screen. In contrast, when setting a mark when using a header, the mark line number is correctly adjusted to take the header into account.

Repro steps:

  1. create a file with many lines such as the attached bug.txt which consists of a line TITLE followed by lines 1, 2, ... 200.
    Run: ov bug.txt --section-delimiter "TITLE".
  2. press arrow down once to scroll down one line. Observe that the section "TITLE" correctly "sticks" to the top of the screen. The next visible line is the line that says 2 which is actually line 3 (one-based counting).
    Place a mark with m. Bug: the mark is placed on line 2. The mark is not visible. The status says "Marked to line 2" which is wrong.
  3. press arrow up once to confirm that the mark was placed on Line 2, which says "1" (screenshot: "Step 3"). When the mark was placed that line was hidden behind the section.

Expected behavior: when the first line visible after a section header is the third line, the mark should be on the third line.

section_mark

In the repro, the mark will always be on "current line minus 1". This skew gets worse with larger SectionHeaderNum values.

Note: if you repeat these exact same steps with a one-line header then the behavior is as expected. Note that the status line still says "Marked to Line 2" but the mark is on the third line.

header_mark
> ov --version
ov version 0.36.0 rev:d671c94

OS Name:                   Microsoft Windows 10 Pro
OS Version:                10.0.19045 N/A Build 19045

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