On 05/05/2018 03:53 PM, Scott Kostyshak wrote:
> On Sat, May 05, 2018 at 05:11:31PM +0000, Scott Kostyshak wrote:
>> On Sat, May 05, 2018 at 04:05:49PM +0000, Richard Kimberly Heck wrote:
>>> On 05/05/2018 11:56 AM, Scott Kostyshak wrote:
>>>> The attached patch is an attempt to only show the "Accept Change" and
>>>> "Reject Change" options in the context menu when there is a change in
>>>> the selection.
>>>>
>>>> It works well except if the selection is inside an inset. For example,
>>>> when in a LyX Note, ppos_beg and ppos_end refer to the position within
>>>> the note. Does each inset have its own ParagraphList? If so, how do I
>>>> access it?
>>> If it's an InsetText, then it has its own Text object, which has paragraphs:
>>>     ParagraphList const & pars = theInset.text().paragraphs();
>> Thanks, Riki. that's exactly what I needed. New patch attached.
>>
>> The next problem is that I need to check all paragraphs on all depths.
>> For example, if there is a change inside a LyX Note, and I select the
>> LyX Note from the outside of the inset, isChanged() is false because I
>> guess it checks whether the entire note was changed, not the contents of
>> the note.
>>
>> I'll look into this.
> I'm unsure what approach to take. One option would be to define
> "isChanged()" to return true if there is a change in the paragraph or in
> any paragraph within the paragraph. I think that currently, isChanged()
> checks only the top-level paragraph. I have no idea if this is a
> reasonable change to make.

You could just define a new method that does this and leave the old one
as is.

> If that is not a correct approach, then I suppose that I need to check
> each paragraph on all levels myself. In this case, is there a way to
> iterate through all paragraphs and nested paragraphs of a selection? If
> there is not currently a way, would this be useful as a new helper
> method?

There must be a good way to do this, but I do not know what it is.

Riki

Reply via email to