[QScintilla] Merit of proposed signals markerLineDeleted() and markerLineUndelete()

Daniel J Sebald daniel.sebald at ieee.org
Sun May 5 18:42:25 BST 2013


On 05/05/2013 12:14 PM, Baz Walter wrote:
> On 04/05/13 22:22, Daniel J Sebald wrote:
>> I did find one behavior to be problematic. It is when a line is deleted
>> which contains a marker. When non-marker lines are added or deleted,
>> lines having markers adjust appropriately, and one is able to access
>> that line number via marker handle. All good.
>>
>> However, when a line is delete that has a marker, that marker becomes
>> associated with a line that still remains in the edit window. I realize
>> there is some question as what to do in that case. However, if
>> QScintilla had two signals
>>
>> markerLineDeleted (int mhandle, int linenr)
>> markerLineUndeleted (int mhandle, int linenr)
>>
>> or something similar then the programmer could act accordingly to, for
>> example, remove that marker or maybe change the marker to some other
>> marker indicating questionable location.
>>
>> I've also noticed if the line in which there is a marker is deleted (and
>> the marker goes to another line), when the "undo" button is pressed and
>> the deleted line restored, the marker doesn't go back to the original
>> line but stays at the line post delete. Could that be fixed to have the
>> marker go back to the original line?
>>
>> If there were a markerLineDeleted (mhandle, linenr), the programmer
>> could record the linenr at the time it was deleted. Then if there is a
>> markerLineUndeleted (mhandle, linenr) signal, the programmer could move
>> the marker back to its position at the time it was deleted.
>
> It looks like Scintilla may provide some low-level stuff that could be
> enough to roll your own solution.
>
> I suggest you take a look at the SCN_MODIFIED notification:
>
> http://www.scintilla.org/ScintillaDoc.html#SCN_MODIFIED
>
> which sets the SC_MOD_CHANGEMARKER flag when the markers have changed,
> and also gives the line on which the changes occurred.

OK, thanks.  I'll have to experiment a bit.  That might be the answer; 
at least I'm pretty sure there needs to be some type of notification 
that a marker line has changed.  It doesn't seem enough to be notified 
about a block of text either deleted or added (i.e., "linesAdded" being 
0, + or -).  If one gets that notification and then inquires the 
position of markers (easy to do right now) that doesn't indicate whether 
the marker was moved or not.  Can a person deduce that information? 
Probably not, unless maybe one continually keeps track of where markers 
are moving to whenever there is any kind of line change.  Might work, 
e.g., "last_known_editor_linenr".

I see in this description that "text" is "If we are collecting undo 
information this holds a pointer to the text that is handed to the Undo 
system, otherwise it is zero."  I know little about Scintilla, but that 
suggests to me that there is no way of retaining marker line location in 
that Undo system...unless it can be encoded in the text somehow.  The 
information about the markers.  Does it pay to write a bug report for 
such a thing?

Dan


More information about the QScintilla mailing list