Skip to content

smart-skip does not apply before a single last line when setting last: false #110

@SillyFreak

Description

@SillyFreak

Reproduction:

#import "@preview/codly:1.3.0"

#show: codly.codly-init

#let code = ```
first

middle

last
```

#code  // reference

#codly.codly(
  smart-skip: true,
  ranges: ((1, 1), (3, 3), (5, 5)),
)
#code  // two smart skips (lines 2 and 4)

#codly.codly(
  smart-skip: (first: false, last: false, rest: true),
  ranges: ((1, 1), (3, 3), (5, 5)),
)
#code  // line 2 has a smart skip, line 4 has not

In the last example, the error is visible. It should render as

first
...
middle
...
last

but instead we get

first
...
middle
last

it seems that the smart-skip feature detects line 4 as being the "last" when the final range only contains the last line as a single line. If the code snippet was

first

middle

last
more

then we get the expected result. Likewise, if (with this snippet) the final range was (5, 6), i.e. more than one line, the result is also correct.

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