mirror of
https://github.com/wassname/pyreadline.git
synced 2026-10-03 12:51:53 +08:00
Improve tab insertion to be sure it works in the middle of a line.
This commit is contained in:
1 parent
84d5ee1480
commit
0d6e42ef4e
2 files changed
+4
-6
No files matched your search
@@ -284,9 +284,8 @@ class EmacsMode(basemode.BaseMode):
|
||||
def tab_insert(self, e): # (M-TAB)
|
||||
'''Insert a tab character. '''
|
||||
# vds: >>
|
||||
line_cursor = len(self.l_buffer)
|
||||
ws = ' ' * (self.tabstop - (line_cursor%self.tabstop))
|
||||
#ws = ' ' * (self.tabstop - (self.line_cursor%self.tabstop))
|
||||
cursor = min(self.l_buffer.point, len(self.l_buffer.line_buffer))
|
||||
ws = ' ' * (self.tabstop - (cursor % self.tabstop))
|
||||
# vds: <<
|
||||
self.insert_text(ws)
|
||||
|
||||
|
||||
@@ -273,9 +273,8 @@ class NotEmacsMode(basemode.BaseMode):
|
||||
def tab_insert(self, e): # (M-TAB)
|
||||
'''Insert a tab character. '''
|
||||
# vds: >>
|
||||
line_cursor = len(self.l_buffer)
|
||||
ws = ' ' * (self.tabstop - (line_cursor%self.tabstop))
|
||||
#ws = ' ' * (self.tabstop - (self.line_cursor%self.tabstop))
|
||||
cursor = min(self.l_buffer.point, len(self.l_buffer.line_buffer))
|
||||
ws = ' ' * (self.tabstop - (cursor % self.tabstop))
|
||||
# vds: <<
|
||||
self.insert_text(ws)
|
||||
|
||||
|
||||
Reference in new issue
Block a user