Author Topic: Does reflow comment work with Unix shell scripts?  (Read 2174 times)

timur

  • Senior Community Member
  • Posts: 205
  • Hero Points: 3
Does reflow comment work with Unix shell scripts?
« on: June 20, 2019, 09:43:04 PM »
Is Document->Reflow Comment supposed to work on Unix shell scripts?  I have tried all sorts of options and variations, and this feature never does anything for me.

One feature that I need often is to reflow a comment block so that the right margin is at the 80-character mark.  I sometimes indent comment blocks as I copy/paste them to another part of my script and then indent the block.  So for example:

Code: [Select]
if [[ -z $TEST ]]
then
    # This is a very long comment line that reaches all the way to column 80
    # and then some.
fi

becomes:

Code: [Select]
if [[ -z $TEST ]]
then
    command
    if [ $? -ne 0 ]
    then
        # This is a very long comment line that reaches all the way to column 80
        # and then some.
    fi
fi

And I want Slickedit to change that to:

Code: [Select]
if [[ -z $TEST ]]
then
    command
    if [ $? -ne 0 ]
    then
        # This is a very long comment line that reaches all the way to column
        # 80 and then some.
    fi
fi

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6866
  • Hero Points: 528
Re: Does reflow comment work with Unix shell scripts?
« Reply #1 on: June 22, 2019, 12:25:12 AM »
Reflow Comment isn't supported for shell scripting languages yet and the menu item should be disabled but isn't (bug).

Looks like Reflow Comment is broken if Comment Wrap is off. Reflow Comment should work for say C++ which supports Comment Wrap even if Comment Wrap is off.

We will add hot fixes for this

timur

  • Senior Community Member
  • Posts: 205
  • Hero Points: 3
Re: Does reflow comment work with Unix shell scripts?
« Reply #2 on: June 22, 2019, 03:21:03 AM »
Could you add comment reflow for other languages?  If you can reflow // comments in C++, then surely it wouldn't be too difficult to reflow # comments in Bash.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6866
  • Hero Points: 528
Re: Does reflow comment work with Unix shell scripts?
« Reply #3 on: June 22, 2019, 06:20:16 PM »
I've added reflow_comment support for almost all languages SlickEdit supports. I was able to add support for Shell scripting languages (took some hardwired code though).

Added for next hot fix.


hs2

  • Senior Community Member
  • Posts: 2761
  • Hero Points: 292
Re: Does reflow comment work with Unix shell scripts?
« Reply #4 on: June 22, 2019, 07:35:27 PM »
Wow Clark .. ++HP ;D

guth

  • Senior Community Member
  • Posts: 104
  • Hero Points: 7
Re: Does reflow comment work with Unix shell scripts?
« Reply #5 on: June 22, 2019, 08:08:35 PM »
Talking about reflow, would it be possible to make reflow context aware in LaTeX documents? For instance, having the cursor on an \item in a \begin{itemize}\end{itemize} environment, reflow only reflows the current \item and not the current paragraph, as seen by slickedit.
Code: [Select]
\begin{itemize}
\item a very long line and we want it to be reflowed at, say, 80th column, so after a relow, the item shall be like below.
\item a very long line and we want it to be reflowed at, say, 80th column, so
after a relow, the item shall be like below.
\end{itemize}

but doing a reflow paragraph having the cursor on the second line, i.e., somewhere on the first \item, the result is as follow:
Code: [Select]
\begin{itemize} \item a very long line and we want it to be reflowed at,
say, 80th column, so after a relow, the item shall be like below. \item a
very long line and we want it to be reflowed at, say, 80th column, so
after a relow, the item shall be like below. \end{itemize}

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 6866
  • Hero Points: 528
Re: Does reflow comment work with Unix shell scripts?
« Reply #6 on: June 23, 2019, 12:39:46 AM »
I think it’s doable but I’m not that familiar with latex. As a work around, you can reflow a selection.