Skip to content

Commit

Permalink
refactor: removed db parameter from deleteChar procedure
Browse files Browse the repository at this point in the history
FossilOrigin-Name: 2efa35613744308b5cce26d3bb1a5ca9fd007daa02fe4206af91ef3089d4b63c
  • Loading branch information
thindil committed Jan 19, 2024
1 parent 771a533 commit 14b4137
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/input.nim
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,12 @@ proc readChar*(inputChar: char; db): string {.sideEffect, raises: [], tags: [
e = getCurrentException(), db = db)

proc deleteChar*(inputString: var UserInput;
cursorPosition: var Natural; db) {.sideEffect, raises: [], tags: [WriteIOEffect,
cursorPosition: var Natural) {.sideEffect, raises: [], tags: [WriteIOEffect,
RootEffect], contractual.} =
## Delete the Unicode character at the selected position from the user's input
##
## * inputString - the string of characters entered by the user
## * cursorPosition - the position of the cursor in the string
## * db - the connection to the shell's database
##
## Returns modified inputString and the new cursor position as cursorPosition
body:
Expand Down Expand Up @@ -187,7 +186,7 @@ proc readInput*(maxLength: MaxInputLength = maxInputLength;
stdout.write(s = repeat(c = ' ', count = runeLen(s = $resultString)))
stdout.cursorBackward(count = runeLen(s = $resultString))
deleteChar(inputString = resultString,
cursorPosition = cursorPosition, db = db)
cursorPosition = cursorPosition)
stdout.write(s = $resultString)
if cursorPosition < runeLen(s = $resultString):
stdout.cursorBackward(count = runeLen(s = $resultString) - cursorPosition)
Expand Down Expand Up @@ -219,7 +218,7 @@ proc readInput*(maxLength: MaxInputLength = maxInputLength;
stdout.cursorBackward(count = runeLen(s = $resultString))
cursorPosition.inc
deleteChar(inputString = resultString,
cursorPosition = cursorPosition, db = db)
cursorPosition = cursorPosition)
stdout.write(s = $resultString)
if cursorPosition < runeLen(s = $resultString):
stdout.cursorBackward(count = runeLen(s = $resultString) - cursorPosition)
Expand Down

0 comments on commit 14b4137

Please sign in to comment.