Bug 261930

Summary: wish: plain text backend
Product: [Applications] okular Reporter: Christopher Yeleighton <giecrilj>
Component: New backend wishesAssignee: Okular developers <okular-devel>
Status: RESOLVED FIXED    
Severity: wishlist CC: aacid, mark, sputnikshock
Priority: NOR    
Version: 0.10.4   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In: 4.11.0

Description Christopher Yeleighton 2011-01-03 08:33:01 UTC
Version:           0.10.4 (using KDE 4.4.4) 
OS:                Linux

Plain text files are usually open in KWrite.  However, KWrite opens the file for editing, and the size of a file that can be edited is limited (Bug 250617).  So it would be useful to have a viewer that is capable of displaying text files of any size.  GNU 'less' is one such viewer, using character mode interface; however, no equivalent action exists in KDE (Bug 261925).

Reproducible: Always

Steps to Reproduce:
  1. Tell Okular to open a text file.

Actual Results:  
  1. Not supported.

Expected Results:  
  1. 
Okular displays the file without reading it all into RAM (which is not possible) and allows searching for text within it.
Backspace for boldening and underlining should be supported.

OS: Linux (x86_64) release 2.6.34.7-0.5-desktop
Compiler: gcc
Comment 1 Pino Toscano 2011-01-03 09:59:00 UTC
No sorry, this has already been rejected (see #155938, c1).
If your text editor is limited, then you should aim to have that fixed, not create workarounds that limitations (and fixing it will benefit for sure lot more people than creating a read-only viewer).
Comment 2 Christopher Yeleighton 2011-01-03 16:31:48 UTC
(In reply to comment #1)
> No sorry, this has already been rejected (see #155938, c1).
> If your text editor is limited, then you should aim to have that fixed, not
> create workarounds that limitations (and fixing it will benefit for sure lot
> more people than creating a read-only viewer).

It is not possible to have a text editor to edit an oversize text file.  No text editor I know supports files of arbitrary size.  It has been this way from the times of Norton Commander, which turned read-only in such a situation.

According to your reasoning, GNU less is redundant as well.

*** This bug has been marked as a duplicate of bug 155938 ***
Comment 3 mark 2012-04-16 07:58:06 UTC
(In reply to comment #1)
> No sorry, this has already been rejected (see #155938, c1).
> If your text editor is limited, then you should aim to have that fixed, not
> create workarounds that limitations (and fixing it will benefit for sure lot
> more people than creating a read-only viewer).

Bug 155938 - support for MS Word documents is *NOT* the same as this request.

This request is for a plain text backend, rather than for MS Word backend.

A plain text editor is not a suitable substite, if for no other reason that an ebook formatted in plain text is often hard to read using a plain text editor becaue of lack of suitable scrolling, zooming and page controls. There is also often a problem with word wrap, paragraph spacings and issues with correct display of Unicode / Western character sets.

The type of functionality desired for an Okular plain Text backed is found in the program FBreader, which does have a plain-text capability.

http://en.wikipedia.org/wiki/FBReader

The ebook-viewer component of Calibre also can display plain-text ebooks.

http://en.wikipedia.org/wiki/Calibre_%28software%29

When I want to read a plain-text formatted ebook on my KDE desktop, it is very annoying that KDE lacks a suitable plain-text viewer, and that I need to open up a non-KDE viewer application, either FBReader or ebook-viewer from Calibre, in order to comfortably read that document (with proper scrolling, paragraph formatting, zooming and searching functions).

This bug IMO is most definitely not resolved. It reamins a glaring omission in Okular's capabilities.
Comment 4 Albert Astals Cid 2012-04-16 17:18:05 UTC
to be honest i don't see what okular can give you above a regular text document viewer (kate, kwrite). Yes, the duplication is kind of weird, since it asks for a different thing, but anyhow, since none of the okular developers see a need for this, don't expect this happening anytime soon unless you can explain what's the point.
Comment 5 mark 2012-04-17 07:47:40 UTC
(In reply to comment #4)
> to be honest i don't see what okular can give you above a regular text
> document viewer (kate, kwrite). Yes, the duplication is kind of weird, since
> it asks for a different thing, but anyhow, since none of the okular
> developers see a need for this, don't expect this happening anytime soon
> unless you can explain what's the point.

OK, here is a free example of a plain-text book from smashwords:
http://www.smashwords.com/books/download/152391/6/latest/1/0/squatters-rights.txt

If you open this link in Firefox or Konqueror directly, you can't read the text, becaue there is no word wrap. If you open it in Rekonq, it is much closer to what we want in a plain-text viewer.

OK, from reKonq, now save the file on the local filesystem. Open it as a plain-text local file from Konqueror. This gets close to waht we need to read this plain-text ebbok. It pages OK using the spacebar, Ctrl+ and Ctrl- can be used to zoom the text ... Konqueror makes a fair enogh reader/viewer for this plain-text file.

OK, now open it in a text editor, such a Kwrite or Kate. You must first set the word-wrap option, and then you can read it, and even use Ctrl+ and Ctrl- to alter the font size. The default font isn't all that great fro reading as text editors are intended more for uses such as program source code, but it OK-ish. So I am not saying that plain-text ebooks cannot be read.

Now open the same text file in FBReader. Immediately it is apparent that there is a problem with the font, and a number of the special characters are garbled as a consequence. Apart from that, it is far more pleasant to read on-screen therein, because FBReader is designed for displaying and reading prose, it is not meant to be a source code text editor. In general, the user will have set up FBReader with a nice, screen-readable default font, such as Linux Libertine O, rather than a font designed for source code. It is just that FBReader behaves as a reader, and not as a source code editor.

The point is that the preferred application for reading stuff on KDE is okular. Okular boasts a feature that it can be used for mulitile ebook file formats ... epub, PDF, Mobipocket, Plucker, 	EPub ... but not simple plain-text.

ReKonq can be pressed into service for plain-text files, but it is very frustrating to have to use Rekonq for reading plain text and Okular for everything else. Why is okular so dismissive of plain text format?

The thing is, there is already sutable rendering code for plain text within Rekonq. We already have it. It handles various plain text special characters pretty well. And okular is generally a good reader program for the KDE desktop. One would like to use Okular for reading all kinds of format of ebooks one one's KDE desktop.

But palin text is the bugbear. It spoils the picture. Other (non-KDE) ebook reader programs do not have this bug-bear. They can all handle plain text pretty well. But not okular. Okular is for some reason prejudiced against the plain text format. Yet there **IS** already code (in Rekonq) which can do what would be desired as an okular plain text backend.

This is very, very annoying for an end user like myself. If I had the skills, I would fix it myself. It would rip out soem plain-text rendering code from Rekonq, and adapt it as a new backend for okular. Unfortunately, I don't know how to do that. But I would very much like to have it.

Hence, it seems to me, to be a very reasonable topic for a wishlist request. It would considerably add to the appeal of okular, and KDE, for me as an end user.

Pretty please?
Comment 6 mark 2012-04-17 08:01:46 UTC
(In reply to comment #5)
> (In reply to comment #4)
> > to be honest i don't see what okular can give you above a regular text
> > document viewer (kate, kwrite). Yes, the duplication is kind of weird, since
> > it asks for a different thing, but anyhow, since none of the okular
> > developers see a need for this, don't expect this happening anytime soon
> > unless you can explain what's the point.
> 
> OK, here is a free example of a plain-text book from smashwords:
> http://www.smashwords.com/books/download/152391/6/latest/1/0/squatters-
> rights.txt
> 
> If you open this link in Firefox or Konqueror directly, you can't read the
> text, becaue there is no word wrap. If you open it in Rekonq, it is much
> closer to what we want in a plain-text viewer.
> 
> OK, from reKonq, now save the file on the local filesystem. Open it as a
> plain-text local file from Konqueror. This gets close to waht we need to
> read this plain-text ebbok. It pages OK using the spacebar, Ctrl+ and Ctrl-
> can be used to zoom the text ... Konqueror makes a fair enogh reader/viewer
> for this plain-text file.

Sorry ... I meant to say in the bove that Rekonq was a reasonable plain-text ebook reader on KDE, not Konqueror.

My main point is that okular is my preferred program for reading ebooks, and unfrotunately at this time I can't use okular for plain-text ebooks. It really irks me, and I see this as a critical failing of okular as an ebook reader. Other ebook reader programs do not suffer from this lack.
Comment 7 Albert Astals Cid 2012-08-09 20:41:53 UTC
*** Bug 228415 has been marked as a duplicate of this bug. ***
Comment 8 Christopher Yeleighton 2012-08-11 10:31:31 UTC
(In reply to comment #4)
> to be honest i don't see what okular can give you above a regular text
> document viewer (kate, kwrite). Yes, the duplication is kind of weird, since
> it asks for a different thing, but anyhow, since none of the okular
> developers see a need for this, don't expect this happening anytime soon
> unless you can explain what's the point.

Plain text files are usually open in KWrite. However, KWrite opens the file for editing, and the size of a file that can be edited is limited (Bug 250617). So it would be useful to have a viewer that is capable of displaying text files of any size (← the point). GNU 'less' is one such viewer, using character mode interface; however, no equivalent action exists in KDE (Bug 261925).
Comment 9 Albert Astals Cid 2013-02-18 23:26:28 UTC
Git commit 74420f1baac621f6822ed9c5212e6004711d695a by Albert Astals Cid, on behalf of Azat Khuzhin.
Committed on 19/02/2013 at 00:22.
Pushed by aacid into branch 'master'.

Txt backend
REVIEW: 109009
FIXED-IN: 4.11.0

M  +2    -0    generators/CMakeLists.txt
A  +25   -0    generators/txt/CMakeLists.txt
A  +14   -0    generators/txt/active-documentviewer_txt.desktop
A  +41   -0    generators/txt/converter.cpp     [License: GPL (v2+)]
A  +31   -0    generators/txt/converter.h     [License: GPL (v2+)]
A  +68   -0    generators/txt/document.cpp     [License: GPL (v2+)]
A  +26   -0    generators/txt/document.h     [License: GPL (v2+)]
A  +36   -0    generators/txt/generator_txt.cpp     [License: GPL (v2+)]
A  +24   -0    generators/txt/generator_txt.h     [License: GPL (v2+)]
A  +10   -0    generators/txt/libokularGenerator_txt.desktop
A  +12   -0    generators/txt/okularApplication_txt.desktop
A  +7    -0    generators/txt/okularTxt.desktop

http://commits.kde.org/okular/74420f1baac621f6822ed9c5212e6004711d695a