parent
6ea87b87e4
commit
143fe24447
|
@ -921,8 +921,10 @@ class Application(object):
|
|||
# figure out which "physical line" is the first to be shown. note that
|
||||
# the cursor shouldn't be in the last column unless it's the end of a
|
||||
# line.
|
||||
|
||||
k = x // swidth
|
||||
#if x < len(lines[y]) and x == swidth - 1:
|
||||
|
||||
#if x < len(lines[y]) and x == swidth - 1: #xyz
|
||||
# k += 1
|
||||
|
||||
while count < slot.height:
|
||||
|
|
15
window.py
15
window.py
|
@ -218,20 +218,27 @@ class Window(object):
|
|||
return self.point_is_visible(self.buffer.get_buffer_end())
|
||||
|
||||
def center_view(self, force=False):
|
||||
(x, y) = self.logical_cursor().xy()
|
||||
x, y = self.logical_cursor().xy()
|
||||
counter = 0
|
||||
while counter < self.height / 2:
|
||||
if x > self.width:
|
||||
d = x % self.width
|
||||
x -= self.width
|
||||
elif y > 0:
|
||||
y -= 1
|
||||
x = len(self.buffer.lines[y])
|
||||
else:
|
||||
(x, y) = (0, 0)
|
||||
x, y = 0, 0
|
||||
break
|
||||
counter += 1
|
||||
x -= (x % self.width)
|
||||
|
||||
# trim off the slop
|
||||
x = x - (x % self.width)
|
||||
|
||||
# in this case, the line is a multiple of width, and there is nothing
|
||||
# (besides a newline) to display on the "next" line, so we should
|
||||
# reduce the wrapping by one line.
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue