Skip to content

Commit

Permalink
Merge pull request #1231 from fox0430/hotfix
Browse files Browse the repository at this point in the history
v0.2.4.1
  • Loading branch information
fox0430 authored Jan 12, 2021
2 parents 5f1a927 + db5f586 commit eb8827a
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 24 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/actions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,8 @@ jobs:

- name: Run integtation test
run: shpec ./shpec.sh

- name: Build on Nim devel
run: |
choosenim -y devel
nimble build
2 changes: 1 addition & 1 deletion moe.nimble
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Package

version = "0.2.4"
version = "0.2.4.1"
author = "fox0430"
description = "A command lined based text editor"
license = "GPLv3"
Expand Down
2 changes: 1 addition & 1 deletion shpec.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ describe "moe is an editor"
describe "invocation options"

it "can display it's version"
assert equal `moe -v | grep -oPq "^moe v\d+\.\d+\.\d+$";echo $?` 0
assert equal `moe -v | grep -oPq "^moe v\d+\.\d+\.\d+\.\d+$";echo $?` 0
end

it "can display command line options"
Expand Down
42 changes: 22 additions & 20 deletions src/moepkg/configmode.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1653,6 +1653,26 @@ proc initConfigModeBuffer*(settings: EditorSettings): GapBuffer[seq[Rune]] =

result = initGapBuffer(buffer)

proc keyUp(bufStatus: BufferStatus, windowNode: var WindowNode) =
let currentLine = windowNode.currentLine
if currentLine > 1:
bufStatus.keyUp(windowNode)

# Skip empty line and table name line
while bufStatus.buffer[windowNode.currentLine].len == 0 or
bufStatus.buffer[windowNode.currentLine][0] != ' ':
bufStatus.keyUp(windowNode)

proc keyDown(bufStatus: BufferStatus, windowNode: var WindowNode) =
let currentLine = windowNode.currentLine
if currentLine < bufStatus.buffer.high - 1:
bufStatus.keyDown(windowNode)

# Skip empty line and table name line
while bufStatus.buffer[windowNode.currentLine].len == 0 or
bufStatus.buffer[windowNode.currentLine][0] != ' ':
bufStatus.keyDown(windowNode)

proc isConfigMode(mode: Mode): bool {.inline.} =
mode == Mode.config

Expand All @@ -1666,24 +1686,6 @@ proc configMode*(status: var Editorstatus) =
currentBufferIndex = currentMainWindowNode.bufferIndex
currentWorkSpace = status.currentWorkSpaceIndex

template keyUp() =
if currentLine > 1:
currentBufStatus.keyUp(windowNode)

# Skip empty line and table name line
while currentBufStatus.buffer[windowNode.currentLine].len == 0 or
currentBufStatus.buffer[windowNode.currentLine][0] != ' ':
currentBufStatus.keyUp(windowNode)

template keyDown() =
if currentLine < currentBufStatus.buffer.high - 1:
currentBufStatus.keyDown(windowNode)

# Skip empty line and table name line
while currentBufStatus.buffer[windowNode.currentLine].len == 0 or
currentBufStatus.buffer[windowNode.currentLine][0] != ' ':
currentBufStatus.keyDown(windowNode)

while isConfigMode(currentBufStatus.mode) and
currentWorkSpace == status.currentWorkSpaceIndex and
currentBufferIndex == status.bufferIndexInCurrentWindow:
Expand Down Expand Up @@ -1732,9 +1734,9 @@ proc configMode*(status: var Editorstatus) =
elif isPageDownKey(key): ## Page down and Ctrl - F
status.pageDown
elif key == ord('k') or isUpKey(key):
keyUp()
currentBufStatus.keyUp(currentMainWindowNode)
elif key == ord('j') or isDownKey(key):
keyDown()
currentBufStatus.keyDown(currentMainWindowNode)
elif key == ord('g'):
let secondKey = getKey(currentMainWindowNode)
if secondKey == 'g': status.moveToFirstLine
Expand Down
5 changes: 3 additions & 2 deletions tests/tconfigmode.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1325,7 +1325,8 @@ suite "Config mode: Get Theme table setting values":
let testTitle = "Get " & $`colorPair` & "." & $`position` & " values"
test testTitle:
let
(fg, bg) = getColorFromEditorColorPair(theme, `colorPair`)
theme = settings.editorColorTheme
(fg, bg) = theme.getColorFromEditorColorPair(`colorPair`)
values = settings.getThemeTableSettingValues($`colorPair`, $`position`)
# values[0] should be current setting
default = $values[0]
Expand All @@ -1345,11 +1346,11 @@ suite "Config mode: Get Theme table setting values":
let
status = initEditorStatus()
settings = status.settings
theme = settings.editorColorTheme

# Check Theme.editorBg
test "Get editorBg.background values":
let
theme = settings.editorColorTheme
bg = ColorThemeTable[theme].editorBg
values = settings.getThemeTableSettingValues("editorBg", "background")
# values[0] should be current setting
Expand Down

0 comments on commit eb8827a

Please sign in to comment.