How to get Vertical Edge Settings programmatically?
-
You used to be able to use SCI_GETEDGECOLUMN, but in v7.8.6 NP++ changed to using multiline mode for the vertical edge, and this message does not work with multiline mode.
Is there a way to programmatically get the vertical edge now?
-
@Derek-Brown said in How to get Vertical Edge Settings programmatically?:
Is there a way to programmatically get the vertical edge now?
There doesn’t appear to be; here’s the extent of the Scintilla functions regarding the vertical edge:
SCI_SETEDGEMODE(int edgeMode)
SCI_GETEDGEMODE → int
SCI_SETEDGECOLUMN(position column)
SCI_GETEDGECOLUMN → position
SCI_SETEDGECOLOUR(colour edgeColour)
SCI_GETEDGECOLOUR → colour
SCI_MULTIEDGEADDLINE(position column, colour edgeColour)
SCI_MULTIEDGECLEARALLI got this from HERE.
Note that you can “add” and “clear all” for multi-edge mode, but there is no corresponding “get”.
-
Yeah there’s definitely no way in the Scintilla messages. I was wondering if there was another solution that was supported, it would have to be something implemented in NP++ specifically. As a possibility, are the NP++ settings exposed to plugins in a useful way?
-
@Derek-Brown said in How to get Vertical Edge Settings programmatically?:
are the NP++ settings exposed to plugins in a useful way?
I’m not sure about that but someone else will know.
Even if they are exposed, I would think that this new multiple vertical edge stuff is too new to be supported yet in that way.May I ask what you’re really wanting to do?
I use the single vertical edge in my setup, but I have Notepad++'s management of it completely turned off. I’m doing what I do via Pythonscript.
I would think you could do something similar, but without knowing anything further I can’t say for sure. -
My CommentWrap plugin reads the vertical edge setting by default to decide at what column to wrap comments. This column can also be manually set, so it’s not a huge problem that it’s broken right now, but I would like to restore the functionality.
-
Ah, okay then.
What I do won’t help that situation.It does seem like a Scintilla oversight to allow setting of multiple edges without having a readback mechanism. Perhaps you want to have a look at the Scintilla issues list, maybe open an issue if there isn’t one.
But, sadly, I suppose I am the one that broke your plugin.
I’m sorry.
:-( -
Yes, there doesn’t seem to be a call which is able to get every column
position set but the call itself seems to report the position from the first column.Maybe @donho might consider implementing a new message
NPPM_GETEDGECOLUMNS and returning an array of ints? -
How is that call implemented? When I call in C++:
SendMessage(scintillaHwnd, SCI_GETEDGECOLUMN, 0, 0)
With edges set at 80 and 120 I get back 0.
-
hmm, strange - basically doing the same as you do
sci.call = <SciFnDirect>SendMessageW(hwnd, SCI_GETDIRECTFUNCTION, 0, 0) cpdef ssize_t getEdgeColumn(self): ''' Retrieve the column number which text should be kept within. ''' return <ssize_t>self.call(<sptr_t>self.sci_pointer, SCI_GETEDGECOLUMN, 0, 0)
EDIT: except that I’m using the direct function
-
just tried it with SendMessage and I do get back 80
-
@Derek-Brown
WAIT - there seems to be something wrong with MY code.
Because I set a different value (87) and I still do get back 80. -
No, nothing wrong with my code but I guess there is another level of potential confusion.
It reports back what is configured in Number of columns -
ok - sorry for the noise. I didn’t use the latest 7.8.6 iteration.
I was still running a RC version. In the final version it does what @Derek-Brown said.