Add text end padding only if in target fold

Change-Id: I313556560668a44f486e1083b62076d032e43b70
diff --git a/src/main/java/org/ids_mannheim/Worker.java b/src/main/java/org/ids_mannheim/Worker.java
index 2f6b32b..d571dc6 100644
--- a/src/main/java/org/ids_mannheim/Worker.java
+++ b/src/main/java/org/ids_mannheim/Worker.java
@@ -116,7 +116,9 @@
                     if (line.startsWith("#")) {
                         Matcher matcher = new_text_pattern.matcher(line);
                         if (matcher.find()) {
-                            slidingWindowQueue.textBreak();
+                            if (fold == target_fold) {
+                                slidingWindowQueue.textBreak();
+                            }
                             fold = deterministicRandomProvider.getFoldFromTextID(matcher.group(1)) + 1;
                             texts++;
                             if (fold == target_fold) {
@@ -160,7 +162,9 @@
                         }
                     }
                 }
-                slidingWindowQueue.textBreak();
+                if (fold == target_fold) {
+                    slidingWindowQueue.textBreak();
+                }
                 pool.markFree(poolIndex);
                 if (texts > 0) {
                     logger.info(pool.getHost(poolIndex) + " finished " + fname + " with " + texts + " texts");