Single-Line Editing with word wrap caused strange word wrapping

SyntaxEditor for WPF Forum

Posted 5 years ago by Christel
Version: 14.1.0601
Platform: .NET 4.5
Environment: Windows 7 (64-bit)
Avatar

Hi support team,

I use the Single-Line Editing with word wrap.

I defined a custom language with langdef-File, use a MergeableProgrammaticLexer for Lexing, a derived class from LLParserBase with a custom Grammar class.

Assume there are tokens like this "aaa", "bbb", "ccc", and so on. They can be added together in a text like this "aaa-bbb,ccc,ddd,eee,fff,ggg"

In a single line field with enough space for the text only in a single line, there is no word wrap, when I enter the sign "-" after a token.

When the single line field gets shorter (e.g. due to resizing a window) or there are already two lines of text in the single line field like this

"aaa,bbb,ccc,ddd, eee,fff,ggg"

and I enter a "-" between "aaa,bbb....."

the word wrap causes a text like this:

"aaa-bbb,ccc,ddd,eee,fff,ggg"

I would have expected something like this:

"aaa-bbb,ccc,ddd,
eee,fff,ggg"

The sign "-" causes a kind of line break/word wrap with a lot of spaces, which is not the expected behaviour.

I know, it's hard due to my special custom classes with langdef-File, Grammar,..., to give me a solution.

But perhaps you will have a hint, which part of the syntax framework could cause this. Is it the MergeableProgrammaticLexer, the langdef, the Parser, the Grammar?

The question is, why is the word wrap located directly after the sign "-" and not after a "," or any valid token?

How and where does the word wrap locate the place in a text to "wrap". Does it look for special tokens?

I hope you have any hint, where I can look for and my description is not too complicated.

 

Thanks!!

Comments (5)

Posted 5 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Christel,

From the post above, I'm not sure your formatting of where wrapped lines came though, so it's hard to see what you are describing.  Could you check it?

As for word wrapping, we are harnessing the WPF TextFormatter and somewhere it is determining where words should break.  I don't believe the logic for determining where breaks are is within our code, but rather, it's in the Microsoft TextFormatter code.

What if you put spaces after the commas?  That might get the formatter to break after commas.


Actipro Software Support

Posted 5 years ago by Christel
Avatar

Thanks for your quick answer!!

Your assumption is right - you didn't get a correct formatting description, as it was probably reformatted after I checked it in.

I will try it again:

There is following: two lines of text in the single line field like this:

"aaa, bbb, ccc, ddd,

eee, fff, ggg"

 

I enter a "-" (hyphen) between "aaa, bbb....." like this: "aaa-bbb"

 

the word wrap causes a text like this:

"aaa-

bbb, ccc, ddd, eee, fff, ggg"

After "aaa-" there are a lot of spaces, then there is a new line with "bbb,ccc,ddd,eee,fff,ggg"

But I would have expected something like this:

"aaa-bbb, ccc, ddd,
eee, fff, ggg"

The (hyphen) sign "-" causes a kind of line break/word wrap with a lot of whitespaces in the first line after the hyphen, which is not the expected behaviour.

The same happens, when you have a single line field with enough space for the text only in a single line like this:

"aaa-bbb, ccc, ddd, eee, fff, ggg"

and you reduce the width of the sinlge-line field. As soon, as the word wrap happens, it look like this:

"aaa-

bbb, ccc ,ddd, eee, fff, ggg"

 

The logic for determining where breaks are:
 it may have something to do with recognized tokens

I assume this, as in your sample browser the example for the single line edit with word wrap works perfect with the hyphen.
With the "+", the plus sign will always occur in the new line, but the will not be such a lot of whitespaces before in the first line.

We use another grammar and language-definition. In fact I even have two different languages defined and with the first, this strange word wrap happens as described above. With the second language it happens not with the hyphen, this works perfect:

"31601*-31608*,31610*,31612*,31614*,

31616*,31618*,31620*,31622*,31624*"

but it happens with the "+" plus sign:

"31601*,31608*,31610*

+31618*,31620*,31622*,31624*,31626*,31628*,31630*,31632*"

You will see a  lot of whitespaces where you entered the "+", then a line break and the plus in the next line.

It is strange, that there are such a lot of whitespaces in the first line and the line break is immediately before the "+"

 

Hope, I described it better now and you can see it.

Posted 5 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Christel,

I tried the same thing in a single-line SyntaxEditor with word wrap on and the C# add-on language loaded and I pasted this in there:

"aaa-bbb, ccc, ddd, eee, fff, ggg"

However I'm seeing it work how you would expect and not the behavior you are seeing.  The reason I used the C# add-on was so that it was all one token.  Do you have each item being separate tokens in your case?  I also tried it without quotes, which would have them all be separate tokens and it worked there too.

If you'd like us ot look into it, we'd probably need you to email our support address with a new very simple sample project that shows the issue.  Please reference this thread and rename the .zip file extension of whatever you send so it doesn't get spam blocked.  Thanks!


Actipro Software Support

Posted 5 years ago by Christel
Avatar

Hi Support,

I tried to send you an example solution packed as a zip-File, then tried it with a rar-File

I renamed the zip-file to something without extension, or with extension "xxx" and so on,

but any kind of renaming will not go through the mail delivery system.

I always get

The following address
failed:

"Support@ActiproSoftware.com":
SMTP error from remote server after transfer of mail text:
host: ASPMX.L.GOOGLE.com
5.7.0 This message was blocked because its content presents a potential
5.7.0 security issue. Please visit
5.7.0 http://support.google.com/mail/bin/answer.py?answer=6590 to review our
5.7.0 message content and attachment content guidelines. ju7si18858433wid.58 - gsmtp

 

any hints how I can send you the example-Mini-solution?

 

It is only about 500KB, Attachement named "SyntaxEditorSingleLineWordWraptxt", and archived as a zip-File or rar File

Thanks!

Posted 5 years ago by Actipro Software Support - Cleveland, OH, USA
Avatar

Hi Christel,

Generally customers don't have issues sending it if they've renamed it as a .piz or .txt file extension.  Other things you can do is make sure you don't include any bin/obj folders or executables in the ZIP.  It could be that the mail servers still scan for .exe files even in renamed ZIPs.


Actipro Software Support

The latest build of this product (v2019.1 build 0683) was released 1 month ago, which was after the last post in this thread.

Add Comment

Please log in to a validated account to post comments.