File tree Expand file tree Collapse file tree 1 file changed +8
-2
lines changed
console-ui/src/main/java/org/jline/consoleui/prompt Expand file tree Collapse file tree 1 file changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -130,7 +130,7 @@ public Map<String, PromptResultItemIF> prompt(
130130 try {
131131 Map <String , PromptResultItemIF > resultMap = new HashMap <>();
132132 prompt (header , promptableElementList , resultMap );
133- return resultMap ;
133+ return removeNoResults ( resultMap ) ;
134134 } finally {
135135 close ();
136136 }
@@ -203,7 +203,7 @@ public Map<String, PromptResultItemIF> prompt(
203203 peResult = new HashMap <>();
204204 }
205205 }
206- return resultMap ;
206+ return removeNoResults ( resultMap ) ;
207207 } finally {
208208 // Restore the original state of cancellable
209209 config .setCancellableFirstPrompt (cancellable );
@@ -403,6 +403,12 @@ private void removePreviousResult(PromptableElementIF pe) {
403403 }
404404 }
405405
406+ private Map <String , PromptResultItemIF > removeNoResults (Map <String , PromptResultItemIF > resultMap ) {
407+ return resultMap .entrySet ().stream ()
408+ .filter (e -> !(e .getValue () instanceof NoResult ))
409+ .collect (Collectors .toMap (Map .Entry ::getKey , Map .Entry ::getValue ));
410+ }
411+
406412 /**
407413 * Creates a {@link PromptBuilder}.
408414 *
You can’t perform that action at this time.
0 commit comments