mirror of
https://github.com/chylex/IntelliJ-IdeaVim.git
synced 2025-08-02 09:59:07 +02:00
Removed legacy CDATA-based XML serializer
This commit is contained in:
parent
b6f840aacb
commit
b69d475e15
@ -21,8 +21,6 @@ package com.maddyhome.idea.vim.helper;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.jdom.CDATA;
|
||||
import org.jdom.Content;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@ -102,62 +100,6 @@ public class StringHelper {
|
||||
return res.toString();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Deprecated
|
||||
private static String unentities(@NotNull String text) {
|
||||
StringBuilder res = new StringBuilder(text.length());
|
||||
|
||||
for (int i = 0; i < text.length(); i++) {
|
||||
char ch = text.charAt(i);
|
||||
switch (ch) {
|
||||
case '&':
|
||||
int semi = text.indexOf(';', i);
|
||||
if (semi > i) {
|
||||
char newch = ch;
|
||||
String entity = text.substring(i, semi + 1);
|
||||
if (entity.equals(" ")) {
|
||||
newch = ' ';
|
||||
}
|
||||
else if (entity.equals("!")) {
|
||||
newch = '!';
|
||||
i = semi;
|
||||
}
|
||||
else if (entity.equals("[")) {
|
||||
newch = '[';
|
||||
i = semi;
|
||||
}
|
||||
else if (entity.equals("]")) {
|
||||
newch = ']';
|
||||
i = semi;
|
||||
}
|
||||
else if (entity.equals("&")) {
|
||||
newch = '&';
|
||||
i = semi;
|
||||
}
|
||||
else if (entity.equals("	")) {
|
||||
newch = '\t';
|
||||
}
|
||||
else if (entity.equals(" ")) {
|
||||
newch = '\n';
|
||||
}
|
||||
else if (entity.equals(" ")) {
|
||||
newch = '\r';
|
||||
}
|
||||
if (newch != ch) {
|
||||
ch = newch;
|
||||
i = semi;
|
||||
}
|
||||
}
|
||||
res.append(ch);
|
||||
break;
|
||||
default:
|
||||
res.append(ch);
|
||||
}
|
||||
}
|
||||
|
||||
return res.toString();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static List<KeyStroke> stringToKeys(@NotNull String s) {
|
||||
final List<KeyStroke> res = new ArrayList<KeyStroke>();
|
||||
@ -305,14 +247,6 @@ public class StringHelper {
|
||||
@Nullable
|
||||
public static String getSafeXmlText(@NotNull Element element) {
|
||||
final String text = element.getText();
|
||||
//noinspection unchecked
|
||||
final List<Content> contentItems = element.getContent();
|
||||
for (Content content : contentItems) {
|
||||
if (content instanceof CDATA) {
|
||||
// TODO: Remove compatibility with the IdeaVim <= 0.24 settings style in the next versions
|
||||
return unentities(text);
|
||||
}
|
||||
}
|
||||
final String encoding = element.getAttributeValue("encoding");
|
||||
if (encoding == null) {
|
||||
return text;
|
||||
|
Loading…
Reference in New Issue
Block a user