Bug 127041 - Line break inputed by Shift+Enter doesn't properly export to TXT format
Summary: Line break inputed by Shift+Enter doesn't properly export to TXT format
Status: RESOLVED NOTABUG
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Writer (show other bugs)
Version:
(earliest affected)
6.2.6.2 release
Hardware: All Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
Depends on:
Blocks: Paragraph
  Show dependency treegraph
 
Reported: 2019-08-20 03:02 UTC by Ming Hua
Modified: 2019-08-31 01:38 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
Example ODT file containing Shift+Enter line breaks (9.34 KB, application/vnd.oasis.opendocument.text)
2019-08-20 03:02 UTC, Ming Hua
Details
Screenshot of the TXT file opened in gVim (12.68 KB, image/png)
2019-08-31 01:38 UTC, Ming Hua
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Ming Hua 2019-08-20 03:02:59 UTC
Created attachment 153526 [details]
Example ODT file containing Shift+Enter line breaks

According to the help files, Shift+Enter inserts a line break without making a new paragraph.  I use this feature a lot, often for a few short items when I don't want to use a bullet list.

However I found out that if I export an ODT file containing such line breaks to TXT format on Windows, I get text files with mixed LF and CR+LF line breaks.  The normal - with new paragraphs - line breaks export to the expected Windows CR+LF line breaks, while the Shift+Enter line breaks export to LF-only line breaks.

This is problematic because notepad.exe doesn't recognize LF-only line breaks, and as a result my list of short items all end up in one single line when viewed in Notepad.

This most likely doesn't affect Linux as it uses LF line breaks only.  I'm not sure what the behavior is on Mac.

My LO version info:
Version: 6.2.6.2 (x64)
Build ID: 684e730861356e74889dfe6dbddd3562aae2e6ad
CPU threads: 2; OS: Windows 10.0; UI render: default; VCL: win; 
Locale: zh-CN (zh_CN); UI-Language: en-US
Calc: threaded
Comment 1 Dieter 2019-08-29 19:59:13 UTC
How do you open txt-file? If I reopen file in Windows, I can't reproduce it?


Version: 6.2.5.2 (x64)
Build ID: 1ec314fa52f458adc18c4f025c545a4e8b22c159
CPU threads: 4; OS: Windows 10.0; UI render: GL; VCL: win; 
Locale: de-DE (de_DE); UI-Language: en-GB
Calc: threaded
Comment 2 Ming Hua 2019-08-30 02:27:08 UTC
(In reply to Dieter Praas from comment #1)
> How do you open txt-file? If I reopen file in Windows, I can't reproduce it?

As I mentioned in the original report, the problem is most apparent when the TXT file is opened with notepad.exe (Windows Start Menu -> Windows Accessories -> Notepad).  Wordpad.exe seems to be able to handle LF-only line breaks.

Regardless, even if the file displays fine in many programs, it's never a good idea to mix CR-LF and LF-only line breaks in the same file.
Comment 3 Dieter 2019-08-30 07:42:06 UTC
I confirm the described behaviour, but I'm not so firm in that topic, that I can assess, if it is a bug or not. I hope, somebody else can help.
Comment 4 V Stuart Foote 2019-08-30 11:42:13 UTC
Hmm, not sure how OP has configured the MS notepad.exe, but its default settings with or without 'word wrap' enabled does distinguish and show the <LF> and <CR><LF>

As does  wordpad.exe.

As does notpad++.exe

As does gvim.exe

In short, not seeing an issue with our handling of <CR> vs <CR><LF>. While doing anythiing different with the distinction would in fact cause problems.

=> NAB
Comment 5 Ming Hua 2019-08-31 01:38:35 UTC
Created attachment 153773 [details]
Screenshot of the TXT file opened in gVim

(In reply to V Stuart Foote from comment #4)
> Hmm, not sure how OP has configured the MS notepad.exe, but its default
> settings with or without 'word wrap' enabled does distinguish and show the
> <LF> and <CR><LF>

My MS Notepad is definitely in the default setting.  AFAIK there is no setting in notepad for different kind of line breaks, and the "word wrap" setting will never make two or more lines displayed in one line.  The MS notepad behavior of not recognize LF-only line break has a long history and is well documented.

> As does gvim.exe

While gVim indeed displays the file with line breaks, it does highlight the fact that there are both CR+LF and LF-only line breaks in the file, by showing the <CR> character as "^M", see attached screenshot.

> While
> doing anythiing different with the distinction would in fact cause problems.

What kind of problems do you forsee?