bugGNU Octave - Bugs: bug #53642, Release Notes are truncated when...

 
 

bug #53642: Release Notes are truncated when displayed in the GUI

Submitter:  Rik <rik5>
Submitted:  Fri 13 Apr 2018 03:36:15 PM UTC
   
 
Category:  GUI Severity:  5 - Blocker
Priority:  5 - Normal Item Group:  Regression
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  * Closed
Release:  * 4.3.90 Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Sun 15 Apr 2018 05:38:09 AM UTC, comment #5: 

Fixed here http://hg.savannah.gnu.org/hgweb/octave/rev/0bc58956aa40 by escpaing '<' and '>' so they are not interpreted as HTML elements.

Rik <rik5>
Group administrator
Sat 14 Apr 2018 12:33:44 PM UTC, comment #4: 

This simple diff switch to using plain text in the QTextBrowser.  On the good side, the text is all there, on the bad side, a variable width font is used so tables don't line up.


diff -r b0c0a7766d46 -r e4f83fb17094 libgui/src/main-window.cc
--- a/libgui/src/main-window.cc        Fri Apr 13 12:55:11 2018 -0700
+++ b/libgui/src/main-window.cc        Sat Apr 14 05:16:07 2018 -0700
@@ -473,7 +473,7 @@ namespace octave
         m_release_notes_window = new QWidget;

         QTextBrowser *browser = new QTextBrowser (m_release_notes_window);
-        browser->setText (news);
+        browser->setPlainText (news);

         QVBoxLayout *vlayout = new QVBoxLayout;
         vlayout->addWidget (browser);




Rik <rik5>
Group administrator
Fri 13 Apr 2018 11:54:55 PM UTC, comment #3: 

The documentation for QTextBrowser is here https://doc.qt.io/qt-5/qtextbrowser.html#details.

According to that


If you want to provide your users with an editable rich text editor, use QTextEdit. If you want a text browser without hypertext navigation use QTextEdit, and use QTextEdit::setReadOnly() to disable editing. If you just need to display a small piece of rich text use QLabel.


Maybe we shouldn't bother to make a hyperlink aware Release Notes?

Rik <rik5>
Group administrator
Fri 13 Apr 2018 11:53:43 PM UTC, comment #2: 

It doesn't look like it is QTestStream.  The documentation for that class is here https://doc.qt.io/qt-5/qtextstream.html#details.


Rik <rik5>
Group administrator
Fri 13 Apr 2018 11:49:22 PM UTC, comment #1: 

The fix is likely to be in libgui/src/main-window.cc.  The code in question is:


  void main_window::display_release_notes (void)
  {
    if (! m_release_notes_window)
      {
        std::string news_file = config::oct_etc_dir () + "/NEWS";

        QString news;

        QFile *file = new QFile (QString::fromStdString (news_file));
        if (file->open (QFile::ReadOnly))
          {
            QTextStream *stream = new QTextStream (file);
            news = stream->readAll ();
            if (! news.isEmpty ())
              {
                news.prepend ("<pre>");
                news.append ("</pre>");
              }
            else
              news = (tr ("The release notes file '%1' is empty.")
                      . arg (QString::fromStdString (news_file)));
          }
        else
          news = (tr ("The release notes file '%1' cannot be read.")
                  . arg (QString::fromStdString (news_file)));

        m_release_notes_window = new QWidget;

        QTextBrowser *browser = new QTextBrowser (m_release_notes_window);
        browser->setText (news);


Either QTextStream is interpreting the file as HTML or QTextBrowser is.


Rik <rik5>
Group administrator
Fri 13 Apr 2018 03:36:15 PM UTC, original submission:  

When choosing News->Release Notes from the GUI menubar a window is opened which contains the contents of the NEWS file.  There seems to be a chunk missing because it moves from talking about a Qt bug directly to quadcc.



** A known bug in Qt (https://bugreports.qt.io/browse/QTBUG-55357) is
    addressed by limiting GUI sub-panel relocation capabilities for Qt
    versions in the range >= 5.6.1 and  quadcc (f, a, b, [0, tol])

    A warning that a single tolerance input is now interpreted as an
    absolute tolerance will be issued in Octave versions 4.4 and 5,
    after which it will be removed.  The warning has ID
    "Octave:quadcc:RelTol-conversion" and can be disabled with


If I type 'news' in the Command Window then I get the complete file.

The issue appears to be that the NEWS file is a text file, but is being interpreted as an HTML file, and there are various things like '<' and '>' which make it appear as if the file is trying to use Markup.

Either these characters need to be escaped or the Qt reader in the GUI needs to treat this file as plain text.


Rik <rik5>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:
   
   
Comment:
   

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by rik5 (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2018-04-15 rik5 StatusConfirmed Fixed
        Open/ClosedOpen Closed

    Back to the top

    Powered by Savane 3.13-d3ae.
    Corresponding source code