Thanks Sean I see what you mean. I have done as you said and all is good now.
Thanks Mike Sean Healy wrote: > > I tracked down the extra spaces problem. It turned out to be a space at > the end of the line (after the EOL character(s)), not at the beginning, > which is why it doesn't show up on the first line. > > Here's the cause of the problem: > # How many characters are on a line, not including end of line characters? > sub LineLength { > my ($self, $line) = @_; > return $self->SendMessage (2350, $line, 0); > } > > Scintilla's documentation says: > SCI_LINELENGTH(int line) > This returns the length of the line, including any line end characters. If > line is negative or beyond the last line in the document, the result is 0. > If you want the length of the line not including any end of line > characters, use SCI_GETLINEENDPOSITION(line) - SCI_POSITIONFROMLINE(line). > > Laurent's code makes an incorrect assumption about EOL markers and > SCI_LINELENGTH. (Although it may have been correct when it was coded, and > Scintilla later changed.) Everywhere Laurent has used LineLength to get > the text at a line, he has done the following: > my $lenght = $self->LineLength($line); > my $text = " " x ($lenght + 1); > $self->SendMessageNP (2153, $line, $text); > > He has to create the buffer first, because SendMessage requires the memory > to be already allocated, so he creates a buffer of spaces. But he creates > it one byte too long, so there's a trailing space in the returned text. > > (SendMessageNP is an alias for SendMessage with the second parameter as a > pointer. There is also SendMessage PN for the first parameter as a pointer > and SendMessagePP for both parameters as pointers. It would probably be > better to have a single SendMessage function, and use references when you > want a parameter to be a pointer, but I don't currently have a compiler, > so I can't mess with the C code. We'd have to leave the extra methods in > for a couple versions anyway, to prevent older code from breaking.) > > The intermediate solution is to go to line 196 in Scintilla.pm (in the > GetLine() sub) and take out the '+1'. Then when SaveFile calls GetLine, > you won't get a trailing space. > > The long-term solution is to find every place Laurent has used LineLength, > and fix it. I am willing to do this and email the fixed file to someone > with CVS access, so it will be correct in the next version. I'll test it > via SaveFile, with differrent combinations of EOL markers in source and > destination files, to make sure it really works. (I'll also fix that > annoying little misspelling in the local variable while I'm at it.) > > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by DB2 Express > Download DB2 Express C - the FREE version of DB2 express and take > control of your XML. No limits. Just data. Click to get it now. > http://sourceforge.net/powerbar/db2/ > _______________________________________________ > Perl-Win32-GUI-Users mailing list > Perl-Win32-GUI-Users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/perl-win32-gui-users > http://perl-win32-gui.sourceforge.net/ > > -- View this message in context: http://www.nabble.com/EOL-control-in-scintilla-tf3674386.html#a10318581 Sent from the perl-win32-gui-users mailing list archive at Nabble.com.