--- a/QScintilla/Editor.py Sat Feb 03 18:37:36 2018 +0100 +++ b/QScintilla/Editor.py Sat Feb 03 18:41:49 2018 +0100 @@ -145,6 +145,14 @@ RequestSyncToken = "REQUEST_SYNC" SyncToken = "SYNC" + VcsConflictMarkerLineRegExpList = ( + r"""^<<<<<<< .*?$""", + r"""^\|\|\|\|\|\|\| .*?$""", + r"""^=======.*?$""", + r"""^>>>>>>> .*?$""", + ) + + def __init__(self, dbs, fn="", vm=None, filetype="", editor=None, tv=None): """ @@ -6105,6 +6113,30 @@ self.tr("No syntax error message available.")) ########################################################################### + ## VCS conflict marker handling methods below + ########################################################################### + + def getVcsConflictMarkerLines(self): + """ + Public method to determine the lines containing a VCS conflict marker. + + @return list of line numbers containg a VCS conflict marker + @rtype list of int + """ + conflictMarkerLines = [] + + for searchRe in Editor.VcsConflictMarkerLineRegExpList: + ok = self.findFirstTarget(searchRe, True, False, False, 0, 0) + while ok: + spos = self.getFoundTarget()[0] + line = self.lineIndexFromPosition(spos)[0] + conflictMarkerLines.append(line) + + ok = self.findNextTarget() + + return conflictMarkerLines + + ########################################################################### ## Warning handling methods below ###########################################################################