Recent

Author Topic: [SOLVED][SynEdit] GetNextHighlighterTokenFormView: Token starts with char  (Read 3822 times)

Pascal

  • Hero Member
  • *****
  • Posts: 932
How can i prevent this error when typing multibyte characters?
I use a SynEdit with a modified Cobol-Highlighter

Pascal
« Last Edit: August 14, 2015, 01:41:42 pm by Pascal »
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

jc99

  • Hero Member
  • *****
  • Posts: 553
    • My private Site
Re: [SynEdit] GetNextHighlighterTokenFormView: Token starts with char
« Reply #1 on: August 13, 2015, 08:40:53 am »
First read  http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F
Meaning: What version, what OS, Some Code ...
Maybe a Test-Project, ...
So we can verify your bug, maybe you found a bug in the component, or it's just not released for those chars.     
OS: Win XP x64, Win 7, Win 7 x64, Win 10, Win 10 x64, Suse Linux 13.2
Laz: 1.4 - 1.8.4, 2.0
https://github.com/joecare99/public
'~|    /''
,_|oe \_,are
If you want to do something for the environment: Twitter: #reduceCO2 or
https://www.betterplace.me/klimawandel-stoppen-co-ueber-preis-reduzieren

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: [SynEdit] GetNextHighlighterTokenFormView: Token starts with char
« Reply #2 on: August 13, 2015, 10:40:28 am »
Sorry!

Version is 1.4.0 on Windows 8.1

laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

Basile B.

  • Guest
Re: [SynEdit] GetNextHighlighterTokenFormView: Token starts with char
« Reply #3 on: August 13, 2015, 12:24:59 pm »
Next time don't forget that SynEdit has its own subforum: http://forum.lazarus.freepascal.org/index.php/board,69.0.html

Martin_fr

  • Administrator
  • Hero Member
  • *
  • Posts: 11338
  • Debugger - SynEdit - and more
    • wiki
Re: [SynEdit] GetNextHighlighterTokenFormView: Token starts with char
« Reply #4 on: August 13, 2015, 03:43:07 pm »
I use a SynEdit with a modified Cobol-Highlighter

Does it happen with the not modified HL too?

In any case the error message is not worded very helpful, what it means is, that the highlighter returned a pointer to a token (part of the line text).
But the pointer points into the middle byte of utf8 codepoint.

In other words the HL tries to split a single char, so that the first byte(s) of it have one color, and the remaining byte(s) another.

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: [SynEdit] GetNextHighlighterTokenFormView: Token starts with char
« Reply #5 on: August 14, 2015, 08:09:53 am »
@BBasile: Thanks for the hint. I didn't recognized it so far.

@Martin_fr: Thanks for the explenation. That makes sense as the Cobol-Highlighter doesn't work with multi-byte-characters.
It steps byte wise thru the line which works if you do not use äöüÄÖÜß....
Is there a way to step column wise thru the line (line[collumn]) or do i have to use a char-pointer to handle multi-byte-characters?

Regards
Pascal
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

Pascal

  • Hero Member
  • *****
  • Posts: 932
Re: [SynEdit] GetNextHighlighterTokenFormView: Token starts with char
« Reply #6 on: August 14, 2015, 01:41:22 pm »
I found the solution in TSynPasSyn Pascal Highlighter:

Just added:
Code: [Select]
   while (fLine[Run] in [#128..#191]) OR // continued utf8 subcode
   ((fLine[Run]<>#0) and (fProcTable[fLine[Run]] = @UnknownProc)) do inc(Run);
to my UnknownProc.

Thanks for the hints.

Regards
Pascal
laz trunk x64 - fpc trunk i386 (cross x64) - Windows 10 Pro x64 (21H2)

 

TinyPortal © 2005-2018