aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2021-12-17 18:38:32 +0100
committerbptato <nincsnevem662@gmail.com>2021-12-17 18:44:44 +0100
commitef4604ba8f494a2997a744a0b04732dc686c46ea (patch)
tree77a67abb1bc31a5ad86966729ba56bb307083827 /src
parentd430a83ab3e971b816581839fbdf860a293242e8 (diff)
downloadchawan-ef4604ba8f494a2997a744a0b04732dc686c46ea.tar.gz
More code formatting consistency
Diffstat (limited to 'src')
-rw-r--r--src/config/config.nim2
-rw-r--r--src/css/style.nim2
-rw-r--r--src/html/dom.nim2
-rw-r--r--src/html/parser.nim2
-rw-r--r--src/io/buffer.nim4
-rw-r--r--src/io/cell.nim16
-rw-r--r--src/io/lineedit.nim2
-rw-r--r--src/io/pipe.nim0
-rw-r--r--src/layout/engine.nim6
-rw-r--r--src/types/color.nim2
-rw-r--r--src/utils/twtstr.nim5
11 files changed, 21 insertions, 22 deletions
diff --git a/src/config/config.nim b/src/config/config.nim
index 3602476b..68ddd353 100644
--- a/src/config/config.nim
+++ b/src/config/config.nim
@@ -109,7 +109,7 @@ func getLineAction(s: string): TwtAction =
return NO_ACTION
return parseEnum[TwtAction]("ACTION_LINED_" & s)
-proc readUserStylesheet(dir: string, file: string): string =
+proc readUserStylesheet(dir, file: string): string =
if file.len == 0:
return ""
if file[0] == '~' or file[0] == '/':
diff --git a/src/css/style.nim b/src/css/style.nim
index 5ec7f182..c8e759e7 100644
--- a/src/css/style.nim
+++ b/src/css/style.nim
@@ -360,7 +360,7 @@ proc applyAuthorRules*(document: Document): ApplyResult =
if rules_local.len > 0:
discard embedded_rules.pop()
-proc applyStylesheets*(document: Document, uass: ParsedStylesheet, userss: ParsedStylesheet) =
+proc applyStylesheets*(document: Document, uass, userss: ParsedStylesheet) =
let ua = document.applyRules(uass, true)
let user = document.applyRules(userss)
let author = document.applyAuthorRules()
diff --git a/src/html/dom.nim b/src/html/dom.nim
index 7cb49f0e..3de1847c 100644
--- a/src/html/dom.nim
+++ b/src/html/dom.nim
@@ -290,7 +290,7 @@ func newDocument*(): Document =
result.body = newHtmlElement(TAG_BODY)
result.nodeType = DOCUMENT_NODE
-func newAttr*(parent: Element, key: string, value: string): Attr =
+func newAttr*(parent: Element, key, value: string): Attr =
new(result)
result.nodeType = ATTRIBUTE_NODE
result.ownerElement = parent
diff --git a/src/html/parser.nim b/src/html/parser.nim
index 74ec68b7..153df1c5 100644
--- a/src/html/parser.nim
+++ b/src/html/parser.nim
@@ -165,7 +165,7 @@ proc parse_tag(buf: string, at: var int): DOMParsedTag =
inc at
return tag
-proc insertNode(parent: Node, node: Node) =
+proc insertNode(parent, node: Node) =
parent.childNodes.add(node)
if parent.childNodes.len > 1:
diff --git a/src/io/buffer.nim b/src/io/buffer.nim
index 23c5b027..4f1f4960 100644
--- a/src/io/buffer.nim
+++ b/src/io/buffer.nim
@@ -165,7 +165,7 @@ func acursorx(buffer: Buffer): int =
func acursory(buffer: Buffer): int =
return buffer.cursory - buffer.fromy
-func cellOrigin(buffer: Buffer, x: int, y: int): int =
+func cellOrigin(buffer: Buffer, x, y: int): int =
let row = y * buffer.width
var ox = x
while buffer.display[row + ox].runes.len == 0 and ox > 0:
@@ -292,7 +292,7 @@ proc scrollTo*(buffer: Buffer, y: int) =
buffer.redraw = true
buffer.restoreCursorX()
-proc cursorTo*(buffer: Buffer, x: int, y: int) =
+proc cursorTo*(buffer: Buffer, x, y: int) =
buffer.redraw = false
buffer.cursory = min(max(y, 0), buffer.numLines - 1)
if buffer.fromy > buffer.cursory:
diff --git a/src/io/cell.nim b/src/io/cell.nim
index d4e67196..5bdbfb50 100644
--- a/src/io/cell.nim
+++ b/src/io/cell.nim
@@ -156,7 +156,7 @@ proc addLine*(grid: var FlexibleGrid) =
proc addFormat*(grid: var FlexibleGrid, y: int, format: Formatting) =
grid[y].formats.add(FormattingCell(formatting: format, pos: grid[y].len))
-proc addFormat*(grid: var FlexibleGrid, y: int, pos: int, format: Formatting, nodes: seq[Node]) =
+proc addFormat*(grid: var FlexibleGrid, y, pos: int, format: Formatting, nodes: seq[Node]) =
grid[y].formats.add(FormattingCell(formatting: format, nodes: nodes, pos: pos))
proc addCell*(grid: var FlexibleGrid, y: int, r: Rune) =
@@ -213,19 +213,19 @@ proc parseAnsiCode*(formatting: var Formatting, buf: string, fi: int): int =
of 0:
formatting = newFormatting()
of 1:
- formatting.bold = true
+ formatting.bold_on
of 3:
formatting.italic_on
of 4:
- formatting.underline = true
+ formatting.underline_on
of 9:
- formatting.strike = true
+ formatting.strike_on
of 22:
- formatting.bold = false
+ formatting.bold_off
of 23:
formatting.italic_off
of 29:
- formatting.strike = false
+ formatting.strike_off
of 30..37:
formatting.fgcolor = CellColor(rgb: false, color: uint8(ip[pi]))
of 38:
@@ -271,9 +271,9 @@ proc parseAnsiCode*(formatting: var Formatting, buf: string, fi: int): int =
of 49:
formatting.bgcolor = defaultColor
of 53:
- formatting.overline = true
+ formatting.overline_on
of 55:
- formatting.overline = false
+ formatting.overline_off
else: discard
inc pi
except ValueError: discard
diff --git a/src/io/lineedit.nim b/src/io/lineedit.nim
index 1b1a80d4..ab9a1feb 100644
--- a/src/io/lineedit.nim
+++ b/src/io/lineedit.nim
@@ -97,7 +97,7 @@ proc insertCharseq(state: var LineState, cs: var seq[Rune]) =
state.cursor += cs.len
state.fullRedraw()
-proc readLine*(current: var string, minlen: int, maxlen: int): bool =
+proc readLine*(current: var string, minlen, maxlen: int): bool =
var state: LineState
state.news = current.toRunes()
state.cursor = state.news.len
diff --git a/src/io/pipe.nim b/src/io/pipe.nim
deleted file mode 100644
index e69de29b..00000000
--- a/src/io/pipe.nim
+++ /dev/null
diff --git a/src/layout/engine.nim b/src/layout/engine.nim
index 6568c400..1e9fc94a 100644
--- a/src/layout/engine.nim
+++ b/src/layout/engine.nim
@@ -340,7 +340,7 @@ proc applyBlockEnd(state: var LayoutState, parent, box: CSSBox) =
else:
parent.icontext.fromy += box.bcontext.height.get
-proc addBlock(state: var LayoutState, parent: CSSBox, box: CSSBox) =
+proc addBlock(state: var LayoutState, parent, box: CSSBox) =
parent.icontext.fromx = parent.x
if box.icontext.conty:
box.flushConty()
@@ -348,13 +348,13 @@ proc addBlock(state: var LayoutState, parent: CSSBox, box: CSSBox) =
state.applyBlockEnd(parent, box)
parent.children.add(box)
-proc addInline(state: var LayoutState, parent: CSSBox, box: CSSBox) =
+proc addInline(state: var LayoutState, parent, box: CSSBox) =
parent.icontext.fromx += box.cssvalues[PROPERTY_MARGIN_RIGHT].length.cells_w(state, parent.bcontext.width)
parent.icontext.fromy = box.icontext.fromy
parent.children.add(box)
-proc addInlineBlock(state: var LayoutState, parent: CSSBox, box: CSSBox) =
+proc addInlineBlock(state: var LayoutState, parent, box: CSSBox) =
parent.icontext.fromx = box.icontext.fromx
parent.icontext.fromx += box.cssvalues[PROPERTY_MARGIN_RIGHT].length.cells_w(state, parent.bcontext.width)
parent.icontext.conty = box.icontext.conty
diff --git a/src/types/color.nim b/src/types/color.nim
index ca04a0e7..2690d35d 100644
--- a/src/types/color.nim
+++ b/src/types/color.nim
@@ -10,7 +10,7 @@ type
of false:
color*: uint8
-func `==`*(color1: CellColor, color2: CellColor): bool =
+func `==`*(color1, color2: CellColor): bool =
if color1.rgb != color2.rgb:
return false
if color1.rgb:
diff --git a/src/utils/twtstr.nim b/src/utils/twtstr.nim
index ef81edc4..2ec9967c 100644
--- a/src/utils/twtstr.nim
+++ b/src/utils/twtstr.nim
@@ -168,7 +168,7 @@ func isAlphaAscii*(r: Rune): bool =
func isDigitAscii*(r: Rune): bool =
return int(r) < 256 and isDigit(char(r))
-func substr*(s: seq[Rune], i: int, j: int): seq[Rune] =
+func substr*(s: seq[Rune], i, j: int): seq[Rune] =
if s.len == 0:
return @[]
return s[min(high(s), i)..min(high(s), j - 1)]
@@ -188,7 +188,6 @@ func number_additive*(i: int, range: HSlice[int, int], symbols: openarray[(int,
return $i
var n = i
- let o = n
var at = 0
while n > 0:
if n >= symbols[at][0]:
@@ -575,7 +574,7 @@ func width*(s: seq[Rune]): int =
for r in s:
result += width(r)
-func width*(s: seq[Rune], min: int, max: int): int =
+func width*(s: seq[Rune], min, max: int): int =
var i = min
var mi = min(max, s.len)
while i < mi: