Codestyle fixes

This commit is contained in:
Roman Vishnevskii 2017-04-22 13:29:24 +07:00
commit 459d696128

View file

@ -8,7 +8,7 @@ type
var var
selectedEntry = -1 selectedEntry = -1
filter: Filter filter: Filter
entriesSize: int entriesLen: int
proc getItem(key : cstring ): cstring {.importc: "localStorage.getItem"} proc getItem(key : cstring ): cstring {.importc: "localStorage.getItem"}
proc setItem(key, value : cstring ) {.importc: "localStorage.setItem"} proc setItem(key, value : cstring ) {.importc: "localStorage.setItem"}
@ -33,9 +33,9 @@ proc setEntryBool(pos : int, value : bool) =
setItem(cstring($pos & "bool"), val) setItem(cstring($pos & "bool"), val)
proc addEntry(str: cstring, bval : bool) = proc addEntry(str: cstring, bval : bool) =
setEntryCstring(entriesSize, str) setEntryCstring(entriesLen, str)
setEntryBool(entriesSize, bval) setEntryBool(entriesLen, bval)
inc entriesSize inc entriesLen
proc setEntry(pos: int, str: cstring, bval: bool) = proc setEntry(pos: int, str: cstring, bval: bool) =
setEntryCstring(pos, str) setEntryCstring(pos, str)
@ -66,7 +66,7 @@ proc onAllDone(ev: Event; n: VNode) =
selectedEntry = -1 selectedEntry = -1
proc clearCompleted(ev: Event, n: VNode) = proc clearCompleted(ev: Event, n: VNode) =
for i in 0..<entriesSize: for i in 0..<entriesLen:
if getEntryBool(i): setEntryCstring(i, nil) if getEntryBool(i): setEntryCstring(i, nil)
proc toClass(completed: bool): cstring = proc toClass(completed: bool): cstring =
@ -131,7 +131,7 @@ proc createDom(): VNode =
var completedCount = 0 var completedCount = 0
ul(class = "todo-list"): ul(class = "todo-list"):
#for i, d in pairs(entries): #for i, d in pairs(entries):
for i in 0..entriesSize-1: for i in 0..entriesLen-1:
var d0 = getEntryCstring(i) var d0 = getEntryCstring(i)
var d1 = getEntryBool(i) var d1 = getEntryBool(i)
@ -151,5 +151,5 @@ setOnHashChange(proc(hash: cstring) =
elif hash == "#/completed": filter = completed elif hash == "#/completed": filter = completed
elif hash == "#/active": filter = active elif hash == "#/active": filter = active
) )
entriesSize = 0 entriesLen = 0
setRenderer createDom setRenderer createDom