From 0c42ef4f1fcaad494a67e384c9f95d281c380848 Mon Sep 17 00:00:00 2001 From: mbays Date: Sat, 4 May 2024 00:00:00 +0000 Subject: [PATCH] Don't interpret escaped terminal backslash in input as edit command --- LineClient.hs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/LineClient.hs b/LineClient.hs index 06b2996..99c82f9 100644 --- a/LineClient.hs +++ b/LineClient.hs @@ -322,11 +322,16 @@ handleCommandLine preprocessQuery = (escapeQuery <$>) . liftIO . maybeEdit where maybeEdit :: String -> IO String - maybeEdit s | lastMay s == Just '\\' = + maybeEdit s | unescapedTerminalBlash s = handle (\e -> printIOErr e >> pure s) . doRestrictedFilter (editInteractively ansi userDataDir) $ init s maybeEdit s = pure s + unescapedTerminalBlash s = case take 2 $ reverse s of + [ '\\' ] -> True + [ '\\', '\\' ] -> False + [ '\\', _ ] -> True + _ -> False expand :: String -> String expand = expandHelp ansi (fst <$> aliases) userDataDir -- 2.11.4.GIT