From c6d04220be7ec95bc4ccd23541284b5a68cc28da Mon Sep 17 00:00:00 2001 From: Ryan Westlund Date: Fri, 14 Aug 2020 16:56:55 -0400 Subject: [PATCH 1/7] Highlight static as keyword in Javascript files (#1824) --- runtime/syntax/javascript.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/syntax/javascript.yaml b/runtime/syntax/javascript.yaml index 3883bb0e..467f3820 100644 --- a/runtime/syntax/javascript.yaml +++ b/runtime/syntax/javascript.yaml @@ -20,7 +20,7 @@ rules: - statement: "\\b(async|await|break|case|catch|const|continue|debugger|default)\\b" - statement: "\\b(delete|do|else|export|finally|for|function\\*?|class|extends)\\b" - statement: "\\b(get|if|import|from|in|of|instanceof|let|new|reject|resolve|return)\\b" - - statement: "\\b(set|super|switch|this|throw|try|typeof|var|void|while|with|yield)\\b" + - statement: "\\b(set|static|super|switch|this|throw|try|typeof|var|void|while|with|yield)\\b" # reserved but unassigned - error: "\\b(enum|implements|interface|package|private|protected|public)" - constant: "\\b(globalThis|Infinity|null|undefined|NaN)\\b" From 3ba03cca150120e52948ed16f3485af2fe8f2ca8 Mon Sep 17 00:00:00 2001 From: Bartek Pacia Date: Mon, 17 Aug 2020 19:04:44 +0200 Subject: [PATCH 2/7] fix spelling (#1828) --- runtime/help/keybindings.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/runtime/help/keybindings.md b/runtime/help/keybindings.md index 8daa387b..ac39c47b 100644 --- a/runtime/help/keybindings.md +++ b/runtime/help/keybindings.md @@ -4,7 +4,7 @@ Micro has a plethora of hotkeys that make it easy and powerful to use and all hotkeys are fully customizable to your liking. Custom keybindings are stored internally in micro if changed with the `> bind` -command or you can also be added in the file `~/.config/micro/bindings.json` as +command or can also be added in the file `~/.config/micro/bindings.json` as discussed below. For a list of the default keybindings in the json format used by micro, please see the end of this file. For a more user-friendly list with explanations of what the default hotkeys are and what they do, please see From c7e72220ddbda134dc0b248c8670a6ab5fa69af7 Mon Sep 17 00:00:00 2001 From: Dmitry Maluka Date: Sun, 23 Aug 2020 21:45:43 +0200 Subject: [PATCH 3/7] Add scrollbar color group (#1840) Ref #1837 --- internal/display/bufwindow.go | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/internal/display/bufwindow.go b/internal/display/bufwindow.go index 9c61140d..5eaec35d 100644 --- a/internal/display/bufwindow.go +++ b/internal/display/bufwindow.go @@ -736,8 +736,14 @@ func (w *BufWindow) displayScrollBar() { barsize = 1 } barstart := w.Y + int(float64(w.StartLine)/float64(w.Buf.LinesNum())*float64(w.Height)) + + scrollBarStyle := config.DefStyle.Reverse(true) + if style, ok := config.Colorscheme["scrollbar"]; ok { + scrollBarStyle = style + } + for y := barstart; y < util.Min(barstart+barsize, w.Y+bufHeight); y++ { - screen.SetContent(scrollX, y, '|', nil, config.DefStyle.Reverse(true)) + screen.SetContent(scrollX, y, '|', nil, scrollBarStyle) } } } From 11291e1406613afe52ee9d5b24de973c14320723 Mon Sep 17 00:00:00 2001 From: "Peder B. Sundt" Date: Sun, 23 Aug 2020 21:46:05 +0200 Subject: [PATCH 4/7] Minor tweak to the railscast color scheme (#1834) * Railscast: Change the color of operators to match keywords instead of identifiers * Railscast: Add a color for `constant.specialChar` --- runtime/colorschemes/railscast.micro | 3 +++ 1 file changed, 3 insertions(+) diff --git a/runtime/colorschemes/railscast.micro b/runtime/colorschemes/railscast.micro index 2cf4aff6..5aaa25da 100644 --- a/runtime/colorschemes/railscast.micro +++ b/runtime/colorschemes/railscast.micro @@ -3,6 +3,7 @@ color-link comment "#bc9458,#2b2b2b" color-link statement "#cc7833,#2b2b2b" color-link constant "#a5c261,#2b2b2b" color-link constant.bool "#6d9cbe,#2b2b2b" +color-link constant.specialChar "#459231,#2b2b2b" color-link type "#6d9cbe,#2b2b2b" color-link preproc "#cc7833,#2b2b2b" color-link special "#cc7833,#2b2b2b" @@ -18,6 +19,8 @@ color-link diff-modified "#FFAF00" color-link diff-deleted "#D70000" color-link gutter-warning "#a5c261,#11151C" color-link symbol "#edb753,#2b2b2b" +color-link symbol.operator "#cc7833,#2b2b2b" +color-link symbol.brackets "#cc7833,#2b2b2b" color-link identifier "#edb753,#2b2b2b" color-link statusline "#b1b1b1,#232323" color-link tabbar "bold #b1b1b1,#232323" From 5bee7272e949dd236a7ba313669910aa4283aa59 Mon Sep 17 00:00:00 2001 From: "Peder B. Sundt" Date: Sun, 23 Aug 2020 21:46:27 +0200 Subject: [PATCH 5/7] Add improvements to the python3 syntax definitions (#1833) * Python3: Add built-in object 'cls' * Python3: Add the bitwise negation operator ~ * Python3: Add support for hexadeximal and binary numerical literals * Python3: Rewrite '(__foo__|__bar__)' as '__(foo|bar)__', add known '__i.*__' methods * Python3: Add __iter__ as a magic method, sort the list of magic methods * Python3: Numerical literals: Add support for '_', disallow leading 0 for decimals * fixup! Python3: Numerical literals: Add support for '_', disallow leading 0 for decimals hex oct and bin have different sets of allowed digits * Python3: Add support for floating point numbers with optional scientific notation * Python3: stop single-line strings at EOL * Python3: Add support for TODO and FIXME in comments * Python3: Add support for the ^ bitwise xor operator --- runtime/syntax/python3.yaml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/runtime/syntax/python3.yaml b/runtime/syntax/python3.yaml index a3af2abb..0afcd051 100644 --- a/runtime/syntax/python3.yaml +++ b/runtime/syntax/python3.yaml @@ -6,13 +6,13 @@ detect: rules: # built-in objects - - constant: "\\b(Ellipsis|None|self|True|False)\\b" + - constant: "\\b(Ellipsis|None|self|cls|True|False)\\b" # built-in attributes - constant: "\\b(__bases__|__builtin__|__class__|__debug__|__dict__|__doc__|__file__|__members__|__methods__|__name__|__self__)\\b" # built-in functions - identifier: "\\b(abs|all|any|ascii|bin|bool|breakpoint|bytearray|bytes|callable|chr|classmethod|compile|complex|delattr|dir|divmod|eval|exec|format|getattr|globals|hasattr|hash|help|hex|id|input|isinstance|issubclass|iter|len|locals|max|min|next|nonlocal|oct|open|ord|pow|print|repr|round|setattr|sorted|sum|vars|__import__)\\b" # special method names - - identifier: "\\b(__abs__|__add__|__and__|__call__|__cmp__|__coerce__|__complex__|__concat__|__contains__|__del__|__delattr__|__delitem__|__delslice__|__div__|__divmod__|__float__|__getattr__|__getitem__|__getslice__|__hash__|__hex__|__init__|__int__|__inv__|__invert__|__len__|__dict__|__long__|__lshift__|__mod__|__mul__|__neg__|__next__|__nonzero__|__oct__|__or__|__pos__|__pow__|__radd__|__rand__|__rcmp__|__rdiv__|__rdivmod__|__repeat__|__repr__|__rlshift__|__rmod__|__rmul__|__ror__|__rpow__|__rrshift__|__rshift__|__rsub__|__rxor__|__setattr__|__setitem__|__setslice__|__str__|__sub__|__xor__)\\b" + - identifier: "\\b__(abs|add|and|call|cmp|coerce|complex|concat|contains|delattr|delitem|delslice|del|dict|divmod|div|float|getattr|getitem|getslice|hash|hex|iadd|iand|iconcat|ifloordiv|ilshift|imatmul|imod|imul|init|int|invert|inv|ior|ipow|irshift|isub|iter|itruediv|ixor|len|long|lshift|mod|mul|neg|next|nonzero|oct|or|pos|pow|radd|rand|rcmp|rdivmod|rdiv|repeat|repr|rlshift|rmod|rmul|ror|rpow|rrshift|rshift|rsub|rxor|setattr|setitem|setslice|str|sub|xor)__\\b" # types - type: "\\b(bool|bytearray|bytes|classmethod|complex|dict|enumerate|filter|float|frozenset|int|list|map|memoryview|object|property|range|reversed|set|slice|staticmethod|str|super|tuple|type|zip)\\b" # definitions @@ -22,11 +22,14 @@ rules: # decorators - brightgreen: "@.*[(]" # operators - - symbol.operator: "([.:;,+*|=!\\%@]|<|>|/|-|&)" + - symbol.operator: "([~^.:;,+*|=!\\%@]|<|>|/|-|&)" # parentheses - symbol.brackets: "([(){}]|\\[|\\])" # numbers - - constant.number: "\\b[0-9]+\\b" + - constant.number: "\\b[1-9](_?[0-9])*(\\.([0-9](_?[0-9])*)?)?(e[0-9](_?[0-9])*)?\\b" # decimal + - constant.number: "\\b0b(_?[01])+\\b" # bin + - constant.number: "\\b0o(_?[0-7])+\\b" # oct + - constant.number: "\\b0x(_?[0-9a-f])+\\b" # hex - constant.string: start: "\"\"\"" @@ -40,14 +43,14 @@ rules: - constant.string: start: "\"" - end: "\"" + end: "(\"|$)" skip: "\\\\." rules: - constant.specialChar: "\\\\." - constant.string: start: "'" - end: "'" + end: "('|$)" skip: "\\\\." rules: - constant.specialChar: "\\\\." @@ -55,5 +58,5 @@ rules: - comment: start: "#" end: "$" - rules: [] - + rules: + - todo: "(TODO|FIXME):?" From c9b0451a33bb996b6b7e6610e84f5c105e0913ed Mon Sep 17 00:00:00 2001 From: Dmitry Maluka Date: Sun, 23 Aug 2020 21:47:14 +0200 Subject: [PATCH 6/7] AddToHistory function for plugins (#1830) Add InfoBuf's method AddToHistory function which adds a new item to the history for the prompt type `ptype`. This function is not used by micro itself. It is useful for plugins which add their own items to the history, bypassing the infobar command line. --- internal/info/history.go | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/internal/info/history.go b/internal/info/history.go index 03391b74..193185ca 100644 --- a/internal/info/history.go +++ b/internal/info/history.go @@ -61,6 +61,30 @@ func (i *InfoBuf) SaveHistory() { } } +// AddToHistory adds a new item to the history for the prompt type `ptype`. +// This function is not used by micro itself. It is useful for plugins +// which add their own items to the history, bypassing the infobar command line. +func (i *InfoBuf) AddToHistory(ptype string, item string) { + if i.HasPrompt && i.PromptType == ptype { + return + } + + if _, ok := i.History[ptype]; !ok { + i.History[ptype] = []string{item} + } else { + i.History[ptype] = append(i.History[ptype], item) + + // avoid duplicates + h := i.History[ptype] + for j := len(h) - 2; j >= 0; j-- { + if h[j] == h[len(h)-1] { + i.History[ptype] = append(h[:j], h[j+1:]...) + break + } + } + } +} + // UpHistory fetches the previous item in the history func (i *InfoBuf) UpHistory(history []string) { if i.HistoryNum > 0 && i.HasPrompt && !i.HasYN { From c9e49fa1a4875b4c1c9bea1b1066f133fbb357fc Mon Sep 17 00:00:00 2001 From: Zachary Yedidia Date: Tue, 25 Aug 2020 15:21:18 -0400 Subject: [PATCH 7/7] Update tcell --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 9d54b1d6..3a963294 100644 --- a/go.mod +++ b/go.mod @@ -17,7 +17,7 @@ require ( github.com/zyedidia/highlight v0.0.0-20170330143449-201131ce5cf5 github.com/zyedidia/json5 v0.0.0-20200102012142-2da050b1a98d github.com/zyedidia/pty v2.0.0+incompatible // indirect - github.com/zyedidia/tcell v1.4.10 + github.com/zyedidia/tcell v1.4.12 github.com/zyedidia/terminal v0.0.0-20180726154117-533c623e2415 golang.org/x/text v0.3.2 gopkg.in/sourcemap.v1 v1.0.5 // indirect diff --git a/go.sum b/go.sum index 30240649..aa2f7752 100644 --- a/go.sum +++ b/go.sum @@ -52,8 +52,8 @@ github.com/zyedidia/poller v1.0.1 h1:Tt9S3AxAjXwWGNiC2TUdRJkQDZSzCBNVQ4xXiQ7440s github.com/zyedidia/poller v1.0.1/go.mod h1:vZXJOHGDcuK08GXhF6IAY0ZFd2WcgOR5DOTp84Uk5eE= github.com/zyedidia/pty v2.0.0+incompatible h1:Ou5vXL6tvjst+RV8sUFISbuKDnUJPhnpygApMFGweqw= github.com/zyedidia/pty v2.0.0+incompatible/go.mod h1:4y9l9yJZNxRa7GB/fB+mmDmGkG3CqmzLf4vUxGGotEA= -github.com/zyedidia/tcell v1.4.10 h1:40iES9kNgiaTvp/wLTB4Elikx4uDPIPdV5fhI2EQiog= -github.com/zyedidia/tcell v1.4.10/go.mod h1:HhlbMSCcGX15rFDB+Q1Lk3pKEOocsCUAQC3zhZ9sadA= +github.com/zyedidia/tcell v1.4.12 h1:PwsWfTKDvgSsMKL8QfFqxrD2qxZk6apxxKOJwjhLbxs= +github.com/zyedidia/tcell v1.4.12/go.mod h1:HhlbMSCcGX15rFDB+Q1Lk3pKEOocsCUAQC3zhZ9sadA= github.com/zyedidia/terminal v0.0.0-20180726154117-533c623e2415 h1:752dTQ5OatJ9M5ULK2+9lor+nzyZz+LYDo3WGngg3Rc= github.com/zyedidia/terminal v0.0.0-20180726154117-533c623e2415/go.mod h1:8leT8G0Cm8NoJHdrrKHyR9MirWoF4YW7pZh06B6H+1E= golang.org/x/sys v0.0.0-20190204203706-41f3e6584952/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=