Skip to content

Commit

Permalink
less pager does not work well when using InputStreamSource, fixes #812
Browse files Browse the repository at this point in the history
  • Loading branch information
mattirn committed Dec 9, 2022
1 parent 181279c commit 239d6e0
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion builtins/src/main/java/org/jline/builtins/Source.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2002-2016, the original author or authors.
* Copyright (c) 2002-2022, the original author or authors.
*
* This software is distributable under the BSD license. See the terms of the
* BSD license in the documentation provided with this software.
Expand Down Expand Up @@ -104,6 +104,9 @@ public void close() throws IOException {
}
};
}
if (this.in.markSupported()) {
this.in.mark(Integer.MAX_VALUE);
}
this.name = name;
}

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

@Override
public InputStream read() throws IOException {
if (in.markSupported()) {
in.reset();
}
return in;
}

Expand Down

0 comments on commit 239d6e0

Please sign in to comment.