提交 d99f5601 authored 作者: noelgrandin@gmail.com's avatar noelgrandin@gmail.com

Handle tabs like 4 spaces in web console, patch by Martin Grajcar

上级 0f49df20
......@@ -21,6 +21,7 @@ Change Log
(PageStore only; the MVStore already used 4096).
</li><li>Auto-scale MAX_MEMORY_ROWS and CACHE_SIZE settings by the amount of available RAM. Gives a better
out of box experience for people with more powerful machines.
</li><li>Handle tabs like 4 spaces in web console, patch by Martin Grajcar
</li></ul>
<h2>Version 1.4.180 Beta (2014-07-13)</h2>
......
......@@ -16,6 +16,8 @@ import org.h2.util.New;
* This class is used by the H2 Console.
*/
public class PageParser {
private static final int TAB_WIDTH = 4;
private final String page;
private int pos;
private final Map<String, Object> settings;
......@@ -245,13 +247,16 @@ public class PageParser {
boolean convertSpace = true;
for (int i = 0; i < s.length(); i++) {
char c = s.charAt(i);
if (c == ' ') {
if (c == ' ' || c == '\t') {
// convert tabs into spaces
for (int j = 0; j < (c == ' ' ? 1 : TAB_WIDTH); j++) {
if (convertSpace && convertBreakAndSpace) {
buff.append("&nbsp;");
} else {
buff.append(' ');
convertSpace = true;
}
}
continue;
}
convertSpace = false;
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论