show preview for subtasks
[idea/community.git] / python / educational-core / course-creator / src / com / jetbrains / edu / coursecreator / actions / CCShowPreview.java
index ef6b7a6c960c81b12b04e613eb3a28cbeb056dd5..d4185c7e6a4d48f1fadb12644c45503eb61937e4 100644 (file)
@@ -52,6 +52,7 @@ import javax.swing.border.EmptyBorder;
 import java.awt.*;
 import java.text.SimpleDateFormat;
 import java.util.Calendar;
+import java.util.Collections;
 
 public class CCShowPreview extends DumbAwareAction {
   public static final String SHOW_PREVIEW = "Show Preview";
@@ -147,7 +148,8 @@ public class CCShowPreview extends DumbAwareAction {
       }
     });
     for (AnswerPlaceholder answerPlaceholder : taskFile.getActivePlaceholders()) {
-      answerPlaceholder.setUseLength(true);
+      Integer minIndex = Collections.min(answerPlaceholder.getSubtaskInfos().keySet());
+      answerPlaceholder.setUseLength(minIndex >= answerPlaceholder.getActiveSubtaskIndex());
       EduAnswerPlaceholderPainter.drawAnswerPlaceholder(createdEditor, answerPlaceholder, JBColor.BLUE);
     }
     JPanel header = new JPanel();