mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-07-31 12:11:52 -07:00
prompt completion: case-sensitivity
Provide a way to perform case-insensitive file / directory completion. We're using compgen to generate completion candidates, and this is case-sensitive by default. We can control this by setting the completion-ignore-case Readline variable prior to invoking compgen. If we're running a Bash with Readline support, this works as expected. Otherwise, it has no effect -- completion candidates are still returned, but compgen generates them in a case-sensitive manner. To avoid breaking changes, the signatures and behavior of existing exported functions are unchanged: - XMonad.Layout.WorkspaceDir.changeDir - XMonad.Prompt.Directory.directoryPrompt - XMonad.Prompt.Shell.getShellCompl New variations of these functions are provided, allowing the caller to specify the desired case-sensitivity via a ComplCaseSensitivity argument: - XMonad.Layout.WorkspaceDir.changeDir' - XMonad.Prompt.Directory.directoryPrompt' - XMonad.Prompt.Shell.getShellCompl' The XMonad.Prompt.Shell exports a couple new functions: - compgenDirectories - compgenFiles We make use of this in XMonad.Prompt.Directory to avoid duplicating the compgen code.
This commit is contained in:
@@ -60,6 +60,7 @@ module XMonad.Prompt
|
||||
, moveHistory, setSuccess, setDone, setModeDone
|
||||
, Direction1D(..)
|
||||
, ComplFunction
|
||||
, ComplCaseSensitivity(..)
|
||||
-- * X Utilities
|
||||
-- $xutils
|
||||
, mkUnmanagedWindow
|
||||
@@ -200,6 +201,8 @@ type ComplFunction = String -> IO [String]
|
||||
type XPMode = XPType
|
||||
data XPOperationMode = XPSingleMode ComplFunction XPType | XPMultipleModes (W.Stack XPType)
|
||||
|
||||
newtype ComplCaseSensitivity = ComplCaseSensitive Bool
|
||||
|
||||
instance Show XPType where
|
||||
show (XPT p) = showXPrompt p
|
||||
|
||||
|
Reference in New Issue
Block a user