mirror of
https://github.com/simonmichael/hledger.git
synced 2024-12-26 03:42:25 +03:00
add, web: suggest implied and declared account names also
This commit is contained in:
parent
ddef7d722d
commit
3f124cf123
@ -364,7 +364,7 @@ addform _ vd@VD{..} = [hamlet|
|
||||
defdate = "" :: String -- #322 don't set a default, typeahead(?) clears it on tab. See also hledger.js
|
||||
dates = ["today","yesterday","tomorrow"] :: [String]
|
||||
descriptions = sort $ nub $ map tdescription $ jtxns j
|
||||
accts = sort $ journalAccountNamesUsed j
|
||||
accts = journalAccountNamesDeclaredOrImplied j
|
||||
escapeJSSpecialChars = regexReplaceCI "</script>" "<\\/script>" -- #236
|
||||
listToJsonValueObjArrayStr as = preEscapedString $ escapeJSSpecialChars $ encode $ JSArray $ map (\a -> JSObject $ toJSObject [("value", showJSON a)]) as
|
||||
numpostings = 4
|
||||
|
@ -262,7 +262,7 @@ accountWizard EntryState{..} = do
|
||||
flip evalState esJournal $ runParserT (accountnamep <* eof) "" (T.pack s) -- otherwise, try to parse the input as an accountname
|
||||
where
|
||||
validateAccount :: Text -> Maybe Text
|
||||
validateAccount t | no_new_accounts_ esOpts && not (t `elem` journalAccountNames esJournal) = Nothing
|
||||
validateAccount t | no_new_accounts_ esOpts && not (t `elem` journalAccountNamesDeclaredOrImplied esJournal) = Nothing
|
||||
| otherwise = Just t
|
||||
dbg1 = id -- strace
|
||||
|
||||
@ -337,7 +337,7 @@ descriptionCompleter :: Journal -> String -> CompletionFunc IO
|
||||
descriptionCompleter j = completer (map T.unpack $ journalDescriptions j)
|
||||
|
||||
accountCompleter :: Journal -> String -> CompletionFunc IO
|
||||
accountCompleter j = completer (map T.unpack $ journalAccountNamesUsed j)
|
||||
accountCompleter j = completer (map T.unpack $ journalAccountNamesDeclaredOrImplied j)
|
||||
|
||||
amountCompleter :: String -> CompletionFunc IO
|
||||
amountCompleter = completer []
|
||||
|
Loading…
Reference in New Issue
Block a user