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

modifyLineBreaks with when: after and blocksFollow.other introduces extra indentation after \end #502

Closed
kwshi opened this issue Dec 18, 2023 · 4 comments
Labels
bug unexpected behaviour; should be a priority for fixing implemented implemented tag means that either an enhancement or feature request has been implemented, or bugfix text-wrap text wrapping; documented at https://latexindentpl.readthedocs.io/en/latest/sec-the-m-switch.html

Comments

@kwshi
Copy link

kwshi commented Dec 18, 2023

Please provide the following when posting an issue:

original .tex code

\begin{myenv}
  yo it's your boy here kwshi back at it with yet another example to break latexindent
\end{myenv}
it's been a good couple months hasn't it how you been my friend i've been starting to miss you having not been on here filing issues for so long that i was so excited when latexindent started acting up again, gives me a good excuse to come chat with you

yaml settings (taken roughly from https://latexindentpl.readthedocs.io/en/latest/sec-the-m-switch.html#lst-tw-bf-myenv-yaml)

modifyLineBreaks:
  textWrapOptions:
    columns: 60
    when: "after"
    blocksFollow:
      other: |
        (?x)
        \\begin\{myenv\}
        |
        \\end\{myenv\}

actual/given output

\begin{myenv}
	yo it's your boy here kwshi back at it with yet another
	example to break latexindent
\end{myenv}
it's been a good couple months hasn't it how you
           been my friend i've been starting to miss you
           having not been on here filing issues for so
           long that i was so excited when latexindent
           started acting up again, gives me a good excuse
           to come chat with you

desired or expected output

\begin{myenv}
	yo it's your boy here kwshi back at it with yet another
	example to break latexindent
\end{myenv}
it's been a good couple months hasn't it how you been my
friend i've been starting to miss you having not been on
here filing issues for so long that i was so excited when
latexindent started acting up again, gives me a good excuse
to come chat with you

Issue doesn't occur using when: before. Curiously enough the issue with extra indentation also doesn't occur within the environment (after \begin{myenv}); it also goes away if I introduce an extra blank line after \end{myenv}, or a blank comment (which is an OK workaround).

Probably related to #450 and #412.

Also, an observation that may come in handy for troubleshooting: the extra indentation lines up exactly with where the \end{...} line ends. See this other example:

\begin{myfriendhowareyou}
	yo it's your boy here kwshi back at it with yet another
	example to break latexindent
\end{myfriendhowareyou}
it's been a good couple months
                       hasn't it how you been my friend
                       i've been starting to miss you
                       having not been on here filing
                       issues for so long that i was so
                       excited when latexindent started
                       acting up again, gives me a good
                       excuse to come chat with you

and notice how hasn't it how you ... is indented to exactly where {...areyou} ends two lines above it.

@cmhughes
Copy link
Owner

Apologies for the delay, I'm hoping to get to this soon

@cmhughes cmhughes added the text-wrap text wrapping; documented at https://latexindentpl.readthedocs.io/en/latest/sec-the-m-switch.html label Dec 26, 2023
@cmhughes
Copy link
Owner

For my reference, start here:

# check for custom indentRules see

cmhughes added a commit that referenced this issue Dec 29, 2023
@cmhughes
Copy link
Owner

Thanks for this.

As of 38cf7c3 if we start with

defaultIndent: "    "
modifyLineBreaks:
  textWrapOptions:
    columns: 60
    when: "after"
    blocksFollow:
      other: |
        (?x)
        \\begin\{myenv\}
        |
        \\end\{myenv\}

then we receive

\begin{myenv}
    yo it's your boy here kwshi back at it with yet another
    example to break latexindent
\end{myenv}
it's been a good couple months hasn't it how you been my
friend i've been starting to miss you having not been on
here filing issues for so long that i was so excited when
latexindent started acting up again, gives me a good excuse
to come chat with you
----|----|----|----|----|----|----|----|----|----|----|----|
   5   10   15   20   25   30   35   40   45   50   55   60

I'll get this released soon. Thanks again.

@cmhughes cmhughes added the bug unexpected behaviour; should be a priority for fixing label Dec 29, 2023
cmhughes added a commit that referenced this issue Dec 30, 2023
@cmhughes cmhughes added the implemented implemented tag means that either an enhancement or feature request has been implemented, or bugfix label Dec 30, 2023
@cmhughes
Copy link
Owner

cmhughes commented Jan 1, 2024

Released at https://github.com/cmhughes/latexindent.pl/releases/tag/V3.23.5, uploaded to ctan. Thanks again.

@cmhughes cmhughes closed this as completed Jan 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug unexpected behaviour; should be a priority for fixing implemented implemented tag means that either an enhancement or feature request has been implemented, or bugfix text-wrap text wrapping; documented at https://latexindentpl.readthedocs.io/en/latest/sec-the-m-switch.html
Projects
None yet
Development

No branches or pull requests

2 participants