Class FileLineGetter

This is a line getter that customizes the tab completion to fill in file names separated by spaces, like a command line thing.

class FileLineGetter
  : LineGetter;

Fields

NameTypeDescription
searchDirectory stringYou can set this property to tell it where to search for the files to complete.
autoSuggest boolTurn on auto suggest if you want a greyed thing of what tab would be able to fill in as you type.
background ColorYou can customize the colors here. You should set these after construction, but before calling startGettingLine or getline.
echoChar dcharControls the input echo setting.
handleLinkEvent void delegate(LinkEvent, LineGetter)Gives a convenience hook for subclasses to handle my terminal's hyperlink extension.
historyCommitMode LineGetter.HistoryCommitModeHistory is normally only committed to the file when the program is terminating, but if you are losing data due to crashes, you might want to change this to historyCommitMode = HistoryCommitMode.afterEachLine;.
historyRecallFilterMethod LineGetter.HistoryRecallFilterMethodControls what happens when the user presses the up key, etc., to recall history entries. See [HistoryRecallMethod] for the options.
pastePreprocessor string delegate(string)
promptColor ColorYou can customize the colors here. You should set these after construction, but before calling startGettingLine or getline.
regularForeground ColorYou can customize the colors here. You should set these after construction, but before calling startGettingLine or getline.
specialCharBackground ColorYou can customize the colors here. You should set these after construction, but before calling startGettingLine or getline.
suggestionForeground ColorYou can customize the colors here. You should set these after construction, but before calling startGettingLine or getline.

Properties

NameTypeDescription
maximumDrawHeight[get] intReturns the maximum vertical space available to draw.
maximumDrawWidth[get] intIf you are implementing a subclass, use this instead of terminal.width to see how far you can draw. Use care to remember this is a width, not a right coordinate.
maximumDrawWidth[set] intSets the maximum width the line getter will use. Set to 0 to disable, in which case it will use the entire width of the terminal.
prompt[get, set] stringSet this if you want a prompt to be drawn with the line. It does NOT support color in string.

Methods

NameDescription
addChar (ch) Adds a character at the current position in the line. You can call this too if you hook events for hotkeys or something. You'll probably want to call redraw() after adding chars.
addString (s) .
appendHistoryToFile (item) If [historyCommitMode] is [HistoryCommitMode.afterEachLine], this line is called after each line to append to the file instead of [saveSettingsAndHistoryToFile].
cancelHistorySearch () Cancels an in-progress history search immediately, discarding the result, returning to the normal prompt.
clear () Clears the buffer.
deleteChar () Deletes the character at the current position in the line. You'll probably want to call redraw() after deleting chars.
deleteToEndOfLine ()
dispose () Call this before letting LineGetter die so it can do any necessary cleanup and save the updated history to a file.
finishGettingLine ()
getline (input) One-call shop for the main workhorse If you already have a RealTimeConsoleInput ready to go, you should pass a pointer to yours here. Otherwise, LineGetter will make its own.
hadInput () Returns true if there was any input in the buffer. Can be checked in the case of a [UserInterruptionException].
historyFileDirectory () Override this to change the directory where history files are stored
historyFileExtension ()
historyFilter (candidate) Override this if you don't want all lines added to the history. You can return null to not add it at all, or you can transform it.
historyPath () semi-private, do not rely upon yet
isWordSeparatorCharacter (d) Used by the word movement keys (e.g. alt+backspace) to find a word break.
lastLineWasRetained () Returns true if the last line was retained by the user via the F9 or ctrl+enter key which runs it but keeps it in the edit buffer.
lineAsString () Gets the current line buffer as a duplicated string.
loadSettingsAndHistoryFromFile () You may override this to do nothing
replaceLine (line) Replaces the line currently being edited with the given line and positions the cursor inside it.
saveSettingsAndHistoryToFile () You may override this to do nothing. If so, you should also override [appendHistoryToFile] if you ever change [historyCommitMode].
startGettingLine () Starts getting a new line. Call workOnLine and finishGettingLine afterward.
workOnLine (e, rtti) for integrating into another event loop you can pass individual events to this and the line getter will work on it
editLineInEditor (line, cursorPosition) line may have private data packed into the dchar bits if you enabled [enableAutoCloseBrackets]. Use ch & ~PRIVATE_BITS_MASK to get standard dchars.
enableAutoCloseBrackets () Enables automatic closing of brackets like (, {, and [ when the user types. Specifically, you subclass and return a string of the completions you want to do, so for that set, return "()[]{}"
helpMessage ()
showHelp () Called by the default event loop when the user presses F1. Override showHelp to change the UI, override [helpMessage] if you just want to change the message.
showTabCompleteList (list) Override this to provide a custom display of the tab completion list.
syntaxHighlightMatch (line, currentDrawPosition, currentCursorPosition) Subclasses that implement this function can enable syntax highlighting in the line as you edit it.
tabComplete (candidate, afterCursor) Override this to provide tab completion. You may use the candidate argument to filter the list, but you don't have to (LineGetter will do it for you on the values you return). This means you can ignore the arguments if you like.
tabCompleteHelp (candidate) This gives extra information for an item when displaying tab competition details.
tabCompleteStartPoint (candidate, afterCursor) Override this to provide a different tab competition starting point. The default is 0, always completing the complete line, but you may return the index of another character of candidate to provide a new split.

Inner structs

NameDescription
SyntaxHighlightMatch Subclasses that implement this function can enable syntax highlighting in the line as you edit it.

Enums

NameDescription
HistoryCommitMode History is normally only committed to the file when the program is terminating, but if you are losing data due to crashes, you might want to change this to historyCommitMode = HistoryCommitMode.afterEachLine;.
HistoryRecallFilterMethod Set in [historyRecallFilterMethod].