Discussion:
[LyX/master] Fix wrong indentation on screen.
Enrico Forestieri
2014-05-21 20:04:04 UTC
Permalink
commit a17710e4995584932fe6d1540927e58f526477f8
Date: Wed May 21 21:47:01 2014 +0200
Fix wrong indentation on screen.
LyX fails to indent on screen a standard paragraph when it is
nested into an environment. The fix is a one-liner but the diff
is larger because it also fixes a previous wrong indentantion
in the source ;)
Richard, this could also go to the stable branch. It is a direct extension
of the fix at f5a246b1. I also attach a document demonstrating the issue.
--
Enrico
Richard Heck
2014-05-21 20:55:11 UTC
Permalink
Post by Enrico Forestieri
commit a17710e4995584932fe6d1540927e58f526477f8
Date: Wed May 21 21:47:01 2014 +0200
Fix wrong indentation on screen.
LyX fails to indent on screen a standard paragraph when it is
nested into an environment. The fix is a one-liner but the diff
is larger because it also fixes a previous wrong indentantion
in the source ;)
Richard, this could also go to the stable branch. It is a direct extension
of the fix at f5a246b1. I also attach a document demonstrating the issue.
I'll trust your judgement on this one. As you think best.

Richard
Enrico Forestieri
2014-05-21 22:04:08 UTC
Permalink
Post by Richard Heck
Post by Enrico Forestieri
commit a17710e4995584932fe6d1540927e58f526477f8
Date: Wed May 21 21:47:01 2014 +0200
Fix wrong indentation on screen.
LyX fails to indent on screen a standard paragraph when it is
nested into an environment. The fix is a one-liner but the diff
is larger because it also fixes a previous wrong indentantion
in the source ;)
Richard, this could also go to the stable branch. It is a direct extension
of the fix at f5a246b1. I also attach a document demonstrating the issue.
I'll trust your judgement on this one. As you think best.
I committed it. This is only cosmetic, so nothing risky.
--
Enrico
Enrico Forestieri
2014-05-22 15:25:27 UTC
Permalink
Post by Enrico Forestieri
Post by Richard Heck
Post by Enrico Forestieri
commit a17710e4995584932fe6d1540927e58f526477f8
Date: Wed May 21 21:47:01 2014 +0200
Fix wrong indentation on screen.
LyX fails to indent on screen a standard paragraph when it is
nested into an environment. The fix is a one-liner but the diff
is larger because it also fixes a previous wrong indentantion
in the source ;)
Richard, this could also go to the stable branch. It is a direct extension
of the fix at f5a246b1. I also attach a document demonstrating the issue.
I'll trust your judgement on this one. As you think best.
I committed it. This is only cosmetic, so nothing risky.
I just noticed that LyX is doing something strange here.
Load the document that I attached previously in this thread and:
1) put the cursor at the end of the first line;
2) hit return and notice that the following line gets more indented;
3) write something in the new line just created;
4) place the cursor somewhere else by using the mouse and notice
how the line that was previously more indented is now de-indented.

This is independent of this and the previous patch and also occurs
in version 2.0, but there the indentation is less pronounced.
--
Enrico
Enrico Forestieri
2014-05-22 20:35:30 UTC
Permalink
Post by Enrico Forestieri
I just noticed that LyX is doing something strange here.
1) put the cursor at the end of the first line;
2) hit return and notice that the following line gets more indented;
3) write something in the new line just created;
4) place the cursor somewhere else by using the mouse and notice
how the line that was previously more indented is now de-indented.
This is independent of this and the previous patch and also occurs
in version 2.0, but there the indentation is less pronounced.
I think I have found the reason of this strange behavior. In order
to decide how much to indent a nested paragraph, LyX checks the
left margin of the nesting layout by recursively calling
TextMetrics::leftMargin and passing as the pos parameter the
size of the first paragraph of the nesting layout it finds by
looking backwards. This method does not account for parindent
when pos > 0, but the just newly created paragraph is the one that
is found and it has size 0, such that the parindent parameter is
actually included in the left margin. Now LyX adds the parindent
of the current paragraph to the left margin just found, and thus
the parindent parameter gets added twice. When something is written
to the new paragraph, its size is not zero anymore and thus the
correct indentation is restored. I am thinking how to solve
this issue. Should not be difficult.
--
Enrico
Continue reading on narkive:
Loading...