Skip to content

Commit

Permalink
Merge pull request #1403 from fox0430/develop
Browse files Browse the repository at this point in the history
v0.2.8.0
  • Loading branch information
fox0430 authored Jul 27, 2021
2 parents 977d54a + 8dfd202 commit b2c2177
Show file tree
Hide file tree
Showing 21 changed files with 1,903 additions and 183 deletions.
8 changes: 8 additions & 0 deletions documents/configfile.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ enable

Set clipboard tool for Linux (string)
default is xsel

```xsel``` or ```xclip``` or ```wl-clipboard```.

```
toolOnLinux
```
Expand Down Expand Up @@ -1302,6 +1305,11 @@ Syntax highlighting color
gtFunctionName
```

Syntax highlighting color
```
gtTypeName
```

Syntax highlighting color
```
gtBoolean
Expand Down
3 changes: 2 additions & 1 deletion example/moerc.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ smoothScrollSpeed = 15
[Clipboard]
enable = true

toolOnLinux = "xsel"
# toolOnLinux = "xsel"

[BuildOnSave]

Expand Down Expand Up @@ -328,6 +328,7 @@ visualModeBg = "purple_1"
defaultChar = "white"
gtKeyword = "skyBlue1"
gtFunctionName = "gold1"
gtTypeName = "green"
gtBoolean = "yellow"
gtStringLit = "yellow"
gtSpecialVar = "green"
Expand Down
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.7.0"
version = "0.2.8.0"
author = "fox0430"
description = "A command lined based text editor"
license = "GPLv3"
Expand Down
2 changes: 1 addition & 1 deletion src/moe.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import os, times, unicode
import os, times
import moepkg/[ui, editorstatus, normalmode, insertmode, visualmode,
replacemode, filermode, exmode, buffermanager, logviewer,
cmdlineoption, bufferstatus, help, recentfilemode, quickrun,
Expand Down
18 changes: 10 additions & 8 deletions src/moepkg/clipboard.nim
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import unicode, os, osproc
import unicode, os
import independentutils, platform, settings

proc runesToStrings(runes: seq[seq[Rune]]): string =
Expand All @@ -22,13 +22,15 @@ proc sendToClipboard*(buffer: seq[seq[Rune]],

case CURRENT_PLATFORM:
of linux:
## Check if X server is running
let (_, exitCode) = execCmdEx("xset q")
if exitCode == 0:
let cmd = if tool == ClipboardToolOnLinux.xclip:
"xclip -r <<" & "'" & delimiterStr & "'" & "\n" & str & "\n" & delimiterStr & "\n"
else:
"xsel <<" & "'" & delimiterStr & "'" & "\n" & str & "\n" & delimiterStr & "\n"
let cmd = if tool == ClipboardToolOnLinux.xclip:
"xclip -r <<" & "'" & delimiterStr & "'" & "\n" & str & "\n" & delimiterStr & "\n"
elif tool == ClipboardToolOnLinux.xsel:
"xsel <<" & "'" & delimiterStr & "'" & "\n" & str & "\n" & delimiterStr & "\n"
elif tool == ClipboardToolOnLinux.wlClipboard:
"wl-copy <<" & "'" & delimiterStr & "'" & "\n" & str & "\n" & delimiterStr & "\n"
else:
""
if cmd.len > 0:
discard execShellCmd(cmd)
of wsl:
let cmd = "clip.exe <<" & "'" & delimiterStr & "'" & "\n" & str & "\n" & delimiterStr & "\n"
Expand Down
62 changes: 37 additions & 25 deletions src/moepkg/color.nim
Original file line number Diff line number Diff line change
Expand Up @@ -476,6 +476,7 @@ type EditorColor* = object
defaultChar*: Color
gtKeyword*: Color
gtFunctionName*: Color
gtTypeName*: Color
gtBoolean*: Color
gtStringLit*: Color
gtSpecialVar*: Color
Expand Down Expand Up @@ -581,43 +582,44 @@ type EditorColorPair* = enum
defaultChar = 28
keyword = 29
functionName = 30
boolean = 31
specialVar = 32
builtin = 33
stringLit = 34
decNumber = 35
comment = 36
longComment = 37
whitespace = 38
preprocessor = 39
typeName = 31
boolean = 32
specialVar = 33
builtin = 34
stringLit = 35
decNumber = 36
comment = 37
longComment = 38
whitespace = 39
preprocessor = 40

# filer mode
currentFile = 40
file = 41
dir = 42
pcLink = 43
currentFile = 41
file = 42
dir = 43
pcLink = 44
# pop up window
popUpWindow = 44
popUpWinCurrentLine = 45
popUpWindow = 45
popUpWinCurrentLine = 46
# replace text highlighting
replaceText = 46
replaceText = 47
# pair of paren highlighting
parenText = 47
parenText = 48
# highlight other uses current word
currentWord = 48
currentWord = 49
# highlight full width space
highlightFullWidthSpace = 49
highlightFullWidthSpace = 50
# highlight trailing spaces
highlightTrailingSpaces = 50
highlightTrailingSpaces = 51
# highlight reserved words
reservedWord = 51
reservedWord = 52
# highlight history manager
currentHistory = 52
currentHistory = 53
# highlight diff
addedLine = 53
deletedLine = 54
addedLine = 54
deletedLine = 55
# configuration mode
currentSetting = 55
currentSetting = 56

var ColorThemeTable*: array[ColorTheme, EditorColor] = [
config: EditorColor(
Expand Down Expand Up @@ -693,6 +695,7 @@ var ColorThemeTable*: array[ColorTheme, EditorColor] = [
defaultChar: white,
gtKeyword: skyBlue1,
gtFunctionName: gold1,
gtTypeName: green,
gtBoolean: yellow,
gtStringLit: yellow,
gtSpecialVar: green,
Expand Down Expand Up @@ -822,6 +825,7 @@ var ColorThemeTable*: array[ColorTheme, EditorColor] = [
defaultChar: white,
gtKeyword: skyBlue1,
gtFunctionName: gold1,
gtTypeName: green,
gtBoolean: yellow,
gtStringLit: yellow,
gtSpecialVar: green,
Expand Down Expand Up @@ -951,6 +955,7 @@ var ColorThemeTable*: array[ColorTheme, EditorColor] = [
defaultChar: white,
gtKeyword: skyBlue1,
gtFunctionName: gold1,
gtTypeName: green,
gtBoolean: yellow,
gtStringLit: yellow,
gtSpecialVar: green,
Expand Down Expand Up @@ -1080,6 +1085,7 @@ var ColorThemeTable*: array[ColorTheme, EditorColor] = [
defaultChar: gray100,
gtKeyword: seaGreen1_2,
gtFunctionName: gold1,
gtTypeName: green,
gtBoolean: yellow,
gtStringLit: purple_1,
gtSpecialVar: green,
Expand Down Expand Up @@ -1209,6 +1215,7 @@ var ColorThemeTable*: array[ColorTheme, EditorColor] = [
defaultChar: gray100,
gtKeyword: deepPink1_1,
gtFunctionName: gold1,
gtTypeName: green,
gtBoolean: yellow,
gtStringLit: purple_1,
gtSpecialVar: green,
Expand Down Expand Up @@ -1383,6 +1390,9 @@ proc setCursesColor*(editorColor: EditorColor) =
setColorPair(EditorColorPair.functionName,
editorColor.gtFunctionName,
editorColor.editorBg)
setColorPair(EditorColorPair.typeName,
editorColor.gtTypeName,
editorColor.editorBg)
setColorPair(EditorColorPair.boolean,
editorColor.gtBoolean,
editorColor.editorBg)
Expand Down Expand Up @@ -1556,6 +1566,8 @@ proc getColorFromEditorColorPair*(theme: ColorTheme,
return (editorColor.gtKeyword, editorColor.editorBg)
of EditorColorPair.functionName:
return (editorColor.gtFunctionName, editorColor.editorBg)
of EditorColorPair.typeName:
return (editorColor.gtTypeName, editorColor.editorBg)
of EditorColorPair.boolean:
return (editorColor.gtBoolean, editorColor.editorBg)
of EditorColorPair.specialVar:
Expand Down
9 changes: 7 additions & 2 deletions src/moepkg/configmode.nim
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ type themeTableNames {.pure.} = enum
defaultChar
keyword
functionName
typeName
boolean
specialVar
builtin
Expand Down Expand Up @@ -290,7 +291,10 @@ proc getClipboardTableSettingsValues(settings: ClipBoardSettings,
result = @[ru "false", ru "true"]
of "toolOnLinux":
for toolName in ClipboardToolOnLinux:
result.add ($toolName).ru
if $toolName == "wlClipboard":
result.add ru "wl-clipboard"
else:
result.add ($toolName).ru
else:
return

Expand Down Expand Up @@ -722,7 +726,8 @@ proc changeClipBoardTableSettings(settings: var ClipBoardSettings,
of "enable":
settings.enable = parseBool(settingVal)
of "toolOnLinux":
settings.toolOnLinux = parseEnum[ClipboardToolOnLinux](settingVal)
let name = if settingVal == "wl-clipboard": "wlClipboard" else: settingVal
settings.toolOnLinux = parseEnum[ClipboardToolOnLinux](name)
else:
discard

Expand Down
Loading

0 comments on commit b2c2177

Please sign in to comment.