bugGNU Octave - Bugs: bug #61000, clc command does not totally clean...

 
 

bug #61000: clc command does not totally clean the command window. The history can still be traversed using the scroll bar.

Submitted by:  None
Submitted on:  Sun 01 Aug 2021 09:59:36 PM UTC  
 
Category:  GUI Severity:  2 - Minor
Priority:  1 - Later Item Group:  Other
Status:  Need Info Assigned to:  None
Originator Name:  Originator Email:  -email is unavailable-
Open/Closed:  Open Release:  dev
Operating System:  GNU/Linux

Add a New Comment (Rich Markup)
   

You are not logged in

Please log in, so followups can be emailed to you.

 

( Jump to the original submission)

Sat 21 Aug 2021 06:48:08 PM UTC, comment #9: 

Can this report be closed.  Seems like Octave is just following established UNIX standards, and the behavior is going will probably change again when a replacement terminal widget is developed.

Rik <rik5>
Project Administrator
Thu 05 Aug 2021 10:00:33 PM UTC, comment #8: 

Many thanks John Eaton for the hint. I'm trying to build a custom Octave with the "clear and reset" effect. I remove the part "Add entire screen to history" of clearEntireScreen() but it does not work. Can you give a hint to modify this function such that the effect works? I hope this feature will be viable in some way for future releases.

Giang <vryy>
Mon 02 Aug 2021 02:34:43 PM UTC, comment #7: 

Whether running in a terminal window in CLI mode or in the GUI (also inside a somewhat capable terminal emulator) Octave normally calls a readline function to clear the terminal.  It just writes whatever escape sequence that terminfo has registered for the "clear" capability.  Then the terminal does whatever it does to clear the screen.  For the QTerminal widget that Octave is currently using, the function that ultimately does the job is Screen::clearEntireScreen in libgui/qterminal/libqterminal/unix/Screen.cpp:

void Screen::clearEntireScreen()
{
  // Add entire screen to history
  for (int i = 0; i < (lines-1); i++)
  {
    addHistLine(); scrollUp(0,1);
  }

  clearImage(loc(0,0),loc(columns-1,lines-1),' ');
}

As noted in comment #5, this is also what bash does because it uses readline.  But what actually happens in the terminal window where bash is running is up to the terminal.  That might be hardware or some teriminal emulation program like xterm or gnome terminal, etc.

Perhaps in the future when we switch to a different type of terminal interface we might do something different.  But for now, I don't think it is worth the effort to change this behavior.  See also https://octave.discourse.group/t/new-command-window-widget/501 for a discussion about the possibility of a new terminal widget.

John W. Eaton <jwe>
Project Administrator
Mon 02 Aug 2021 02:12:06 PM UTC, comment #6: 

In fact this comment is for GUI mode. In CLI, I would also prefer doing "clear and reset" as you did.

Giang <vryy>
Mon 02 Aug 2021 01:40:47 PM UTC, comment #5: 

This comment is for CLI not GUI.

For all the years I've used octave, I've usually used the terminal window's "clear and reset" function if I want to eliminate the history. Octave's clc is similar to bash's clear, and neither will remove past commands from history. There isn't a command for that as far as I know because command history is the responsibility of the terminal not the program sending things to the terminal.

I would argue that retaining that behavior is better than combining the two behaviors into clc. Sometimes I only want to clear the screen but not reset history, and sometimes I want to do both.

When Matlab is invoked in CLI mode (e.g. running Matlab server-side through a shell instead of locally) it behaves the same, not clearing command history.

Anonymous
Mon 02 Aug 2021 06:47:20 AM UTC, comment #4: 

Here is the description of Matlab's clc. This is exactly what I want to say: "After running clc, you cannot use the scroll bar in the Command Window to see previously displayed text."

https://de.mathworks.com/help/matlab/ref/clc.html

Giang <vryy>
Mon 02 Aug 2021 06:44:39 AM UTC, comment #3: 

comment #2:

> Does Matlab behave any differently?  My understanding is that clc() is only about clearing visual clutter from the terminal window, and not about clearing history.  In effect, the cursor should be in the upper left, the window should be empty, and the scrollbar should be positioned at the very bottom.


Matlab behaves differently. It will clear the command window output history. It is not the same as command history. You still can access the command history on a separate window. But the command window will be totally empty and not be able to traverse back.

Giang <vryy>
Sun 01 Aug 2021 11:54:05 PM UTC, comment #2: 

Does Matlab behave any differently?  My understanding is that clc() is only about clearing visual clutter from the terminal window, and not about clearing history.  In effect, the cursor should be in the upper left, the window should be empty, and the scrollbar should be positioned at the very bottom.

Rik <rik5>
Project Administrator
Sun 01 Aug 2021 10:04:35 PM UTC, comment #1: 

Typo: "story" should be "history"

Giang <vryy>
Sun 01 Aug 2021 09:59:36 PM UTC, original submission:  
Anonymous

 

(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 (Posted a comment)
  • -email is unavailable- added by jwe (Posted a comment)
  • -email is unavailable- added by vryy (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.

     

     

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2021-08-03 rik5 Carbon-CopyRemoved 72865 => -
    2021-08-03 rik5 Priority5 - Normal => 1 - Later
        Release6.2.0 => dev
    2021-08-01 rik5 CategoryNone => GUI
        Severity3 - Normal => 2 - Minor
        StatusNone => Need Info
    2021-08-01 rik5 Summaryclc command does not totally clean the command window. The story can still be traversed using the scroll bar. => clc command does not totally clean the command window. The history can still be traversed using the scroll bar.

    Back to the top


    Powered by Savane 3.6