pyreadline/readline differences

Bug #371661 reported by Ben Porter
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
GLiPy
Fix Committed
High
Unassigned

Bug Description

the readline package is not available under windows, instead pyreadline must be used ... and it differs slightly from readline.

i don't know if you want to branch form a windows version, or maybe refactor out the readline stuff?

anyway,here's a patch that shows some of the differences ... there are still more ... but this will get it up and running and in a sort of usable state under windows...

-----start patch
--- glipy\terminal\terminal.py 2009-04-27 10:26:14.001900000 +1000
+++ build\lib\glipy\terminal\terminal.py 2009-05-04 23:12:40.083600000 +1000
@@ -22,6 +22,7 @@
 from console import Console
 import time
 import shell
+from pyreadline.lineeditor.lineobj import TextLine

 # ------------------------------------------------------------ class TerminalOut
@@ -185,13 +186,13 @@
     def history_add(self, item):
         ''' '''
         if len(item):
- readline.add_history (item)
+ readline.add_history (TextLine(item))
         self.history_reset()

     # ___________________________________________________________ history_reset
     def history_reset(self):
         ''' '''
- self.history_index = readline.get_current_history_length()+1
+ self.history_index = readline.get_history_length()+1

     # ________________________________________________________________ on_close
     def on_close(self):
@@ -214,10 +215,10 @@
         ''' '''
         self.history_index += 1
         h = ''
- if self.history_index <= readline.get_current_history_length():
+ if self.history_index <= readline.get_history_length():
             h = '' or readline.get_history_item (self.history_index)
         else:
- self.history_index = readline.get_current_history_length()+1
+ self.history_index = readline.get_history_length()+1
         self.command = h

     # ____________________________________________________________ history_prev

Revision history for this message
Nicolas Rougier (rougier) wrote :

The readline package is only used to handle history. I modified code to handle history manually when readline is absent. I did not test it under windows.

Changed in glipy:
importance: Undecided → High
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.