Skip to content

Commit 239d6e0

Browse files
committedDec 9, 2022
less pager does not work well when using InputStreamSource, fixes #812
1 parent 181279c commit 239d6e0

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed
 

‎builtins/src/main/java/org/jline/builtins/Source.java

+7-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2002-2016, the original author or authors.
2+
* Copyright (c) 2002-2022, the original author or authors.
33
*
44
* This software is distributable under the BSD license. See the terms of the
55
* BSD license in the documentation provided with this software.
@@ -104,6 +104,9 @@ public void close() throws IOException {
104104
}
105105
};
106106
}
107+
if (this.in.markSupported()) {
108+
this.in.mark(Integer.MAX_VALUE);
109+
}
107110
this.name = name;
108111
}
109112

@@ -114,6 +117,9 @@ public String getName() {
114117

115118
@Override
116119
public InputStream read() throws IOException {
120+
if (in.markSupported()) {
121+
in.reset();
122+
}
117123
return in;
118124
}
119125

0 commit comments

Comments
 (0)
Please sign in to comment.