[fxruby-users] FXScintilla.getLine bug ?

HaPK TheHaPK at yandex.ru
Mon Sep 19 07:39:48 EDT 2005

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)

>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 ?

More information about the fxruby-users mailing list