added new window functionality

--HG--
branch : pmacs2
This commit is contained in:
Erik Osheim 2009-11-08 15:54:31 -05:00
parent 634c8b88f1
commit 00edb537b3
1 changed files with 12 additions and 0 deletions

View File

@ -565,6 +565,8 @@ class Window(object):
return (p1, p2) return (p1, p2)
# deletion # deletion
def delete_char(self, p):
self.buffer.delete_char(p)
def delete(self, p1, p2): def delete(self, p1, p2):
self.buffer.delete(p1, p2) self.buffer.delete(p1, p2)
def delete_line(self): def delete_line(self):
@ -629,6 +631,12 @@ class Window(object):
else: else:
self.buffer.overwrite_char(p, c) self.buffer.overwrite_char(p, c)
self.cursor = Point(p.x + 1, p.y) self.cursor = Point(p.x + 1, p.y)
def replace_with_string(self, p1, p2, s):
self.buffer.delete(p1, p2)
self.insert_string(p1, s)
def replace_with_lines(self, p1, p2, lines):
self.buffer.delete(p1, p2)
self.insert_lines(p1, lines)
# insertion # insertion
def insert_string_at_cursor(self, s): def insert_string_at_cursor(self, s):
@ -676,6 +684,10 @@ class Window(object):
self.goto(p) self.goto(p)
# highlighting tokens # highlighting tokens
def get_token_list(self, y):
return self.get_token_list_at_point(self.logical_cursor())
def get_token_list_at_point(self, p):
return self.get_highlighter().tokens[p.y]
def get_token(self): def get_token(self):
return self.get_token_at_point(self.logical_cursor()) return self.get_token_at_point(self.logical_cursor())
def get_token2(self): def get_token2(self):