From 20018e7e7d5a103e1b51fd32392df923cf0a7007 Mon Sep 17 00:00:00 2001 From: Mikhail Golubev Date: Mon, 28 Mar 2016 16:09:45 +0300 Subject: [PATCH] PY-18486 Fixed off-by-one error in BaseQuoteHandler --- .../jetbrains/python/editor/BaseQuoteHandler.java | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/python/src/com/jetbrains/python/editor/BaseQuoteHandler.java b/python/src/com/jetbrains/python/editor/BaseQuoteHandler.java index 4f127173f767..c5d14dfa8b53 100644 --- a/python/src/com/jetbrains/python/editor/BaseQuoteHandler.java +++ b/python/src/com/jetbrains/python/editor/BaseQuoteHandler.java @@ -133,16 +133,16 @@ public class BaseQuoteHandler extends SimpleTokenSetQuoteHandler implements Mult public CharSequence getClosingQuote(HighlighterIterator iterator, int offset) { Document document = iterator.getDocument(); String text = document.getText(); - char the_quote = text.charAt(offset - 1); + char theQuote = text.charAt(offset - 1); if ( - offset >= 2 && - text.charAt(offset - 2) == the_quote && - text.charAt(offset - 3) == the_quote && - (offset < 4 || text.charAt(offset - 4) != the_quote)) { - return StringUtil.repeat(String.valueOf(the_quote), 3); + offset >= 3 && + text.charAt(offset - 2) == theQuote && + text.charAt(offset - 3) == theQuote && + (offset < 4 || text.charAt(offset - 4) != theQuote)) { + return StringUtil.repeat(String.valueOf(theQuote), 3); } else if (super.isOpeningQuote(iterator, offset - 1)) { - return String.valueOf(the_quote); + return String.valueOf(theQuote); } return null; }