Opened 10 years ago

Closed 9 years ago

#10289 closed enhancement (duplicate)

Convenient history fetch facilities

Reported by: klee Owned by: was
Priority: minor Milestone: sage-duplicate/invalid/wontfix
Component: user interface Keywords:
Cc: Merged in:
Authors: Reviewers: Kwankyu Lee
Report Upstream: N/A Work issues:
Branch: Commit:
Dependencies: Stopgaps:

Status badges

Description (last modified by jdemeyer)

Using Sage, you are missing a feature of the Magma command line interface. In Magma, if you enter a line found in history using up arrow key and then press down arrow key, then the next line in history is fetched. This feature allows you to fetch as many successive lines in history as you like. However, Sage does not have a similar feature. The IPython command prompt uses the readline library (via pyreadline), which evidently does not support this feature. Magma has its own custom “readline-like” library, which does support this feature. (Since so many people have requested this feature, if anybody can figure out how to implement it, then such an implementation would certainly be welcome!)

See instead #12503.

Attachments (1)

trac_10289.patch (10.5 KB) - added by klee 9 years ago.
rebased on 4.8

Download all attachments as: .zip

Change History (15)

comment:1 Changed 10 years ago by klee

From Chet Ramey:
----------
This is very similar to the operate-and-get-next feature bash adds to the readline interface.  I am not inclined to add this to readline in its current form because it manipulates state managed by the calling application (rl_startup_hook) and requires that state to be kept between calls to readline().  It's a feature that should be provided by the calling application -- it's implementation is not complicated.

comment:2 Changed 10 years ago by klee

A developer of R attempted to pull the part of the Bash source code
responsible for the "operate-and-get-next" feature into R interface.
See the following link:

http://r.789695.n4.nabble.com/readline-operate-and-get-next-td2317208...

comment:3 Changed 10 years ago by klee

A preliminary version of the patch was uploaded. See the doc in the patch for how to bind the new readline commands with keys.

I am wondering how to doctest this module.

Things to do: add more comments and doctests.

I copied some programming logic from the Bash shell source files, in particular, from"bashline.c", and the GNU Readline source files, in particular from the file "misc.c". Check the copyright things, although I think there is no problem.

comment:4 Changed 10 years ago by klee

Note the last two commands in the patch implements the up and down arrow keys in Magma.

comment:5 Changed 10 years ago by klee

  • Status changed from new to needs_review

comment:6 Changed 10 years ago by klee

  • Authors set to Kwankyu Lee

comment:7 Changed 10 years ago by klee

  • Milestone changed from sage-feature to sage-4.6.1

comment:8 Changed 10 years ago by klee

  • Status changed from needs_review to needs_work

comment:9 Changed 10 years ago by klee

This patch needs work as it does not work on Ubuntu machines. There is no problem with my Mac. On Ubuntu, the patch is compiled well, but produces "no symbol: history_length" error when it is imported on Sage startsup. Cython experts, please help me fix this problem.

comment:10 Changed 9 years ago by klee

  • Status changed from needs_work to needs_review

Changed 9 years ago by klee

rebased on 4.8

comment:11 Changed 9 years ago by klee

  • Status changed from needs_review to needs_work

comment:12 Changed 9 years ago by klee

I created the ticket #12503 duplicating this ticket, as the patchbot does not work for the patch uploaded here.

Further discussion on this ticket should be continued on #12503.

comment:13 Changed 9 years ago by klee

  • Milestone changed from sage-5.0 to sage-duplicate/invalid/wontfix
  • Status changed from needs_work to positive_review

comment:14 Changed 9 years ago by jdemeyer

  • Authors Kwankyu Lee deleted
  • Description modified (diff)
  • Resolution set to duplicate
  • Reviewers set to Kwankyu Lee
  • Status changed from positive_review to closed
Note: See TracTickets for help on using tickets.