diff --git a/src/main/java/com/shuzijun/leetcode/plugin/editor/LCVPreview.java b/src/main/java/com/shuzijun/leetcode/plugin/editor/LCVPreview.java index 4c0c8bf7..0b549e99 100644 --- a/src/main/java/com/shuzijun/leetcode/plugin/editor/LCVPreview.java +++ b/src/main/java/com/shuzijun/leetcode/plugin/editor/LCVPreview.java @@ -39,6 +39,7 @@ import java.io.IOException; import java.io.InputStream; import java.text.DecimalFormat; +import java.text.DecimalFormatSymbols; /** * @author shuzijun @@ -191,7 +192,7 @@ private String getStyle(boolean isTag) { sb.append("}"); sb.append("::-webkit-scrollbar-track {background-color:").append(toHexColor(defaultBackground)).append(";}"); sb.append("::-webkit-scrollbar-thumb {background-color:").append(toHexColor(scrollbarThumbColor)).append(";}"); - sb.append(".vditor-reset {font-size:").append(editorColorsScheme.getEditorFontSize()).append(";"); + sb.append(".vditor-reset {font-size:").append(editorColorsScheme.getEditorFontSize()).append("px;"); sb.append(fontFamily); if (text != null) { sb.append("color:").append(toHexColor(text)).append(";"); @@ -207,6 +208,9 @@ private String getStyle(boolean isTag) { private String toHexColor(Color color) { DecimalFormat df = new DecimalFormat("0.00"); + DecimalFormatSymbols dfs = new DecimalFormatSymbols(); + dfs.setDecimalSeparator('.'); + df.setDecimalFormatSymbols(dfs); return String.format("rgba(%s,%s,%s,%s)", color.getRed(), color.getGreen(), color.getBlue(), df.format(color.getAlpha() / (float) 255)); } diff --git a/src/main/java/com/shuzijun/leetcode/plugin/timer/TimerStatusBarWidgetProvider.java b/src/main/java/com/shuzijun/leetcode/plugin/timer/TimerStatusBarWidgetProvider.java index 098a7a46..926d96f2 100644 --- a/src/main/java/com/shuzijun/leetcode/plugin/timer/TimerStatusBarWidgetProvider.java +++ b/src/main/java/com/shuzijun/leetcode/plugin/timer/TimerStatusBarWidgetProvider.java @@ -1,7 +1,6 @@ package com.shuzijun.leetcode.plugin.timer; import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.Disposer; import com.intellij.openapi.wm.StatusBar; import com.intellij.openapi.wm.StatusBarWidget; import com.intellij.openapi.wm.StatusBarWidgetFactory; @@ -16,7 +15,6 @@ */ public class TimerStatusBarWidgetProvider implements StatusBarWidgetFactory { - private TimerBarWidget timerBarWidget; @Override public @NonNls @NotNull String getId() { @@ -35,21 +33,15 @@ public boolean isAvailable(@NotNull Project project) { @Override public @NotNull StatusBarWidget createWidget(@NotNull Project project) { - if (timerBarWidget == null) { - timerBarWidget = new TimerBarWidget(project); - } - return timerBarWidget; + return new TimerBarWidget(project); } @Override public void disposeWidget(@NotNull StatusBarWidget widget) { - if (timerBarWidget != null) { - Disposer.dispose(timerBarWidget); - } } @Override public boolean canBeEnabledOn(@NotNull StatusBar statusBar) { - return false; + return true; } }