Page 1 of 1

quick viewer bug

Posted: 2003 Dec 16, 09:10
by sgp
alpha 0.51 win2k SP4
create two text files:
1.txt 1 line,7 chars,text is "1.txt" (no quotes)
2.txt 0 lines,2 chars, text is "" (no quotes)
turn on quick viewer
view 1.txt -> see "1.txt"
view 2.txt -> see "(new line)1.txt" INCORRECT

Posted: 2003 Dec 16, 09:37
by narayan
I repeated the experiment in Win NT4 (NTFS partition), but could not find the same error. QuickViewer shows gray area (nothing) when viewing an empty file (i.e., 0 bytes size). That's fine.

But then I tried to view a txt file with a single space, instead of a totally blank file. (The other txt file had some random text, as before.)

This time DBMon trapped three errors:
189: C:\Documents and Settings\umeca74\My Documents\cpp\kenny\folderItem.cpp(1667) : Assertion failed: !(m_dwPreviewCaps & 0x0E)
189: C:\Documents and Settings\umeca74\My Documents\cpp\kenny\quickView.cpp(613) : Assertion failed: str.GetLength()
189: C:\Documents and Settings\umeca74\My Documents\cpp\kenny\quickView.cpp(746) : Assertion failed: buf.GetLength() && mode
Ultimately I even deleted the other file, and got the same result. That means the presence/absence of other files does not affect the outcome of the experiment.

Conclusion: I think this is an extreme case, because such 'near empty" files are going to be rarely found in real world.

Posted: 2003 Dec 16, 10:06
by sgp
NOTE: to reproduce this problem 2.txt should be 1 line, TWO chars, not zero chars. If it's zero chars then qview displays just a gray background as stated above.

Posted: 2003 Dec 16, 11:54
by narayan
Nikos, obviously these are two separate problems.

I tried using a two-character file, but the problem does not appear for me.
* I tried using two characters (example: "ab", without quotes). The file appears properly in QV.
* I tried two spaces, and even then the file appears properly in QV (of course, it's all white).

I tried different sorting orders, but the result is the same.

Only when I put a single space in the file there a problem I described earlier.
And as I said, it does NOT depend on other file(s): occurs independently.

Posted: 2003 Dec 16, 14:25
by JRz
The two chars sgp is talking about are the chars for 'carriage return' and 'new line' respectively. When you create a file (let's call it temp.txt) with only those chars, the following occurs:

1. if you select temp.txt without having Quick Viewed any other file previously and hit Ctrl+Q to get the quick viewer, it shows an empty line and on the second line the text: RichQV
2. if you then select another file it shows the contents correctly (if it's a normal file). When you switch back to temp.txt, the QV shows the contents of file you just saw, but then shifted down one line.

So it seems the richEdit viewer is behaving weird when a file consists of only an empty line which is terminated by CR/LF. If you have a second file which is identical to temp.txt and switch between them, you'll see the contents of the quick viewer pane shifting down one line each time you switch files.