bugGNU Octave - Bugs: bug #55819, Octave command number doesn't...

 
 

bug #55819: Octave command number doesn't increment after Ctrl+C

Submitter:  Dan Sebald <sebald>
Submitted:  Sun 03 Mar 2019 05:52:18 PM UTC
   
 
Category:  Interpreter Severity:  1 - Wish
Priority:  3 - Low Item Group:  Feature Request
Status:  Fixed Assigned to:  None
Originator Name:  Dan Sebald Open/Closed:  * Closed
Release:  * dev Operating System:  * GNU/Linux
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Sun 20 Oct 2019 04:00:08 PM UTC, comment #7: 

@Anthony: Great to hear you'll be adding more patches.  I added your name to the list of Octave contributors here: https://hg.savannah.gnu.org/hgweb/octave/rev/09175c0e417d.

Rik <rik5>
Group administrator
Sat 19 Oct 2019 02:56:49 PM UTC, comment #6: 

Hi Rik,

Thanks for making that correction and sorry for the delayed response.

I would appreciate it if you could add me to Octave's contributor list at the beginning of the manual. I've had a few commits already and plan to have many more.

Thanks again,
Anthony

Anthony Morast <amorast>
Thu 19 Sep 2019 11:41:37 PM UTC, comment #5: 

@Anthony: I updated your patch because in no longer applied cleanly to the development branch and checked it in here (https://hg.savannah.gnu.org/hgweb/octave/rev/e94868c1369f).  Drop a comment to this bug report if you would like to be listed among Octave's contributors at the beginning of the manual.

Marking as fixed and closing report.

Rik <rik5>
Group administrator
Thu 13 Jun 2019 02:06:00 PM UTC, comment #4: 

I've attached a patch that increments the command number on interrupts via Mike Miller's suggested fix.

I have verified the command number increment works the same when in debug mode and ensured the completion matches are unaffected.

(file #47084)

Anthony Morast <amorast>
Sun 03 Mar 2019 08:49:47 PM UTC, comment #3: 

I think this can probably be fixed by moving the call to 'command_editor::increment_current_command_number' out of the evaluator (pt-eval.cc) and into the input system (input.cc), where input lines are added to the command history. But some care has to be taken to make sure that the command number works the same with completion matches and with the debugger active.

Mike Miller <mtmiller>
Group Member
Sun 03 Mar 2019 06:30:04 PM UTC, comment #2: 

Small correction, the return value may be assigned already if the thing being interrupted is just displaying a huge return value to the terminal output.

Mike Miller <mtmiller>
Group Member
Sun 03 Mar 2019 06:05:59 PM UTC, comment #1: 

Confirmed with something simple like 'pause(10000)' and Ctrl+C.

Retitled to use the terminology used in liboctave. The number is the "command number", and the interpreter only increments it when an expression is evaluated and a return value is received. If the command is interrupted, there is no return value, the 'ans' variable is also not updated, and the command number is not incremented.

This is fairly low severity since most users (using the GUI) will see the '>> ' prompt, no command number.

I agree that this would be nice to fix. The bash shell for example does increment its command number when the prompt contains '\#' and a command like 'sleep 1000' is interrupted.

Mike Miller <mtmiller>
Group Member
Sun 03 Mar 2019 05:52:18 PM UTC, original submission:  

Using octave-cli, try something like the following in which one presses Cntrl-C during a long screen dump of resulting output (say I forgot the semicolon):


octave:1> y = 1:1e7
[snip]
 Columns 95824 through 95830:

      95824      95825      95826      95827      95828      95829      95830

 Columns 95831 through 95837:

  ^C    95850      95851

 Columns 95852 through 95858:


octave:1>


Presumably the command sequence has been fully executed, as the variable is present:


octave:1> who
Variables visible from the current scope:

y


But the octave line number is still at 1.  It seems like it should be at 2.  Neither does the line number advance when the pager is on.

Dan Sebald <sebald>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #47084:  command_number_incr.patch added by amorast (2KiB - application/octet-stream)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by amorast (Updated the item)
  • -email is unavailable- added by rik5 (Updated the item)
  • -email is unavailable- added by sebald (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 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-09-19 rik5 Open/ClosedOpen Closed
    2019-09-19 rik5 StatusPatch Submitted Fixed
    2019-08-29 mtmiller StatusConfirmed Patch Submitted
    2019-06-13 amorast Attached File- Added command_number_incr.patch, #47084
    2019-03-03 rik5 Priority5 - Normal 3 - Low
    2019-03-03 mtmiller CategoryNone Interpreter
        Severity3 - Normal 1 - Wish
        Item GroupIncorrect Result Feature Request
        StatusNone Confirmed
        SummaryOctave line number doesn't advance after Cntrl-C when resulting output Octave command number doesn't increment after Ctrl+C

    Back to the top

    Powered by Savane 3.13-758e.
    Corresponding source code