some code clean-up and comment fixes

--HG--
branch : pmacs2
This commit is contained in:
Erik Osheim 2009-05-10 02:01:33 -04:00
parent 9d4dd2c2d8
commit e495d8a65f
1 changed files with 7 additions and 22 deletions

View File

@ -3,6 +3,8 @@ import color, highlight, regex
from point import Point
from render import RenderString
CONTEXT = 2
# note about the cursor: the cursor position will insert in front of the
# character it highlights. to this end, it needs to be able to highlight behind
# the last character on a line. thus, the x coordinate of the (logical) cursor
@ -13,9 +15,9 @@ from render import RenderString
# will jump in to the end of the shorter line. however, moving back up will
# jump back out to its previous position. in these cases the cursor stores the
# original x value, but the logical cursor function maps x to the "last
# character on the line" for the shorter line. any line movement or actions on
# the shorter line will "set" the cursor to its position on the shorter line.
# character on the line" for the shorter line. any line movement or actions
# which modify the x coordinate will "set" the cursor to a new position, and the
# old x value will be forgotten.
class Window(object):
margins_visible = False
def __init__(self, b, a, height=24, width=80, mode_name=None):
@ -246,13 +248,6 @@ class Window(object):
if x >= self.width and x == len(self.buffer.lines[y]):
x -= self.width
# make sure we aren't "centering" on the end of the file (where half the
# screen is empty). that is, unless that's what the user wants
# (indicated by force=True).
#if not force:
# (x2, y2) = self.last_visible_coords()
# if y2 < y or x2 < x:
# x, y = x2, y2
self.first = Point(x, y)
self.redraw()
def lower_view(self):
@ -288,11 +283,6 @@ class Window(object):
def assure_visible_cursor(self):
if not self.cursor_is_visible():
self.center_view()
#p = self.logical_cursor()
#if self.first > p:
# self.upper_view()
#elif p > self.last:
# self.lower_view()
# moving in buffer
def forward(self):
@ -486,14 +476,9 @@ class Window(object):
def last_visible_coords(self):
(x, y) = self.buffer.get_buffer_end().xy()
#if x == 0:
# y -= 1
# x = len(self.buffer.lines[y])
#else:
# x -= 1
counter = 0
# 3 means last line we see + 2 blank line of context
while counter < self.height - 3:
limit = self.height - 1 - CONTEXT
while counter < limit:
if x > self.width:
d = x % self.width
if d: