2019-09-08  Per Bothner  <per@bothner.com>

	* PrettyWriter.java (buffer, bufferFillPointer): Make private.
	(getBuffer, getFillIndex, setFillIndex): New accessor methods.
	* CharArrayOutPort.java: Update to use new accessor methods.

2018-12-02  Per Bothner  <per@bothner.com>

	* CheckConsole.java (forDomTerm): Generalize to PrintConsumer.

2018-10-29  Per Bothner  <per@bothner.com>

	* InPort.java (systemInPort): Use name "/dev/tty" if console.

2018-09-29  Per Bothner  <per@bothner.com>

	* TtyInPort.java: Change prompt on DomTerm.
	(promptTemplate1): Add session name and prompt-2 template.
	(sessionName): New static field.

2018-09-21  Per Bothner  <per@bothner.com>

	* TtyInPort.java (lineStart): Request continuation line from DomTerm.
	If input is syntactically incomplete, request DomTerm to add a new
	empty input line appended to the previous input.
	(class MoreInputNeeded): New marker class.

2018-09-19  Per Bothner  <per@bothner.com>

	* JLineInPort.java (KawaParsedLine): Implement CompletingParsedLine.
	This is an incompatible change - if using jline, must be 3.7 or newer.

2018-09-07  Per Bothner  <per@bothner.com>

	* TtyInPort.java: Add %H prompt escape for DomTerm show/hide button.

2018-07-20  Per Bothner  <per@bothner.com>

	* PrettyWriter.java (outputLine): Skip single space before line-break.
	(writeBreak): New helper method for DomTerm conditional break.
	(startLogicalBlock: New overloaded mthoed, logic from OutPort.
	* OutPort.java (startLogicalBlock): Delegate to PrettyWriter,

2018-07-17  Per Bothner  <per@bothner.com>

	* PrettyWriter.java (maybeOutput): Minor fix, for DomTerm.

	* PrettyWriter.java (reallyStartLogicalBlock): Fix typo.
	This dates back to translating from SBCL's pprint.lisp.

2017-12-31  Per Bothner  <per@bothner.com>

	* TtyInPort.java (promptTemplate1): Tweak if using DomTerm and JLine.
	(isJLine): New method.
	* JLineInPort.java (isJLine): New method.

2017-12-23  Per Bothner  <per@bothner.com>

	* URIPath.java (toURL): Use toURIString.
	This fixes a problem with relative names containing spaces.

	* CheckConsole.java (forDomTerm(Appendable)): New method.

	* TermErrorStream.java: Use more robust escape sequences for DomTerm.

2017-12-04  Per Bothner  <per@bothner.com>

	* JLineInPort.java: Some updates needed due to recent JLine3 changes.

2017-11-25  Per Bothner  <per@bothner.com>

	* InPort.java (resetAndKeep): Only delete up to lineStartPos.
	This fixes a line-number increment bug when calling read from a REPL.
	See "Prompt on read" thread on mailing list.
	* JLineInPort.java (fill): Set LINE_OFFSET.  This fixes line numbers
	when calling read-line from REPL using jline3.

2017-03-09  Per Bothner  <per@bothner.com>

	* JLineInPort.java: Don't NPE if doing a plain non-language read.
	When doing a "run-time read" for data, not code, don't try to parse
	the line (to check for incomplete forms).  Distinguish code vs data
	by not setting the language field until called by the repl.

2017-01-06  Per Bothner  <per@bothner.com>

	* OutPort.java (charEncoding): New ThreadLocation.

2017-01-04  Per Bothner  <per@bothner.com>

	* JLineInPort.java: Only set JLine MOUSE mode if requested.
	* CheckConsole.java (useJLineMouse): New ThreadLocation.

2016-11-20  Per Bothner  <per@bothner.com>

	* PrettyWriter.java: Fix to end-block handling for isDomTerm().

2016-11-19  Per Bothner  <per@bothner.com>

	* JLineInPort.java (<init>): Set MOUSE support option.

2016-11-06  Per Bothner  <per@bothner.com>

	* CheckConsole.java (useDomTerm): Remove ThreadLocal.
	(consoleType): New TheadLocal; new static method.

	* JLineInPort.java (makeTerminal): Set charset to UTF-8.
	This fixes some problems on Windows.

	* TtyInPort.java (promptTemplate1): Add hide/show button if DomTerm.

	* WriterManager.java (run): Call close rather than flush.
	Revises previous change (from finalize to flush);
	let's hope this works ok ...

2016-11-05  Per Bothner  <per@bothner.com>

	* Path.java (probeContentType): Make a bit more general and robust.
	Since URLConnection.guessContentTypeFromName doesn't understand
	"jar:" scheme, add special hack for it.
	Hardwire in some extensions not recognized by guessContentTypeFromName.

2016-11-02  Per Bothner  <per@bothner.com>

	* JLineInPort.java (setInDomTerm): New method.
	Set DELAY_LINE_WRAP option to JLine3 (personal fork).

2016-11-01  Per Bothner  <per@bothner.com>

	* JLineInPort.java (KawaParsedLine): Initialize 'word' field to "".
	This avoids a NullPointerException.

2016-10-31  Per Bothner  <per@bothner.com>

	* PrettyWriter.java: Change DomTerm support to be more like default.
	Specifically, maybeOutput may do output even if not flushing.
	While a lineLength limit isn't relevant, it's good writing
	things out when we can.  It also avoids a bug with setSharing.

2016-10-30  Per Bothner  <per@bothner.com>

	* JLineInPort.java (maybeColorizePrompt): Colorize default prompts.
	(promptTemplate1, promptTemplate2): Override.

2016-10-27  Per Bothner  <per@bothner.com>

	* PrettyWriter.java (outputLine): Fix handling of NEWLINE_DUMMY.

2016-10-12  Per Bothner  <per@bothner.com>

	* PrettyWriter.java: Define NEWLINE_DUMMY newline type.
	This prints nothing, but is used to end "sections".

2016-10-11  Per Bothner  <per@bothner.com>

	* PrettyWriter.java: Fix two small bugs.
	* OutPort.java (setPrettyPrinting): New method.
	* PrettyWriter.java: Make some members private. Tweak logging.

2016-09-23  Per Bothner  <per@bothner.com>

	* PrettyWriter.java (maybeOutput): Emit plain newline rather than
	a "required" newline, when not inside a block.

2016-09-21  Per Bothner  <per@bothner.com>

	* PrettyWriter.java: If DomTerm, don't do line-breaking.
	Instead send DomTerm-speific escape sequences, so DomTerm
	can do the line-breaking dynamically.
	* OutPort.java (setDomTerm): Also setDomTerm on PrettyWriter bout.

2016-09-08  Per Bothner  <per@bothner.com>

	* JLineInPort.java (parse): Check if Language.parse returned null.

2016-09-07  Per Bothner  <per@bothner.com>

	* OutPort.java (formatter): Make non-public.
	(pushConsumer, popConsumer): Remove unused methods.
	(getPassThroughOutPort): Moved from AbstractFormat.

2016-08-12  Per Bothner  <per@bothner.com>

	A cleaner format/consumer model.
	* OutPort.java: Replace 'objectFormat' and 'numberFormat' fields
	by new 'formatter', initially the PrettyPrinter.
	* PrettyWriter.java: Change to extend PrintConsumer.

2016-07-18  Per Bothner  <per@bothner.com>

	* WriterManager.java (run): Call flush rather than finalize on ports.
	This is safer, since otherwise we can get races because other threads
	might still be active and try to access the port.

2016-07-17  Per Bothner  <per@bothner.com>

	REPL input causing SyntaxException was not being added to history.
	* JLineInPort.java (parse): SyntaxException is now caught by
	Language#parse, so detect end-of-file using ERROR_SEEN.

2016-07-14  Per Bothner  <per@bothner.com>

	* TermErrorStream.java (write): Don't write error markers
	if byte array is empty.

2016-07-01  Per Bothner  <per@bothner.com>

	* TtyInPort.java: Some changes in prompt handling.
	Better support for DomTerm.
	(promptTemplate1, promptTemplate2): New convenience methods.
	(expandPrompt): Handle %{...%} escapes.  Return width.
	* JLineInPort.java: Use promptTemplate1 and promptTemplate2.

2016-06-25  Per Bothner  <per@bothner.com>

	* Path.java (readAllBytes): Handle case if unknown content-length.

2016-06-22  Per Bothner  <per@bothner.com>

	* JLineInPort.java: Remove obsolete support for JLine version 2.

2016-06-17  Per Bothner  <per@bothner.com>

	* TtyInPort.java (signIntHandler): New field.

	* QueueReader.java (appendEOF): Add missing notifyAll call.

2016-06-15  Per Bothner  <per@bothner.com>

	* JLineInPort.java (parse): Update to use new ParseContext parameter.

2016-06-14  Per Bothner  <per@bothner.com>

	Pass windows size events from DomTem to JLine.
	* JLineInPort.java (setSIze): New method.

	* CheckConsole.java (useJLine): New ThreadLocation; new method.
	(useDomTerm): New ThreadLocation; new method.
	(forDomTerm): Use isDomTerm method rather than checking outInitial.
	* JLineInPort.java: Various tweaks and small fixes.

	* TtyInPort.java (make): Only create a JLineInPort if useJLine.
	* OutPort.java (finalizeAction): Rename field to flags.
	(IS_DOMTERM): New flag constant.
	(isDomTerm, setDomTerm): New methods.

2016-06-11  Per Bothner  <per@bothner.com>

	Handle setting prompt1 and prompt2 templates from command-line.
	* TtyInPort.java (prompt1, prompt2): Move to ...
	* CheckConsole.java: ... here to avoid class initialization
	order problem.
	* TtyInPort.java (expandPrompt): Make static.
	* JLineInPort.java: Update.

2016-06-05  Per Bothner  <per@bothner.com>

	* JLineInPort.java: Major changes to tab-completion for jline3.
	(parseForComplete): New method.

	* DomTermErrorStream.java: Renamed to ...
	* TermErrorStream.java: and add support for generic ANSI terminals.

2016-06-02  Per Bothner  <per@bothner.com>

	* JLine2InPort.java: Rename to ...
	* JLineInPort.java ... because we primarily support JLine version 3.

	Add support for using JLine3.  Relatedly, re-do prompt handling.
	* JLine2InPort.java: Add support for version 3 of JLine library.
	Specifically handle multiline inputs.
	* TtyInPort.java (prompt1, prompt2): New ThreadLocations static.
	(defaultPrompt, expandPrompt): Expand a prompt pattern.
	(lineStart): Don't call prompter procedure for continuation lines.
	(wrapPromptForAnsi): Add styling for prompt.
	* InPort.java (eofSeen): New method.
	* CharArrayInPort.java (make(CharSequence,String)): New overload.

2016-05-07  Per Bothner  <per@bothner.com>

	* JLine2InPort.java: Extend so it works with either JLine3
	proptotype as well as with JLine2.

2016-03-18  Per Bothner  <per@bothner.com>

	* Path.java (coerceToPathOrNull): Fix check for absolute filename
	on Windows.

2016-02-24  Per Bothner  <per@bothner.com>

	* InPort.java (KEEP_ALL): New flag.
	(setKeepAll, resetAndKeep): New methods.
	(reserve): Handle KEEP_ALL.
	* JLine2InPort.java: Add completion support.

2016-02-24  Per Bothner  <per@bothner.com>

	Remove unneeded imports of gnu.text.

2016-02-14  Per Bothner  <per@bothner.com>

	Add support for JLine2 as a readline alternative.
	* JLine2InPort.java: New class - extends TtyInPort.
	* TtyInPort.java (make): New factory method.
	(afterFill, wrapPromptForDomTerm): New helper methods.
	* InPort.java: Use new TtyInPort.make factory method/

2016-02-09  Per Bothner  <per@bothner.com>

	* CheckConsole.java: Re-factor so we can re-evaluate domterm status
	after setHaveConsole - i.e. if DOMTERM env var and --console option.

2016-01-30  Per Bothner  <per@bothner.com>

	* OutPort.java (isPrettyPrinting, atLineStart): New methods.
	(freshLine): Use atLineStart.
	* PrettyWriter.java (atLineStart): New method.
	* BinaryOutPort.java (getColumnNumber): Remove. 

2016-01-09  Per Bothner  <per@bothner.com>

	* CheckConsole.java: Change previous DomTerm handling: We don't want
	to assume we're connected to a DomTerm terminal just because the
	DOMTERM environment variable is set, since we might be in a pipe.

2015-12-17  Per Bothner  <per@bothner.com>

	* CheckConsole.java (haveConsole): If running under DomTerm,
	ignore --no-console flag.

2015-12-16  Per Bothner  <per@bothner.com>

	Add support for DomTerm.
	* CheckConsole.java (getDomTermVersionInfo, forDomTerm):
	New static methods.
	* TtyInPort.java (inDomTerm): New flag.
	(setInDomTerm): Set flag.
	(emitPrompt): Add DomTerm delimiters around prompt.
	* InPort.java: Maybe set dom-term flag on systemInPort.
	* DomTermErrorStream.java (setSystemErr): New static method.

2015-11-27  Per Bothner  <per@bothner.com>

	* DomTermErrorStream.java: New class - extends PrintStream.

2015-10-24  Per Bothner  <per@bothner.com>

	* InPort.java (inLocation): Add type parameters.
	* OutPort.java (outLocation, errLocation): Likewise.

2015-10-12  Per Bothner  <per@bothner.com>

	* InPort.java (stringPathname, evalPathname): New constants.
	* CharArrayInPort.java (stringPath): Use stringPathname.

	* Path.java (valueOf): A string starting with a '/' is a FilePath.

2015-10-10  Per Bothner  <per@bothner.com>

	Changes in Path/URI handling, with corrected RFC-3986 'resolve'.
	* URIPath.java (resolve): Rewrite, implementing the RFC-3986
	resolution algorithm, rather than using java.net.URI.resolve, which
	follows the obsolete RFC-2396.  Biggest difference is that resolve("")
	is now basically a no-op. Use resolve(".") to get directory.
	(resolveToUri): Helper method.
	(toFile): New method.
	* URLPath.java (resolve): Use resolveToUri.
	* Path.java (toFile, isPlainFile): New methods.
	(valueOf): Create URIPath rather than FilePath if relative.
	(getLast): Fix thinko.
	* FilePath.java (resolve): No-op if argument is "".
	(toURL): Update accordingly.

2015-07-31  Per Bothner  <per@bothner.com>

	* CharArrayInPort.java: Add support for reading from
	indirect-indexable AbstractCharVector.
	* InPort.java (read): Kludge for CharArrayInPort.

2015-05-05  Per Bothner  <per@bothner.com>

	* PrettyWriter.java (enqueue): If we're sharing, we don't wrap around,
	so may need to re-allocate even there is unused space at the start.
	(enoughSpace): Use 1.5 rather than 2.0 as grow factor.
	(enqueue): Simplify re-allocation to just use enoughSpace value.
	(itemKindString): Update debug helper.

	* TtyInPort.java (lineStart): Try again ...

2015-05-03  Per Bothner  <per@bothner.com>

	* TtyInPort.java: Minor tweak to previous change: Don't call
	freshLine if resuluting promot string is null or empty.

2015-05-02  Per Bothner  <per@bothner.com>

	* TtyInPort.java (lineStart): Only call freshLine if we have
	a prompter.

2015-01-11  Per Bothner  <per@bothner.com>

	* CheckConsole.java: New helper class to support --console flag.
	(setHaveConsole, haveConsole): New methods.
	(haveConsole): New 3-valued field replaces boolean InPort.noConsole.
	* InPort.java (systemInPort): Use CheckConsole.haveConsole.
	(haveConsole): Moved to CheckConsole.
	(noConsole): Removed.

2014-12-19  Per Bothner  <per@bothner.com>

	* FilePath.java	(valueOf): If filename starts with "file:",
	first convert to URI.
	(resolve): If the relative path starts with "file:", create a
	FilePath rather than a URLPath.  Use relative File creation
	instead of URI#resolve - this is more robust with unusual characters.

2014-11-23  Per Bothner  <per@bothner.com>

	* Path.java (search): Fix logic error.

2014-10-29  Per Bothner  <per@bothner.com>

	* InPort.java (systemInPort): Initialize to a BinaryInPort if
	we have no console.
	(noConsole): Static field moved from repl.java.
	(haveConsole): New method.

2014-10-27  Per Bothner  <per@bothner.com>

	* NBufferedInputStream.java (fillBytes): Generalize to allow
	pos to be less than limit, and thus needing to be saved.  Needed if
	we fail to decode the first byte of a mutli-byte sequence.
	* BinaryInPort.java (fill): Fix decode logic.

2014-09-28  Per Bothner  <per@bothner.com>

	* BinaryInPort.java (defaultCset): New field.
	(setDefaultCharset): New method.
	(fill): Use defaultCset.
	* Path.java (search): New method for searching using a searchpath.
	(PATH_CURRENT, PATH_RELATIV): New constants.

2014-09-17  Per Bothner  <per@bothner.com>

	* PrettyWriter.java (finishIDHash): New convenience method.

2014-07-17  Per Bothner  <per@bothner.com>

	* InPort.java (readCodePoint): Fix bad error in handling surrogates.

2014-05-13  Per Bothner  <per@bothner.com>

	* InPort.java (systemInFilename): New constant.

2014-03-18  Per Bothner  <per@bothner.com>

	* Path.java: Moved from gnu/text.
	* FilePath.java: Likewise.
	* URIPath.java: Likewise.
	* URLPath.java: Likewise.
	* URLPath.java (classResourcePath): Moved to GetModuleClass.java.

2014-03-17  Per Bothner  <per@bothner.com>

	* NBufferedInputStream.java (<init>): Failed to set barr field to
	supplied buffer.

2014-02-23  Per Bothner  <per@bothner.com>

	* BinaryInPort.java (class BinaryInputStream): Rename to
	NBufferedInputStream and moved to separate file.
	(fill): If charset not set, defer defaulting to UTF-8 as long
	as we only see ASCII.  This allows handing encoding declarations.
	(setFromByteOrderMark): New method.
	(openHeuristicFile): New static method.
	* NBufferedInputStream.java: New file.
	Add suppot for mark/reset.

2014-02-16  Per Bothner  <per@bothner.com>

	* WriterManager.java: Make sure Error is uncaught or re-thrown.

2014-02-08  Per Bothner  <per@bothner.com>

	* WriterManager.java (registerShutdownHook): Simplify - we now
	require Java 3 and thus Runtime.addShutdownHook.

2014-01-10  Per Bothner  <per@bothner.com>

	* InPort.java: Add synchronization based on lock field.
	* BinaryInPort.java: Fix some small bugs.

2014-01-09  Per Bothner  <per@bothner.com>

	* BinaryInPort.java (<init>): Don't force using a fixed buffer.
	Instead setKeepFullLines(false).

	* LineInputStreamReader.java: Merge into BinaryInPort.java, and remove.

2014-01-08  Per Bothner  <per@bothner.com>

	* LineBufferedReader.java: Merge into InPort.java, and remove.

2014-01-06  Per Bothner  <per@bothner.com>

	* BinaryInPort.java: Moved from gnu.mapping.
	* BinaryOutPort.java: Likewise.
	* CharArrayInPort.java: Likewise.
	* CharArrayOutPort.java: Likewise.
	* InPort.java: Likewise.
	* OutPort.java: Likewise.
	* LogWriter.java: Likewise.
	* TtyInPort.java: Likewise.
	* LineBufferedReader.java: Moved from gnu.text.
	* LineInputStreamReader.java: Likewise.
	* NullReader.java: Likewise.
	* PrettyWriter.java: Likewise.
	* QueueReader.java: Likewise.
	* WriterManager.java: Likewise.
