mirror of
https://github.com/wassname/pyreadline.git
synced 2026-06-27 16:10:38 +08:00
pyreadline: fix pageup, pagedown scrolling of window. Started work on implementing kill_ring separate from clipboard. ctrl-k and esc no longer puts anything on clipboard
This commit is contained in:
@@ -1,3 +1,7 @@
|
||||
2007-05-14 Jörgen Stenarson <jorgen.stenarson -at- bostream.nu>
|
||||
* Fixing pageup pagedown scrolling of window
|
||||
* Begining work on killring. ctrl-k ctrl-y will not use clipboard anymore
|
||||
|
||||
2007-05-14 Jörgen Stenarson <jorgen.stenarson -at- bostream.nu>
|
||||
* pre_inputhook and startup_hook were not functioning properly.
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ bind_key('Control-Shift-v', "paste_mulitline_code")
|
||||
bind_key("Control-x", "cut_selection_to_clipboard")
|
||||
|
||||
bind_key("Control-v", "paste")
|
||||
bind_key("Control-y", "paste")
|
||||
bind_key("Control-y", "yank")
|
||||
bind_key("Alt-v", "ipython_paste")
|
||||
|
||||
#Unbinding keys:
|
||||
|
||||
@@ -507,9 +507,9 @@ class Console(object):
|
||||
e = self.get()
|
||||
if e.type == 'KeyPress' and e.keycode not in key_modifiers:
|
||||
log(e)
|
||||
if e.keysym == 'Next':
|
||||
if e.keyinfo.keyname == 'next':
|
||||
self.scroll_window(12)
|
||||
elif e.keysym == 'Prior':
|
||||
elif e.keyinfo.keyname == 'prior':
|
||||
self.scroll_window(-12)
|
||||
else:
|
||||
return e
|
||||
|
||||
@@ -392,7 +392,7 @@ class ReadLineTextBuffer(TextLine):
|
||||
self.enable_win32_clipboard=True
|
||||
self.selection_mark=-1
|
||||
self.enable_selection=True
|
||||
|
||||
self.kill_ring=[]
|
||||
def __repr__(self):
|
||||
return 'ReadLineTextBuffer("%s",point=%s,mark=%s,selection_mark=%s)'%(self.line_buffer,self.point,self.mark,self.selection_mark)
|
||||
|
||||
@@ -634,15 +634,17 @@ class ReadLineTextBuffer(TextLine):
|
||||
############ Kill
|
||||
|
||||
def kill_line(self):
|
||||
self[self.point:].to_clipboard()
|
||||
#self[self.point:].to_clipboard()
|
||||
self.add_to_kill_ring(self[self.point:])
|
||||
del self.line_buffer[self.point:]
|
||||
|
||||
def kill_whole_line(self):
|
||||
self[:].to_clipboard()
|
||||
#self[:].to_clipboard()
|
||||
self.add_to_kill_ring(self[:])
|
||||
del self[:]
|
||||
|
||||
def backward_kill_line(self):
|
||||
self[StartOfLine:Point].to_clipboard()
|
||||
#self[StartOfLine:Point].to_clipboard()
|
||||
del self[StartOfLine:Point]
|
||||
|
||||
def unix_line_discard(self):
|
||||
@@ -651,25 +653,24 @@ class ReadLineTextBuffer(TextLine):
|
||||
|
||||
def kill_word(self):
|
||||
"""Kills to next word ending"""
|
||||
self[Point:NextWordEnd].to_clipboard()
|
||||
#self[Point:NextWordEnd].to_clipboard()
|
||||
del self[Point:NextWordEnd]
|
||||
|
||||
def backward_kill_word(self):
|
||||
"""Kills to next word ending"""
|
||||
self[PrevWordStart:Point].to_clipboard()
|
||||
#self[PrevWordStart:Point].to_clipboard()
|
||||
if not self.delete_selection():
|
||||
del self[PrevWordStart:Point]
|
||||
self.selection_mark=-1
|
||||
|
||||
def forward_kill_word(self):
|
||||
"""Kills to next word ending"""
|
||||
self[Point:NextWordEnd].to_clipboard()
|
||||
#self[Point:NextWordEnd].to_clipboard()
|
||||
if not self.delete_selection():
|
||||
del self[Point:NextWordEnd]
|
||||
self.selection_mark=-1
|
||||
|
||||
def unix_word_rubout(self):
|
||||
self[PrevSpace:Point].to_clipboard()
|
||||
if not self.delete_selection():
|
||||
del self[PrevSpace:Point]
|
||||
self.selection_mark=-1
|
||||
@@ -688,12 +689,11 @@ class ReadLineTextBuffer(TextLine):
|
||||
|
||||
|
||||
def yank(self):
|
||||
pass
|
||||
self.paste_from_kill_ring()
|
||||
|
||||
def yank_pop(self):
|
||||
pass
|
||||
|
||||
|
||||
############## Mark
|
||||
|
||||
def set_mark(self):
|
||||
@@ -734,6 +734,16 @@ class ReadLineTextBuffer(TextLine):
|
||||
############## Paste
|
||||
|
||||
|
||||
############## Kill ring
|
||||
def add_to_kill_ring(self,txt):
|
||||
self.kill_ring=[txt]
|
||||
|
||||
|
||||
def paste_from_kill_ring(self):
|
||||
if self.kill_ring:
|
||||
self.insert_text(self.kill_ring[0])
|
||||
|
||||
|
||||
##################################################################
|
||||
q=ReadLineTextBuffer("asff asFArw ewrWErhg",point=8)
|
||||
q=TextLine("asff asFArw ewrWErhg",point=8)
|
||||
|
||||
@@ -365,12 +365,12 @@ class EmacsMode(basemode.BaseMode):
|
||||
|
||||
def yank(self, e): # (C-y)
|
||||
'''Yank the top of the kill ring into the buffer at point. '''
|
||||
pass
|
||||
self.l_buffer.yank()
|
||||
|
||||
def yank_pop(self, e): # (M-y)
|
||||
'''Rotate the kill-ring, and yank the new top. You can only do this
|
||||
if the prior command is yank or yank-pop.'''
|
||||
pass
|
||||
self.l_buffer.yank_pop()
|
||||
|
||||
|
||||
def digit_argument(self, e): # (M-0, M-1, ... M--)
|
||||
@@ -580,7 +580,7 @@ class EmacsMode(basemode.BaseMode):
|
||||
#self._bind_key('Control-Shift-v', self.quoted_insert)
|
||||
self._bind_key('Control-v', self.paste)
|
||||
self._bind_key('Alt-v', self.ipython_paste)
|
||||
self._bind_key('Control-y', self.paste)
|
||||
self._bind_key('Control-y', self.yank)
|
||||
self._bind_key('Control-k', self.kill_line)
|
||||
self._bind_key('Control-m', self.set_mark)
|
||||
self._bind_key('Control-q', self.copy_region_to_clipboard)
|
||||
|
||||
Reference in New Issue
Block a user