Bug 167767 - kwrite doesn't show file contents if it contains only one line
Summary: kwrite doesn't show file contents if it contains only one line
Status: RESOLVED FIXED
Alias: None
Product: kate
Classification: Applications
Component: kwrite (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: HI major
Target Milestone: ---
Assignee: Hamish Rodda
URL:
Keywords:
: 167093 167140 169261 169907 170039 170700 174965 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-07-30 18:59 UTC by Benno Dielmann
Modified: 2008-11-20 18:44 UTC (History)
14 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Benno Dielmann 2008-07-30 18:59:18 UTC
Version:           4.1.00 (using KDE 4.1.0)
Installed from:    Ubuntu Packages
OS:                Linux

If kwrite (or kate) opens a file containing just one line, nothing gets displayed at all (file appears to be empty). Only if you press enter thus entering a new line, the previously hidden line gets displayed.
Comment 1 Andreas Pakulat 2008-07-30 20:22:22 UTC
I can't reproduce this here, does your file have special characters in it? Can you post a sample file that triggers this?
Comment 2 Dario Andres 2008-07-30 20:42:37 UTC
Using KDE 4.1.00 (KDE 4.1.0) (KDEmod) in ArchLinux i686:
I can confirm this bug.

Steps to reproduce:
- Open KWrite
- Write something in only one line, save the file, close Kwrite.
- Open Kwrite again, load the file.
The text isn't visible until you press return and it's moved one line down.
If you press backspace and delete the ""\n"", the text is now displayed Ok in the first line.

Another case for this bug:
-Open KWrite with a non-existent filename as parameter. 
- KWrite will complain about that file doesn't exist, click OK
- Write in the first line: the text will not appear.
If you press return now, the cursor will move down, and the text will appear in the first line

In both cases, even if you select/highlight the text, it won't appear at the first time.
Comment 3 Dominik Tritscher 2008-07-30 23:15:36 UTC
I can confirm this following testcase instructions given in Dario's comment. No special chars just "This is a test.", UTF-8 encoding.
I'm using KDE4.1 from Kubuntu packages.
Comment 4 Andreas Pakulat 2008-07-31 11:37:46 UTC
yeap, with kwrite it happens, but not with kate or other apps using katepart.
Comment 5 Dominik Tritscher 2008-07-31 19:36:55 UTC
Here it happens with kwrite and kate.
Comment 6 Dario Andres 2008-08-09 20:42:30 UTC
bug 167140 is a duplicate of this bug
Comment 7 Christoph Cullmann 2008-08-13 12:42:29 UTC
*** Bug 167140 has been marked as a duplicate of this bug. ***
Comment 8 Christoph Cullmann 2008-08-13 13:49:00 UTC
*** Bug 167093 has been marked as a duplicate of this bug. ***
Comment 9 Christoph Cullmann 2008-08-13 13:50:26 UTC
Could you take a look, real evil problem, best way to reproduce:

echo blubb > test.txt
kwrite test.txt

empty first line, text can be edited invisible, cursor only moves on insert, return and text gets visible, normally all problems only the if dyn-wordwrap is activated.
Comment 10 Dotan Cohen 2008-08-16 23:07:37 UTC
I can confirm this bug on Kubuntu 8.10 with KDE 4.1 in Kate.
Comment 11 Dotan Cohen 2008-08-16 23:08:27 UTC
*** Bug 169261 has been marked as a duplicate of this bug. ***
Comment 12 Christoph Cullmann 2008-08-18 20:17:22 UTC
Seems to work with current /trunk, please retest
Comment 13 Andreas Pakulat 2008-08-27 12:33:35 UTC
*** Bug 169907 has been marked as a duplicate of this bug. ***
Comment 14 George Kiagiadakis 2008-08-29 16:55:43 UTC
*** Bug 170039 has been marked as a duplicate of this bug. ***
Comment 15 Andreas Pakulat 2008-09-09 22:52:09 UTC
*** Bug 170700 has been marked as a duplicate of this bug. ***
Comment 16 Dotan Cohen 2008-10-09 15:11:02 UTC
I can confirm that this is fixed in the KDE provided with Kubuntu 8.10. Thanks.
Comment 17 janow49420 2008-10-09 16:15:29 UTC
Kate Part Version 3.1 Using KDE 4.1.2 (KDE 4.1.2) (KDEmod) KWrite Version 4.1.2

The bug still, exists is it possible we could find the revision, so a patch could be made?
Comment 18 Jean-Philippe Fleury 2008-10-31 03:41:38 UTC
I have this bug with Kate 3.1.2.
Comment 19 Dario Andres 2008-11-07 17:41:54 UTC
Qt: 4.4.3
KDE: 4.1.3 (KDE 4.1.3)
KWrite: 4.1.3 (KDE 4.1.3)

Here I'm able to reproduce this bug (again) using the second method described in my comment 2. However I cannot reproduce the bug using the method described by Christoph in comment 9 (the text is displayed OK)

Now, I've discovered a new method to trigger the bug. (creating a new empty file from shell using "touch")
eg. touch file.txt && kwrite file.txt

If you write some text it won't appear until you press Return.

Comment 20 Andreas Pakulat 2008-11-12 20:56:12 UTC
*** Bug 174965 has been marked as a duplicate of this bug. ***
Comment 21 janow49420 2008-11-20 17:20:36 UTC
@ #16 claims this bug is fixed with Kubuntu 8.10 Intrepid Ibex

I am now using Kubuntu 8.10 and I can confirm this bug is _not_ fixed

Qt: 4.4.3
KDE: 4.1.3 (KDE 4.1.3)
KWrite: 4.1.3 (KDE 4.1.3)

I was using Kwrite component v3.1
Comment 22 janow49420 2008-11-20 17:35:54 UTC
And yes comment 9 works. but it's because kwrite is for some reason adding a line by the looks of it.

For example, if you:

1. echo "Testing" > test.txt
2. kwrite test.txt
3. Remove the second line, (there is one there if you press the down key)
4. Open it in kwrite, you shall notice the text is invisible again.

Kwrite should open the document no matter what, and not add a line to it like it appears to be doing.
Comment 23 Anne-Marie Mahfouf 2008-11-20 17:49:59 UTC
The only thing I can reproduce on KWrite trunk is that 
echo "blah" > text.txt
adds a second line to the file.

Removing that second line doe snot remove the text though.
Comment 24 Anne-Marie Mahfouf 2008-11-20 17:50:28 UTC
The only thing I can reproduce on KWrite trunk is that 
echo "blah" > text.txt
adds a second line to the file.

Removing that second line does not remove the text though.
Comment 25 Benno Dielmann 2008-11-20 18:15:10 UTC
I can confirm the bug is still there in kwrite and kate in KDE 4.1.3 as provided by Kubuntu 8.10. 
To reproduce, 

1. open kwrite
2. enter a line of text (only one)
3. save as test.txt and close kwrite
4. reopen kwrite and load test.txt

The file appars to be empty; if you press enter thus entering a line break at the beginning of line 1, the text you wrote in 2. appears. 
Comment 26 Anne-Marie Mahfouf 2008-11-20 18:44:15 UTC
The bug is fixed in trunk (4.2) for the text disappearance. Not sure how it was fixed and if the fix could be backported so we don't have people reporting it still in 4.1.x...