Author Topic: Soft wrap color coding not preserved for bash comment  (Read 206 times)

rowbearto

  • Senior Community Member
  • Posts: 1274
  • Hero Points: 89
Soft wrap color coding not preserved for bash comment
« on: January 29, 2019, 06:57:08 pm »
If I have a very long bash comment and I turn on soft wrap, the color coding is not preserved on the next line.

See attached screenshot.

23.0.0.11 64bit, CentOs 7.2, hotfix 2

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4611
  • Hero Points: 365
Re: Soft wrap color coding not preserved for bash comment
« Reply #1 on: January 29, 2019, 07:27:43 pm »
Doesn't look like softwrap. Looks like a long line that was split into multiple display lines by your "Wrap line length" setting. Current line color only gets displayed for a single soft-wrapped display line and not complete lines which may have been split across multiple display lines. This is a limitation. Not sure if it could be changed or even should be changed.

Turn off softwrap for this file and it's a bit more clear.
« Last Edit: January 29, 2019, 07:35:07 pm by Clark »

rowbearto

  • Senior Community Member
  • Posts: 1274
  • Hero Points: 89
Re: Soft wrap color coding not preserved for bash comment
« Reply #2 on: January 29, 2019, 08:53:19 pm »
OK, turned off softwrap, so that is not the issue. I should have said that the issue is with "wrap line length".

I have attached 2 more screenshots that illustrate the original problem that I encountered but tried to simplify with my first example. The 2 screenshots have soft wrap on and off.

In both cases, notice that the "echo" on line 5 is color coded green when it should be yellow instead as it is on line 3.

This is because for line 4 in the comment, there is an opening single quote after the first "aaaaaa". But the close quote happens to be on the 2nd line 4. Because the color coding is not continued across wrapped lines, SE thinks the single quote on line 4 is an opening quote, therefore all code that follows on line 5, and anything else below it which I have not included, will be wrongly colored green. This is messing up the display of a real script that I have.
« Last Edit: January 30, 2019, 01:06:22 am by rowbearto »

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4611
  • Hero Points: 365
Re: Soft wrap color coding not preserved for bash comment
« Reply #3 on: January 29, 2019, 09:01:42 pm »
In the case of a line comment, color coding current can’t color code correctly. There are other situations that are problematic as well. These are limitations at the moment.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4611
  • Hero Points: 365
Re: Soft wrap color coding not preserved for bash comment
« Reply #4 on: January 29, 2019, 10:52:11 pm »
I'm pretty sure the color coding engine can be enhanced to support multi-display lines for line comment-like constructs. I don't think it should be that hard either to add it. It's similar to the handling of a C++ line comment with a trailing backslash which makes it multi-line. In this case there's an implied line continuation. There's a little more complication that than but that's the basic idea though.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4611
  • Hero Points: 365
Re: Soft wrap color coding not preserved for bash comment
« Reply #5 on: February 01, 2019, 09:40:08 pm »
I added support for force wrapping of line comment-like color coding elements to v23.0.1. This will allow force wrapped line comment-like constructs to be color coded correctly across force multiple display lines. There will still be potential issues with non-multiline begin/end constructs (ex. string literals which can't span multiple lines).

rowbearto

  • Senior Community Member
  • Posts: 1274
  • Hero Points: 89
Re: Soft wrap color coding not preserved for bash comment
« Reply #6 on: February 01, 2019, 10:35:37 pm »
Thanks Clark!

Does it mean that 2nd screenshot I provided where the open/close single quotes are on different lines will not be color coded properly?

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4611
  • Hero Points: 365
Re: Soft wrap color coding not preserved for bash comment
« Reply #7 on: February 01, 2019, 10:45:36 pm »
Single and double quoted strings for bash can be multiple lines so they will color code correctly. For other languages, this isn't the case.

Clark

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 4611
  • Hero Points: 365
Re: Soft wrap color coding not preserved for bash comment
« Reply #8 on: February 01, 2019, 11:23:19 pm »
C++ double quoted strings work because a line continuation character is defined. This will help quite a few single line strings so they also work.