merged #53 manually; todoapp must ignore empty input lines

This commit is contained in:
Araq 2018-12-12 12:34:35 +01:00
commit a90efe752d
2 changed files with 5 additions and 2 deletions

View file

@ -41,8 +41,9 @@ proc updateEntry(pos: int, content: cstring, completed: bool) =
markAsCompleted(pos, completed)
proc onTodoEnter(ev: Event; n: VNode) =
addEntry(n.value, false)
n.value = ""
if n.value.strip() != "":
addEntry(n.value, false)
n.value = ""
proc removeHandler(ev: Event; n: VNode) =
updateEntry(n.index, cstring(nil), false)

View file

@ -4,6 +4,8 @@ proc split*(s, sep: cstring): seq[cstring] {.importcpp, nodecl.}
proc split*(s, sep: cstring; max: int): seq[cstring] {.importcpp, nodecl.}
proc strip*(s: cstring): cstring {.importcpp: "#.trim()", nodecl.}
proc startsWith*(a, b: cstring): bool {.importcpp: "startsWith", nodecl.}
proc contains*(a, b: cstring): bool {.importcpp: "(#.indexOf(#)>=0)", nodecl.}