Skip to content

Commit d64b37c

Browse files
committed
pep8 and use color printer #134
1 parent 281023e commit d64b37c

3 files changed

Lines changed: 14 additions & 15 deletions

File tree

src/__tests__/screenForTest.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def getRowsWithAttributesForPastScreens(self, pastScreens):
114114
pages = map(lambda screenIndex: self.getRowsWithAttributes(
115115
screen=self.pastScreens[screenIndex]), pastScreens)
116116

117-
#join the pages together into one stream
117+
# join the pages together into one stream
118118
lines, attributes = zip(*pages)
119119
return ([line for page in lines for line in page],
120120
[line for page in attributes for line in page])

src/format.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -206,12 +206,12 @@ def output(self, printer):
206206
if (y < miny or y >= maxy):
207207
# wont be displayed!
208208
return
209-
209+
210210
# we dont care about the after text, but we should be able to see
211211
# all of the decorated match (which means we need to see up to
212212
# the end of the decoratedMatch, aka include beforeText)
213213
importantTextLength = len(str(self.beforeText)) + \
214-
len(str(self.decoratedMatch))
214+
len(str(self.decoratedMatch))
215215
spaceForPrinting = maxx - minx
216216
if importantTextLength > spaceForPrinting:
217217
# hrm, we need to update our decorated match to show
@@ -223,7 +223,7 @@ def output(self, printer):
223223
else:
224224
# first check what our expanded size would be:
225225
expandedSize = len(str(self.beforeText)) + \
226-
len(self.getMatch())
226+
len(self.getMatch())
227227
if expandedSize < spaceForPrinting and self.isTruncated:
228228
# if the screen gets resized, we might be truncated
229229
# from a previous render but **now** we have room.

src/screenControl.py

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,6 @@ def getHoveredFiles(self):
392392
if index == self.hoverIndex]
393393

394394
def showAndGetCommand(self):
395-
self.stdscr.attrset(0)
396395
fileObjs = self.getFilesToUse()
397396
files = [fileObj.getFile() for fileObj in fileObjs]
398397
(maxy, maxx) = self.getScreenDimensions()
@@ -409,26 +408,26 @@ def showAndGetCommand(self):
409408
# first lets print all the files
410409
startHeight = halfHeight - 1 - len(files)
411410
try:
412-
self.stdscr.addstr(startHeight - 3, 0, borderLine)
413-
self.stdscr.addstr(startHeight - 2, 0, SHORT_FILES_HEADER)
414-
self.stdscr.addstr(startHeight - 1, 0, borderLine)
411+
self.colorPrinter.addstr(startHeight - 3, 0, borderLine)
412+
self.colorPrinter.addstr(startHeight - 2, 0, SHORT_FILES_HEADER)
413+
self.colorPrinter.addstr(startHeight - 1, 0, borderLine)
415414
for index, file in enumerate(files):
416-
self.stdscr.addstr(startHeight + index, 0,
417-
file[0:maxFileLength])
415+
self.colorPrinter.addstr(startHeight + index, 0,
416+
file[0:maxFileLength])
418417
except curses.error:
419418
pass
420419

421420
# first print prompt
422421
try:
423-
self.stdscr.addstr(halfHeight, 0, SHORT_COMMAND_PROMPT)
424-
self.stdscr.addstr(halfHeight + 1, 0, SHORT_COMMAND_PROMPT2)
422+
self.colorPrinter.addstr(halfHeight, 0, SHORT_COMMAND_PROMPT)
423+
self.colorPrinter.addstr(halfHeight + 1, 0, SHORT_COMMAND_PROMPT2)
425424
except curses.error:
426425
pass
427426
# then line to distinguish and prompt line
428427
try:
429-
self.stdscr.addstr(halfHeight - 1, 0, borderLine)
430-
self.stdscr.addstr(halfHeight + 2, 0, borderLine)
431-
self.stdscr.addstr(halfHeight + 3, 0, promptLine)
428+
self.colorPrinter.addstr(halfHeight - 1, 0, borderLine)
429+
self.colorPrinter.addstr(halfHeight + 2, 0, borderLine)
430+
self.colorPrinter.addstr(halfHeight + 3, 0, promptLine)
432431
except curses.error:
433432
pass
434433

0 commit comments

Comments
 (0)