Skip to content

Commit fd99d70

Browse files
committed
nvim: fix some types to v0.6.0
Signed-off-by: Koichi Shiraishi <[email protected]>
1 parent 34b6240 commit fd99d70

File tree

2 files changed

+83
-17
lines changed

2 files changed

+83
-17
lines changed

nvim/types.go

Lines changed: 81 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ type HLAttrs struct {
104104
// Bold is the bold font style.
105105
Bold bool `msgpack:"bold,omitempty"`
106106

107+
// Standout is the standout font style.
108+
Standout int `msgpack:"standout,omitempty"`
109+
107110
// Underline is the underline font style.
108111
Underline bool `msgpack:"underline,omitempty"`
109112

@@ -116,19 +119,17 @@ type HLAttrs struct {
116119
// Reverse is the reverse to foreground and background.
117120
Reverse bool `msgpack:"reverse,omitempty"`
118121

119-
// Inverse same as Reverse.
120-
Inverse bool `msgpack:"inverse,omitempty"`
122+
// Strikethrough is the strikethrough font style.
123+
Strikethrough bool `msgpack:"strikethrough,omitempty"`
121124

122-
// Standout is the standout font style.
123-
Standout int `msgpack:"standout,omitempty"`
125+
ForegroundIndexed bool `msgpack:"fg_indexed,omitempty"`
124126

125-
// Nocombine override attributes instead of combining them.
126-
Nocombine int `msgpack:"nocombine,omitempty"`
127+
BackgroundIndexed bool `msgpack:"bg_indexed,omitempty"`
127128

128-
// Foreground use normal foreground color.
129+
// Foreground is foreground color of RGB color.
129130
Foreground int `msgpack:"foreground,omitempty" empty:"-1"`
130131

131-
// Background use normal background color.
132+
// Background is background color of RGB color.
132133
Background int `msgpack:"background,omitempty" empty:"-1"`
133134

134135
// Special is used for undercurl and underline.
@@ -140,6 +141,31 @@ type HLAttrs struct {
140141
// Only takes effect if 'pumblend' or 'winblend' is set for the menu or window.
141142
// See the help at the respective option.
142143
Blend int `msgpack:"blend,omitempty"`
144+
145+
// Nocombine override attributes instead of combining them.
146+
Nocombine bool `msgpack:"nocombine,omitempty"`
147+
148+
// Default don't override existing definition, like "hi default".
149+
//
150+
// This value is used only SetHighlight.
151+
Default bool `msgpack:"default,omitempty"`
152+
153+
// Cterm is cterm attribute map. Sets attributed for cterm colors.
154+
//
155+
// Note thet by default cterm attributes are same as attributes of gui color.
156+
//
157+
// This value is used only SetHighlight.
158+
Cterm *HLAttrs `msgpack:"cterm,omitempty"`
159+
160+
// CtermForeground is the foreground of cterm color.
161+
//
162+
// This value is used only SetHighlight.
163+
CtermForeground int `msgpack:"ctermfg,omitempty" empty:"-1"`
164+
165+
// CtermBackground is the background of cterm color.
166+
//
167+
// This value is used only SetHighlight.
168+
CtermBackground int `msgpack:"ctermbg,omitempty" empty:"-1"`
143169
}
144170

145171
// Mapping represents a nvim mapping options.
@@ -400,6 +426,8 @@ type TextChunk struct {
400426
// cursor
401427
// Cursor position in current window.
402428
//
429+
// Win is window ID for Relative="win".
430+
//
403431
// Anchor is the decides which corner of the float to place at row and col.
404432
//
405433
// NW
@@ -413,7 +441,6 @@ type TextChunk struct {
413441
//
414442
// BufPos places float relative to buffer text only when Relative == "win".
415443
// Takes a tuple of zero-indexed [line, column].
416-
//
417444
// Row and Col if given are applied relative to this position, else they default to Row=1 and Col=0 (thus like a tooltip near the buffer text).
418445
//
419446
// Row is the row position in units of "screen cell height", may be fractional.
@@ -426,6 +453,9 @@ type TextChunk struct {
426453
// External is the GUI should display the window as an external top-level window.
427454
// Currently accepts no other positioning configuration together with this.
428455
//
456+
// ZIndex is stacking order. floats with higher "zindex" go on top on floats with lower indices. Must be larger than zero.
457+
// The default value for floats are 50. In general, values below 100 are recommended, unless there is a good reason to overshadow builtin elements.
458+
//
429459
// Style is the Configure the appearance of the window.
430460
// Currently only takes one non-empty value:
431461
//
@@ -435,18 +465,24 @@ type TextChunk struct {
435465
//
436466
// Disables "number", "relativenumber", "cursorline", "cursorcolumn", "foldcolumn", "spell" and "list" options.
437467
// And, "signcolumn" is changed to "auto" and "colorcolumn" is cleared.
438-
//
439468
// The end-of-buffer region is hidden by setting "eob" flag of "fillchars" to a space char, and clearing the EndOfBuffer region in "winhighlight".
440469
//
441470
// border
442471
// Style of (optional) window border. This can either be a string or an array.
443472
// The string values are:
444-
// "none"
473+
//
474+
// none
445475
// No border. This is the default.
446-
// "single"
476+
// single
447477
// A single line box.
448-
// "double"
478+
// double
449479
// A double line box.
480+
// rounded
481+
// Like "single", but with rounded corners ("╭" etc.).
482+
// solid
483+
// Adds padding by a single whitespace cell.
484+
// shadow
485+
// A drop shadow effect by blending with the background.
450486
//
451487
// If it is an array it should be an array of eight items or any divisor of
452488
// eight. The array will specifify the eight chars building up the border
@@ -461,10 +497,15 @@ type TextChunk struct {
461497
// Or all chars the same as:
462498
// [ "x" ]
463499
//
500+
// An empty string can be used to turn off a specific border, for instance,
501+
// [ "", "", "", ">", "", "", "", "<" ]
502+
//
464503
// By default "FloatBorder" highlight is used which links to "VertSplit"
465504
// when not defined.
466505
// It could also be specified by character:
467506
// [ {"+", "MyCorner"}, {"x", "MyBorder"} ]
507+
//
508+
// NoAutocmd is if true then no buffer-related autocommand events such as BufEnter, BufLeave or BufWinEnter may fire from calling this function.
468509
type WindowConfig struct {
469510
// Relative is the specifies the type of positioning method used for the floating window.
470511
Relative string `msgpack:"relative,omitempty"`
@@ -496,13 +537,38 @@ type WindowConfig struct {
496537
// External is the GUI should display the window as an external top-level window.
497538
External bool `msgpack:"external,omitempty"`
498539

540+
// ZIndex stacking order. floats with higher `zindex` go on top on floats with lower indices. Must be larger than zero.
541+
ZIndex int `msgpack:"zindex,omitempty" empty:"50"`
542+
499543
// Style is the Configure the appearance of the window.
500544
Style string `msgpack:"style,omitempty"`
501545

502546
// Border is the style of window border.
503-
Border []string `msgpack:"border,omitempty"`
547+
Border interface{} `msgpack:"border,omitempty"`
548+
549+
// NoAutocmd whether the fire buffer-related autocommand events
550+
NoAutocmd bool `msgpack:"noautocmd,omitempty"`
504551
}
505552

553+
// BorderStyle represents a WindowConfig.Border style.
554+
type BorderStyle string
555+
556+
// list of BorderStyle.
557+
const (
558+
// BorderStyleNone is the no border. This is the default.
559+
BorderStyleNone = BorderStyle("none")
560+
// BorderStyleSingle is a single line box.
561+
BorderStyleSingle = BorderStyle("single")
562+
// BorderStyleDouble a double line box.
563+
BorderStyleDouble = BorderStyle("double")
564+
// BorderStyleRounded like "single", but with rounded corners ("╭" etc.).
565+
BorderStyleRounded = BorderStyle("rounded")
566+
// BorderStyleSolid adds padding by a single whitespace cell.
567+
BorderStyleSolid = BorderStyle("solid")
568+
// BorderStyleShadow a drop shadow effect by blending with the background.
569+
BorderStyleShadow = BorderStyle("shadow")
570+
)
571+
506572
// ExtMark represents a extmarks type.
507573
type ExtMark struct {
508574
// ID is the extmarks ID.
@@ -582,6 +648,6 @@ func (level LogLevel) String() string {
582648
case LogErrorLevel:
583649
return "ErrorLevel"
584650
default:
585-
return "unkonwn Level"
651+
return "unknown Level"
586652
}
587653
}

nvim/types_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,9 @@ func TestLogLevel_String(t *testing.T) {
3838
want: "ErrorLevel",
3939
},
4040
{
41-
name: "unkonwn",
41+
name: "unknown",
4242
level: LogLevel(-1),
43-
want: "unkonwn Level",
43+
want: "unknown Level",
4444
},
4545
}
4646
for _, tt := range tests {

0 commit comments

Comments
 (0)