Han Liu
unread,Oct 19, 2011, 8:42:47 AM10/19/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to DreamPie
Hi,
I am trying to add a feature that commands in history can be save as
plain text. I felt it is handy for editing code later.
in order to do so I passed history to HistPersist.(maybe this is very
bad please tell me if it is ). And I tried to call
history.iter_get_command(it) to get commands. but I got a assert
Error. It seems the textview inside of HistPersist does not have text
which are tagged as command. I used code below:
def save_history_raw(textview, f,history):
"""
Save the history - the content of the textview - to a plain txt
file f.
"""
tv = textview
tb = tv.get_buffer()
style = tv.get_style()
it = tb.get_start_iter()
it_end = tb.get_end_iter()
#text = tb.get_text(it, it_end).decode('utf8')
# place Assert Error happend
texthistory = history.iter_get_command(it)
f.write(texthistory.encode('utf8'))
So did I call iter_get_command with wrong iterator? I am new to python
any suggestion will be welcome!
Regards,
Han Liu