Page 1 of 1
scintilla current column
Posted: Tue Aug 24, 2010 4:35 pm
by cybergeek
this retreives the line number of the current line
Code: Select all
ScintillaSendMessage(1,#SCI_LINEFROMPOSITION,ScintillaSendMessage(1,#SCI_GETCURRENTPOS,0,0),0)+1
but how to retreive column? [the pos of caret in the line]
Re: scintilla current column
Posted: Tue Aug 24, 2010 5:19 pm
by srod
Well, you have to be very careful with this because of the fact that, generally speaking, Scintilla does not really utilise character positions; it deals with byte-positions instead and this can be complicated by the use of, for example, the utf-8 codepage.
The #SCI_GETCOLUMN message does, however, deal with character positions, though of what use this might be when you are probably using a variable width font is unclear?
The #SCI_GETCURLINE message can be used to get the current caret position within the currently selected line, but it will return it as a byte position which, if using UTF-8, for example, will not always equate to a character position. You will need to add some additional code to convert this to a character position.
The following may or may not give you what you are after :
Code: Select all
ScintillaSendMessage(1, #SCI_GETCOLUMN, ScintillaSendMessage(1, #SCI_GETCURRENTPOS))
Re: scintilla current column
Posted: Wed Aug 25, 2010 10:18 am
by cybergeek
thx a lot........
you could add these to Goscintilla Library sometime?
Re: scintilla current column
Posted: Wed Aug 25, 2010 10:27 am
by srod
Probably not because it would be of limited use in my opinion and it is very easy to send the messages directly as you are doing. I try to avoid just wrapping single message calls where possible.