I''m trying to write some FXScintilla missing methods (btw, there are
plenty of them) and came into this problem:
some messages require output buffer to be specified as parameter. Should I
reserve memory for it and how this could be accomplished.
I''ve seen this trick in code
buffer = "".ljust(size)
sendMessage(XXXX, buffer, 0)
But one method got me thinking : is there a bug in FXScintilla.getLine method ?
# Retrieve the contents of a line.
# Returns the length of the line.
def getLine(line)
buffer = "".ljust(line)
sendMessage(2153, line, buffer)
buffer
end
>From the code it''s not obvious how it "Returns the length of
the line". Moreover, "".ljust(line) seems like a bug to me:
line - is the index of line in question, ljust needs size in bytes to be
supplied. So, it seems to me, that this line should be as follows:
buffer = "".ljust( sendMessage(2153, line, 0) )
Message 2153 (SCI_GETLINE) returns line length if buffer == 0.
The question is: is this a bug or feature ?