glirc- Console IRC client
Copyright(c) Eric Mertens 2016
Safe HaskellNone



This module provides the tab-completion logic used for nicknames and channels.



class (IsString a, Ord a) => Prefix a where Source #

Class for types that are isomorphic to String and which can support a total order and a prefix predicate.

toString (fromString x) == x
fromString (toString x) == x
isPrefix x y ==> x <= y


isPrefix :: a -> a -> Bool Source #

Check if the first argument is a lexicographic prefix of the second.

toString :: a -> String Source #

Convert to a String.

wordComplete Source #


:: Prefix a 
=> (Char -> Bool)

valid character predicate

-> WordCompletionMode

leading update operation

-> Bool


-> [a]

priority completions

-> [a]

possible completions

-> EditBox 
-> Maybe EditBox 

Perform word completion on a text box.

The leading update operation is applied to the result of tab-completion when tab completing from the beginning of the text box. This is useful when auto-completing a nick and including a trailing colon.

The reversed parameter indicates that tab-completion should return the previous entry. When starting a fresh tab completion the priority completions will be considered in order before resorting to the set of possible completions.

Word completion modes

plainWordCompleteMode :: WordCompletionMode Source #

Word completion without adding any prefix or suffix

defaultNickWordCompleteMode :: WordCompletionMode Source #

Word completion adding a ": " suffix at the beginning of lines

slackNickWordCompleteMode :: WordCompletionMode Source #

Word completion using a "@" prefix intended