diff -r a779be4e8558 -r 1a9af8b10745 QScintilla/SearchReplaceWidget.py --- a/QScintilla/SearchReplaceWidget.py Thu Jan 05 19:38:23 2012 +0100 +++ b/QScintilla/SearchReplaceWidget.py Fri Jan 06 13:06:46 2012 +0100 @@ -292,8 +292,13 @@ line = self.__selection[2] index = self.__selection[3] else: - line = lineFrom - index = indexFrom - 1 + if (lineFrom, indexFrom) == (-1, -1): + # no selection present + line = cline + index = cindex + else: + line = lineFrom + index = indexFrom - 1 if self.ui.selectionCheckBox.isChecked() and \ line == self.__selection[0] and \ index >= 0 and \