Re: Bug 81720

2022-08-23 Thread Michael Stahl

On 23.08.22 13:12, Michael Stahl wrote:

On 19.08.22 15:41, Phillips Rogfield wrote:

Dear developers,

I would like to fix bug 81720 
<https://bugs.documentfoundation.org/show_bug.cgi?id=81720#c22>.


Basically when you insert a ReferenceMark, if you put the cursor at 
the edge of it (start or end), and type something, it will expand on 
the reference mark instead of writing it as a “normal text”.


You can find how to reproduce it in comment 22 
<https://bugs.documentfoundation.org/show_bug.cgi?id=81720#c22>.


I have set up my environment, but I’m not sure where is the code that 
“checks” if something is a ReferenceMark, if anything.


Can you point me in the right direction, please?


so firstly, while cross references are fields, the reference marks are 
not fields in Writer.


there are 2 different kinds of reference mark, both represented by a 
SwTextAttr with ID RES_TXTATR_REFMARK.


one has a dummy character in the text, CH_TXTATR_INWORD, and behaves 
similar to a field - it does not have an end position, so it cannot mark 
text, it only contains its dummy character.


the other has a start and end position, but no dummy character - this is 
the one you're concerned about.


these SwTextAttr all exist in a SwpHints array that is a member 
SwTextNode::m_pSwpHints, sorted in multiple different ways.


when editing the text, the hints start and end positions are adjusted in 
  SwTextNode::Update() and its base class SwContentIndexReg::Update() - 
it's rather complex code but i think you need to tweak these functions 
to fix the problem.


forgot one thing: bookmark positions already work in the way that you 
want reference marks to work, text is always inserted outside the 
bookmark - maybe you could find out how that is implemented in the 
Update functions.


Re: Bug 81720

2022-08-23 Thread Michael Stahl

On 19.08.22 15:41, Phillips Rogfield wrote:

Dear developers,

I would like to fix bug 81720 
<https://bugs.documentfoundation.org/show_bug.cgi?id=81720#c22>.


Basically when you insert a ReferenceMark, if you put the cursor at the 
edge of it (start or end), and type something, it will expand on the 
reference mark instead of writing it as a “normal text”.


You can find how to reproduce it in comment 22 
<https://bugs.documentfoundation.org/show_bug.cgi?id=81720#c22>.


I have set up my environment, but I’m not sure where is the code that 
“checks” if something is a ReferenceMark, if anything.


Can you point me in the right direction, please?


so firstly, while cross references are fields, the reference marks are 
not fields in Writer.


there are 2 different kinds of reference mark, both represented by a 
SwTextAttr with ID RES_TXTATR_REFMARK.


one has a dummy character in the text, CH_TXTATR_INWORD, and behaves 
similar to a field - it does not have an end position, so it cannot mark 
text, it only contains its dummy character.


the other has a start and end position, but no dummy character - this is 
the one you're concerned about.


these SwTextAttr all exist in a SwpHints array that is a member 
SwTextNode::m_pSwpHints, sorted in multiple different ways.


when editing the text, the hints start and end positions are adjusted in 
 SwTextNode::Update() and its base class SwContentIndexReg::Update() - 
it's rather complex code but i think you need to tweak these functions 
to fix the problem.







Re: Bug 81720

2022-08-19 Thread Andrew Pitonyak
Phil,

You surely do NOT need my approval :-)

I was just asking since it seems consistent with other things in libre office.

Now I am curious about a field as the last thing in a document.  :-)

Had not considered using ESC to put the cursor out of a field, on the surface 
it feels like a really smart solution, but to be clear, if the devs choose to 
simply have an adjacent chair always be outside the field I would not complain, 
it would solve the end of document problem but makes it more difficult to 
append text in a field or deal with a one character looking field.

The zero length field... Uggg. Had not considered that one.

I am very happy to see how thoroughly y'all are working to get a correct 
solution.

Andrew.

⁣Get BlueMail for Android ​

On Aug 19, 2022, 7:26 PM, at 7:26 PM, Phillips Rogfield  
wrote:
>Hello,
>
>You are right that by putting the cursor to the left it writes normal
>text. It only happens when you put the cursor to the right of the
>field.
>
>It is not necessary that the field is the last thing in a file. It is
>sufficient it is the last thing in a paragraph. In this case you won't
>be able to insert text after the field without expanding the field. At
>least it will be not so simple. You will have to press Enter, space,
>left arrow, backspace, right arrow, and type.
>
>I also noticed an exception: if you don't select anything, and do
>Insert
>-> Cross Reference ->  Set Reference, type a name, press Insert and
>then
>Close, it will insert an empty reference (which I have no idea why it
>differs conceptually from a bookmark?). This empty reference will be
>not
>modifiable: nor by putting the cursor to the left nor to the right, the
>
>text of the reference will stay empty.
>
>So exception aside, I think maybe a good compromise would be that, if
>the user put the cursor on the right of a field, and press "Esc", it
>will start to type outside of the field, without expanding the field?
>Would that work?
>
>Best,
>
>Phil
>
>On 19/08/2022 16:04, Andrew Pitonyak wrote:
>> The general expected behavior in libre office, at least for me, is
>> that if I place the cursor and start typing, that it will continue
>> using the same attributes and properties of the character directly to
>
>> the left of the cursor. So, if I have bold text, and I placed the
>> cursor to the left of the bold text and I type, it will not be bold,
>> it will be whatever is to the left of the cursor. If the cursor is
>> immediately to the right of the bold text however then it will be
>bold.
>>
>> In this case, I assume, but have not verified or checked in anyway, 
>> references are a field. So the intent of this is to make certain that
>
>> when the cursor is sitting directly to the left or right of, whatever
>
>> is typed does not end up inside of that field. One side effect of
>this
>> I expect, is that if you have a field with only one character you
>will
>> have no way of modifying the text inside the field unless there is
>> some special case when the text of the field is selected. I did not
>> even check, can I select the text in a field? So what if the
>selection
>> is partially in a field?
>>
>> I would never have considered this a bug, I would have just
>considered
>> it an extension of expected behavior. The annoying part is that if
>the
>> field is the last thing in a file you have no way to add text after
>> the field unless you do it programmatically, but that is also true
>> last I checked of text tables.
>>
>> I hope other contributors to comments in the bugs are correct that it
>
>> is an easy fix, but I am skeptical.
>>
>> Get BlueMail for Android <https://bluemail.me>
>> On Aug 19, 2022, at 9:41 AM, Phillips Rogfield
>
>> wrote:
>>
>> Dear developers,
>>
>> I would like to fix bug 81720
>> <https://bugs.documentfoundation.org/show_bug.cgi?id=81720#c22>.
>>
>> Basically when you insert a ReferenceMark, if you put the cursor
>> at the edge of it (start or end), and type something, it will
>> expand on the reference mark instead of writing it as a “normal
>text”.
>>
>> You can find how to reproduce it in comment 22
>> <https://bugs.documentfoundation.org/show_bug.cgi?id=81720#c22>.
>>
>> I have set up my environment, but I’m not sure where is the code
>> that “checks” if something is a ReferenceMark, if anything.
>>
>> Can you point me in the right direction, please?
>>
>> Best,
>>
>> Phil
>>
>> ​
>>


Re: Bug 81720

2022-08-19 Thread Phillips Rogfield

Hello,

You are right that by putting the cursor to the left it writes normal 
text. It only happens when you put the cursor to the right of the field.


It is not necessary that the field is the last thing in a file. It is 
sufficient it is the last thing in a paragraph. In this case you won't 
be able to insert text after the field without expanding the field. At 
least it will be not so simple. You will have to press Enter, space, 
left arrow, backspace, right arrow, and type.


I also noticed an exception: if you don't select anything, and do Insert 
-> Cross Reference ->  Set Reference, type a name, press Insert and then 
Close, it will insert an empty reference (which I have no idea why it 
differs conceptually from a bookmark?). This empty reference will be not 
modifiable: nor by putting the cursor to the left nor to the right, the 
text of the reference will stay empty.


So exception aside, I think maybe a good compromise would be that, if 
the user put the cursor on the right of a field, and press "Esc", it 
will start to type outside of the field, without expanding the field? 
Would that work?


Best,

Phil

On 19/08/2022 16:04, Andrew Pitonyak wrote:
The general expected behavior in libre office, at least for me, is 
that if I place the cursor and start typing, that it will continue 
using the same attributes and properties of the character directly to 
the left of the cursor. So, if I have bold text, and I placed the 
cursor to the left of the bold text and I type, it will not be bold, 
it will be whatever is to the left of the cursor. If the cursor is 
immediately to the right of the bold text however then it will be bold.


In this case, I assume, but have not verified or checked in anyway,  
references are a field. So the intent of this is to make certain that 
when the cursor is sitting directly to the left or right of, whatever 
is typed does not end up inside of that field. One side effect of this 
I expect, is that if you have a field with only one character you will 
have no way of modifying the text inside the field unless there is 
some special case when the text of the field is selected. I did not 
even check, can I select the text in a field? So what if the selection 
is partially in a field?


I would never have considered this a bug, I would have just considered 
it an extension of expected behavior. The annoying part is that if the 
field is the last thing in a file you have no way to add text after 
the field unless you do it programmatically, but that is also true 
last I checked of text tables.


I hope other contributors to comments in the bugs are correct that it 
is an easy fix, but I am skeptical.


Get BlueMail for Android <https://bluemail.me>
On Aug 19, 2022, at 9:41 AM, Phillips Rogfield  
wrote:


Dear developers,

    I would like to fix bug 81720
<https://bugs.documentfoundation.org/show_bug.cgi?id=81720#c22>.

Basically when you insert a ReferenceMark, if you put the cursor
at the edge of it (start or end), and type something, it will
expand on the reference mark instead of writing it as a “normal text”.

You can find how to reproduce it in comment 22
<https://bugs.documentfoundation.org/show_bug.cgi?id=81720#c22>.

I have set up my environment, but I’m not sure where is the code
that “checks” if something is a ReferenceMark, if anything.

Can you point me in the right direction, please?

Best,

Phil

​


Re: Bug 81720

2022-08-19 Thread Andrew Pitonyak
The general expected behavior in libre office, at least for me, is that if I 
place the cursor and start typing, that it will continue using the same 
attributes and properties of the character directly to the left of the cursor. 
So, if I have bold text, and I placed the cursor to the left of the bold text 
and I type, it will not be bold, it will be whatever is to the left of the 
cursor. If the cursor is immediately to the right of the bold text however then 
it will be bold.

In this case, I assume, but have not verified or checked in anyway,  references 
are a field. So the intent of this is to make certain that when the cursor is 
sitting directly to the left or right of, whatever is typed does not end up 
inside of that field. One side effect of this I expect, is that if you have a 
field with only one character you will have no way of modifying the text inside 
the field unless there is some special case when the text of the field is 
selected. I did not even check, can I select the text in a field? So what if 
the selection is partially in a field?

I would never have considered this a bug, I would have just considered it an 
extension of expected behavior. The annoying part is that if the field is the 
last thing in a file you have no way to add text after the field unless you do 
it programmatically, but that is also true last I checked of text tables.

I hope other contributors to comments in the bugs are correct that it is an 
easy fix, but I am skeptical.

⁣Get BlueMail for Android ​

On Aug 19, 2022, 9:41 AM, at 9:41 AM, Phillips Rogfield  
wrote:
>Dear developers,
>
>I would like to fix bug 81720
><https://bugs.documentfoundation.org/show_bug.cgi?id=81720#c22>.
>
>Basically when you insert a ReferenceMark, if you put the cursor at the
>
>edge of it (start or end), and type something, it will expand on the
>reference mark instead of writing it as a “normal text”.
>
>You can find how to reproduce it in comment 22
><https://bugs.documentfoundation.org/show_bug.cgi?id=81720#c22>.
>
>I have set up my environment, but I’m not sure where is the code that
>“checks” if something is a ReferenceMark, if anything.
>
>Can you point me in the right direction, please?
>
>Best,
>
>Phil
>
>​


Re: Bug 81720

2022-08-19 Thread Ilmari Lauhakangas

On 19.8.2022 16.41, Phillips Rogfield wrote:

Dear developers,

I would like to fix bug 81720 
<https://bugs.documentfoundation.org/show_bug.cgi?id=81720#c22>.


Basically when you insert a ReferenceMark, if you put the cursor at the 
edge of it (start or end), and type something, it will expand on the 
reference mark instead of writing it as a “normal text”.


You can find how to reproduce it in comment 22 
<https://bugs.documentfoundation.org/show_bug.cgi?id=81720#c22>.


I have set up my environment, but I’m not sure where is the code that 
“checks” if something is a ReferenceMark, if anything.


Can you point me in the right direction, please?


If you look at the file attached to the report (flat ODF), it has

text:name="fooname"/>foo


Grepping then with

git grep 'reference-mark-start'

yields interesting results like

xmloff/source/core/xmltoken.cxx:TOKEN( "reference-mark-start", 
  XML_REFERENCE_MARK_START ),


Hopefully it can help you.

I have no experience with the topic :)

Ilmari


Bug 81720

2022-08-19 Thread Phillips Rogfield

Dear developers,

I would like to fix bug 81720 
<https://bugs.documentfoundation.org/show_bug.cgi?id=81720#c22>.


Basically when you insert a ReferenceMark, if you put the cursor at the 
edge of it (start or end), and type something, it will expand on the 
reference mark instead of writing it as a “normal text”.


You can find how to reproduce it in comment 22 
<https://bugs.documentfoundation.org/show_bug.cgi?id=81720#c22>.


I have set up my environment, but I’m not sure where is the code that 
“checks” if something is a ReferenceMark, if anything.


Can you point me in the right direction, please?

Best,

Phil

​