Opened 13 years ago

Closed 13 years ago

#7648 closed defect (fixed)

notebook: issue with indentation of first line being wrong

Reported by: William Stein Owned by: William Stein
Priority: minor Milestone: sage-4.3.1
Component: notebook Keywords:
Cc: Merged in: sagenb-0.6
Authors: Mitesh Patel Reviewers: Tim Dumol
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description

On 11/27/2009 05:47 AM, Minh Nguyen wrote:
> On Fri, Nov 27, 2009 at 9:10 PM, Yotam Avital <> wrote:
>> for i in range (1,5):
>>     print '%6s %6s %6s'%(i, i^2, i^3)

I think *part* of the problem could be line 294 of sagenb.interfaces.expect:

       s = s.strip().rstrip(self._prompt)


Replacing this with

       s = s.rstrip(self._prompt)

appears to restore the expected spacing.  But quitting and reopening the
worksheet puts

1      1      1
    2      4      8
    3      9     27
    4     16     64

in the output cell.  I think the problem here is line 910 (or so) of
sagenb.notebook.cell:

           out = '///\n' + out.strip()


Replacing this with

           out = '///\n' + out.strip('\n')

seems to solve this problem.  It also makes the text representation of
the worksheet more compact.

Note: I haven't tested these changes extensively.

Attachments (1)

trac_7648-missing_indent.patch (1.2 KB) - added by Mitesh Patel 13 years ago.
Make the changes in the ticket description. sagenb repo.

Download all attachments as: .zip

Change History (5)

Changed 13 years ago by Mitesh Patel

Make the changes in the ticket description. sagenb repo.

comment:1 Changed 13 years ago by Mitesh Patel

Authors: Mitesh Patel
Status: newneeds_review

The Se tests pass. Unfortunately, sage -t sagenb/notebook yields several

A mysterious error (perhaps a memory error?) occurred, which may have crashed doctest.

Please see #7650.

comment:2 Changed 13 years ago by Mitesh Patel

The patch for #7663 (and #7924) clashes with this one. Reconciling them should be easy.

comment:3 Changed 13 years ago by Tim Dumol

Status: needs_reviewpositive_review

Good job.

comment:4 Changed 13 years ago by Tim Dumol

Merged in: sagenb-0.6
Resolution: fixed
Reviewers: Tim Dumol
Status: positive_reviewclosed
Note: See TracTickets for help on using tickets.