Skip to content

Commit fc59304

Browse files
committed
Resolves #72 explain if already provided #99
1 parent 1b44976 commit fc59304

1 file changed

Lines changed: 23 additions & 0 deletions

File tree

src/screenControl.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -444,6 +444,18 @@ def showAndGetCommand(self):
444444

445445
def beginEnterCommand(self):
446446
self.stdscr.clear()
447+
# first check if they are trying to enter command mode
448+
# but already have a command...
449+
if len(self.flags.getPresetCommand()):
450+
self.helperChrome.output(self.mode)
451+
(_, minY, _, maxY) = self.getChromeBoundaries()
452+
yStart = (maxY + minY) / 2 - 3
453+
self.printProvidedCommandWarning(yStart)
454+
self.getKey()
455+
self.mode = SELECT_MODE
456+
self.dirtyLines()
457+
return
458+
447459
self.mode = COMMAND_MODE
448460
self.helperChrome.output(self.mode)
449461
logger.addEvent('enter_command_mode')
@@ -510,6 +522,17 @@ def printLines(self):
510522
def printScroll(self):
511523
self.scrollBar.output()
512524

525+
def printProvidedCommandWarning(self, yStart):
526+
self.colorPrinter.setAttributes(
527+
curses.COLOR_WHITE, curses.COLOR_RED, 0)
528+
self.stdscr.addstr(yStart, 0, 'Oh no! You already provided a command so ' +
529+
'you cannot enter command mode.')
530+
self.stdscr.attrset(0)
531+
self.stdscr.addstr(
532+
yStart + 1, 0, 'The command you provided was "%s" ' % self.flags.getPresetCommand())
533+
self.stdscr.addstr(
534+
yStart + 2, 0, 'Press any key to go back to selecting files.')
535+
513536
def printChrome(self):
514537
self.helperChrome.output(self.mode)
515538

0 commit comments

Comments
 (0)