Skip to content

Commit

Permalink
DefaultHistory: a few small improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
mattirn committed Jan 24, 2021
1 parent 6c3cfb7 commit b092366
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,11 +136,7 @@ private void setHistoryFileData(Path path, HistoryFileData historyFileData) {
private boolean isLineReaderHistory (Path path) throws IOException {
Path lrp = getPath();
if (lrp == null) {
if (path != null) {
return false;
} else {
return true;
}
return path == null;
}
return Files.isSameFile(lrp, path);
}
Expand Down Expand Up @@ -341,7 +337,7 @@ public int last() {

private String format(Entry entry) {
if (reader.isSet(LineReader.Option.HISTORY_TIMESTAMPED)) {
return Long.toString(entry.time().toEpochMilli()) + ":" + escape(entry.line()) + "\n";
return entry.time().toEpochMilli() + ":" + escape(entry.line()) + "\n";
}
return escape(entry.line()) + "\n";
}
Expand Down Expand Up @@ -446,7 +442,7 @@ public Spliterator<Entry> spliterator() {
}

public void resetIndex() {
index = index > items.size() ? items.size() : index;
index = Math.min(index, items.size());
}

protected static class EntryImpl implements Entry {
Expand Down Expand Up @@ -627,7 +623,7 @@ static String unescape(String s) {
return sb.toString();
}

private class HistoryFileData {
private static class HistoryFileData {
private int lastLoaded = 0;
private int entriesInFile = 0;

Expand Down

0 comments on commit b092366

Please sign in to comment.