void (@NotNull PsiElement textBlock, String suffix) { String textBlockText = textBlock.getText(); String[] lines = textBlockText.split("\n", -1); if (lines.length < 2) return; int indent = PsiLiteralUtil.getTextBlockIndent(lines, true, false); if (indent == -1) return; int offset = 0; for (int i = 0; i < lines.length; i++) { String line = lines[i]; if (i != 0) offset++; if (line.isBlank() || line.startsWith("\"\"\"")) { for (int j = 3, length = line.length(); j < length; j++) { char c = line.charAt(j); if (!PsiLiteralUtil.isTextBlockWhiteSpace(c)) return; } offset += line.length(); continue; } int lineEnd = line.endsWith(suffix)? line.length() - suffix.length() : line.length(); if (lineEnd == 0) continue; char c = line.charAt(lineEnd - 1); if (c == ' ' || c == '\t') { for (int j = lineEnd - 2; j >= 0; j--) { c = line.charAt(j); if (c != ' ' && c != '\t') { holder.registerProblem(textBlock, new TextRange(offset + j + 1, offset + j + 2), JavaBundle.message("inspection.trailing.whitespaces.in.text.block.message"), createFixes()); return; } } } offset += line.length(); } }