On Wed, Jul 2, 2014 at 1:59 PM, Noel Grandin <[email protected]> wrote:
> > There is always lots of stuff to work on if you're keen :-) > For example, see: > https://groups.google.com/d/msg/h2-database/SL2hdB7VlnY/6RanPmy_WVsJ > which is also a problem I have seen, but haven't had a chance to track > down yet. I can't reproduce it (and don't really care about). Another thing: The browser shows line breaks by transforming them into <br>, it also honors leading space, but ignores tabs (which is what I'm using). I guess we can agree that it's not perfect. The tab width is something we could discuss till the heat death of the universe, but given that a proportional font is used, the discussion makes little sense and I've set it to 4. WDYT? -- You received this message because you are subscribed to the Google Groups "H2 Database" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/h2-database. For more options, visit https://groups.google.com/d/optout.
From f3e6cb8367100ee5cb003346cec3683a8f3b82a0 Mon Sep 17 00:00:00 2001 From: Maaartin Grajcar <[email protected]> Date: Fri, 18 Jul 2014 12:29:45 +0200 Subject: [PATCH] Handle tabs like 4 spaces in web console. --- src/main/org/h2/server/web/PageParser.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/main/org/h2/server/web/PageParser.java b/src/main/org/h2/server/web/PageParser.java index a48020b..ee1499c 100644 --- a/src/main/org/h2/server/web/PageParser.java +++ b/src/main/org/h2/server/web/PageParser.java @@ -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,12 +247,14 @@ public class PageParser { boolean convertSpace = true; for (int i = 0; i < s.length(); i++) { char c = s.charAt(i); - if (c == ' ') { - if (convertSpace && convertBreakAndSpace) { - buff.append(" "); - } else { - buff.append(' '); - convertSpace = true; + if (c == ' ' || c == '\t') { + for (int j = 0; j < (c == ' ' ? 1 : TAB_WIDTH); j++) { + if (convertSpace && convertBreakAndSpace) { + buff.append(" "); + } else { + buff.append(' '); + convertSpace = true; + } } continue; } -- 2.0.1
