Issue 50135

Summary: Deleting newline deletes formatting on subsequent line (when in empty paragraph)
Product: Writer Reporter: lohner <internationils>
Component: editingAssignee: andreas.martens
Status: CLOSED FIXED QA Contact: issues@sw <issues>
Severity: Trivial    
Priority: P3 CC: baumux, chris_mux, chrlutz, issues, jian.li, jnoreiko, mux2005, ooo, www.openoffice.org
Version: 680m104   
Target Milestone: ---   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Latest Confirmation in: ---
Developer Difficulty: ---
Attachments:
Description Flags
Display before delete with cursor on second line
none
Display of text after delete, with formatting of second heading line changed none

Description lohner 2005-05-31 15:14:56 UTC
Deleting a newline character when the next line has (for example) a Heading 1,
removes the heading 1 and forces the line to accept the style of the newline
that is being deleted.

To reproduce:
- Create 3 Heading 1 lines with some text (add outline numbering if desired)
- create a blank line after the first one
- go to that blank line and hit delete
- the next line will get the formatting of the blank line (shoudl be default in
this example)

Correct behavior would be that the next line retains it's style, since a delete
should remove only the next character, and that is the newline in this case.
Comment 1 lohner 2005-05-31 15:15:25 UTC
Created attachment 26760 [details]
Display before delete with cursor on second line
Comment 2 lohner 2005-05-31 15:15:57 UTC
Created attachment 26761 [details]
Display of text after delete, with formatting of second heading line changed
Comment 3 lohner 2005-05-31 15:45:51 UTC
Workaround: delete the subsequent newline from the line above it.  Problem: This
does not work in the first line of the document!
Comment 4 michael.ruess 2005-05-31 15:47:20 UTC
MRU->FL: Currently it works as designe din Writer. But in this special case it
may be good to change the behaviour.
When cursor is placed in an empty paragraph and one presses "Delete", it may be
desired by the user to keep the format of the paragraph following the empty one.
In this special case, this behaviour  seems to be industry standard.
Comment 5 frank.loehmann 2005-06-20 11:51:04 UTC
Set target to OO_later


might be a candidate for OOo 2.02.
Comment 6 frank.loehmann 2005-07-25 16:34:42 UTC
Change issue type to enhancement.
Comment 7 michael.ruess 2006-02-21 15:55:59 UTC
*** Issue 62388 has been marked as a duplicate of this issue. ***
Comment 8 Mathias_Bauer 2007-01-31 20:00:02 UTC
It's time to clean this up. We need to consider the deletion of paragraphs as a
whole but whatever comes out of this I agree that deleting an empty paragraph
using "DEL" should not transfer the formatting of it to the next one.
Comment 9 Mathias_Bauer 2007-03-31 19:23:02 UTC
This issue will cover the whole story of how paragraph attributes shall be set
in case two paragraphs become one.
Comment 10 Mathias_Bauer 2007-03-31 19:23:26 UTC
*** Issue 75954 has been marked as a duplicate of this issue. ***
Comment 11 lohner 2007-04-03 13:23:56 UTC
IMO...

- when at the end of a paragraph, and deleting
...if the current paragraph is empty, retain the formatting of the next
paragraph (special case)
...else retain the formatting of the current paragraph and apply forward until
the next newline (normal case)

- when at the beginning of a paragraph, and backspacing
...if the current paragraph is empty, retain the formatting of the former
paragraph (special case)
...else retain the formatting of the current paragraph and apply backward until
the previous newline (normal case)

- when pasting into a paragraph, retain the old formatting of the copied/cut
paragraph (doing this differently kills large multi-format pastes).  Other
pastes should be paste special. Or have a checkbox option somewhere to 'retain
source formatting on paste'.

This is a first suggestion... seems to work, seems coherent, but may not cover
all cases.
Comment 12 Mathias_Bauer 2007-06-25 08:44:05 UTC
target 2.x
Comment 13 michael.ruess 2007-07-31 09:18:51 UTC
*** Issue 80205 has been marked as a duplicate of this issue. ***
Comment 14 ansorg 2007-07-31 09:37:05 UTC
CCing

and as mentioned in the duplicate issue 80205, the suggested workaround (desc4)
is not available for empty paragraph after a table.
Comment 15 jolatt 2007-07-31 10:17:22 UTC
I don't understand this requirement.
For me the behaviuor of OOo is IMO logical.

The paragraph character says, that a new paragraph (with another format) will
follow. If you delete this character (cursor at the end of the paragraph and
press DEL) means creating a new paragraph is obsolete and the content of it gets
consequentially the format of the paragraph on which end the paragraph character
was deleted.
Comment 16 jnoreiko 2007-07-31 11:26:16 UTC
It's logical to a programmer, but not to a user.
If I delete the paragraph mark, what I perceive I am doing is absorbing the
second paragraph into the first. The topmost paragraph is the most important, so
its formatting should win.
Comment 17 pmike 2007-07-31 15:52:16 UTC
Jolatt, you're correct when two non-empty paragraphs to be merged.
But when user want to remove *empty* (which is meaningless, just empty vertical
space in poor formatted docs) paragraph, he prefer to keep formatting of next
paragraph. I presume this is the only case for this RFE.
Comment 18 Mathias_Bauer 2007-12-04 13:30:29 UTC
target 3.0
Comment 19 snofriacus 2008-03-05 10:43:14 UTC
see issues 65384 and 79017 for other perspectives on this problem
Comment 20 Mathias_Bauer 2008-04-21 17:28:40 UTC
From issue 65384:

We have discussed this issue on discuss@ux.openoffice.org. Unfortunately there
was no clear pro or cons about this proposed change. Some people proposed to
keep the old functionality alternatively or add some more magic to handle
paragraphs with white spaces like empty paragraphs. But I do not think that we
need the old and new behavior in parallel. We have several other Ctrl+Backspace
or Alt+Return shortcuts not known by users today. So lets keep it straight
forward without magic:

Always keep the paragraph format of the upper paragraph if paragraph is not
empty. Empty paragraphs will just be deleted.

I think this makes the most sense.

I'm still wondering how headings should be treated. IMHO headings should be
treated like empty paragraphs here - I can't imagine a situation where moving
floating text into a heading line (e.g. to delete the heading line) should cause
that the whole text will be formatted as "heading".

But as currently headings are treated in the completely opposite way I assume
that there was a reason to do so. Needs investigation.
Comment 21 Mathias_Bauer 2008-04-21 17:29:47 UTC
*** Issue 65384 has been marked as a duplicate of this issue. ***
Comment 22 Mathias_Bauer 2008-04-21 17:30:55 UTC
*** Issue 79017 has been marked as a duplicate of this issue. ***
Comment 23 Mathias_Bauer 2008-04-24 17:31:32 UTC
Andreas, in case you can find some time to do that not too close before code
freeze we could do it for 3.0
Comment 24 andreas.martens 2008-05-19 14:16:55 UTC
The old behavior:
the direction of the selection causes a different result.
If your selection starts in the first paragraph and ends in the second (e.g.
pressing DEL at the end of 1. paragraph), the paragraph style of the first
paragraph wins.
If your selection starts in the second paragraph (e.g. pressing <BACKSPACE> at
the beginning of the second paragraph), the paragraph style of the second
paragraph wins.
There is an additional condition: if the second paragraph is selected completely
(e.g. an empty paragraph) or the first paragraph has a numbering(e.g. a
heading!) then the first paragraph style is the winner regardless of the
direction of the selection.

Proposed new behavior:
The direction of the selection has no influence.
The paragraph style of the first paragraph is used for the new merged paragraph
with one exception: if the first paragraph is selected completely _and_ the
second paragraph is not selected completely, then the paragraph style of the
second paragraph wins.
Comment 25 andreschnabel 2008-05-19 18:09:17 UTC
question for clarification:

Is an empty paragraph "selected completely" by definition? 
Or rephrased: If first paragraph is empty and DEL is pressed, will the style of
the second paragraph win?
Comment 26 andreas.martens 2008-05-20 07:56:49 UTC
ama->andre:
Yes, an empty paragraph is always completely selected.
=> The style of the second paragraph will win, if you press DEL at the end of an
empty paragraph.
Exception: if the second paragraph is completely selected, too (e.g. empty), the
first paragraph style will win even it was an empty paragraph.
Comment 27 snofriacus 2008-05-20 15:10:25 UTC
For further clarification - It's not immediately clear to me how the proposed
new behavior will affect the following situations:

Suppose I have a heading line followed by a paragraph of regular text. The
current behavior is that if I delete the heading line by putting the cursor at
the beginning of the line, then holding shift while I press the down arrow, and
then pressing the <Del> key, the text below loses its previous format, replaced
now by the format of the heading. 

Or going the other direction, if I select the heading line by putting the cursor
at the beginning of the regular text, then holding shift while I press the up
arrow, and then pressing the <Del> key, the text below again loses its previous
format, replaced by the format of the heading. 

What I expect to see happen in both of these situations is that the heading line
should just go away without affecting the format of the text below. Will the
proposed new behavior accomplish this?

The other situation that troubles me when editing is that when I press Ctrl-V
immediately after Ctrl-X, (with a heading line selected for example, and the
following paragraph having some other style) though my expectation is that the
format should now be restored to exactly what it was before the cut & paste,
this sequence of operations results in odd changes to the styles of the
paragraphs involved. I would want to be sure that the new behavior is tested
with several such situations to ensure that cut & paste is now non-destructive -
that pasting right after cutting will restore the original format.
Comment 28 andreas.martens 2008-05-20 16:19:15 UTC
ama->snofriacus:
Yes, in your example with heading the heading-paragraph is selected completely
=> the next paragraph will not change its style when you press DEL.

And yes, the Ctrl-X and Ctrl-V behavior will fit your expectation better than
the old behavior. But a Ctrl-V is not the undo of a Ctrl-X. So not in every case
a Ctrl-V will work like undo-ing Ctrl-X.
Comment 29 andreas.martens 2008-05-27 13:13:32 UTC
Fixed in CWS sw30parajoin

docedt.cxx
docredln.cxx
nodes.cxx
Comment 30 michael.ruess 2008-06-11 09:15:23 UTC
Verified in CWS sw30parajoin.
Comment 31 michael.ruess 2008-07-04 15:33:32 UTC
*** Issue 90731 has been marked as a duplicate of this issue. ***
Comment 32 redflagzhulihua 2008-08-06 08:05:54 UTC
Verified in DEV300m28 with Windows XP and Fedora 8
Comment 33 redflagzhulihua 2008-08-06 08:11:28 UTC
closing