diff --git a/cmd/micro/buffer.go b/cmd/micro/buffer.go index d781c7f1..aea7c030 100644 --- a/cmd/micro/buffer.go +++ b/cmd/micro/buffer.go @@ -55,6 +55,14 @@ type SerializedBuffer struct { // NewBuffer creates a new buffer from `txt` with path and name `path` func NewBuffer(txt []byte, path string) *Buffer { + for _, tab := range tabs { + for _, view := range tab.views { + if view.Buf.Path == path { + return view.Buf + } + } + } + b := new(Buffer) b.LineArray = NewLineArray(txt) diff --git a/cmd/micro/highlighter.go b/cmd/micro/highlighter.go index 42d66702..661a7e8a 100644 --- a/cmd/micro/highlighter.go +++ b/cmd/micro/highlighter.go @@ -1,11 +1,12 @@ package main import ( - "github.com/zyedidia/tcell" "io/ioutil" "path/filepath" "regexp" "strings" + + "github.com/zyedidia/tcell" ) // FileTypeRules represents a complete set of syntax rules for a filetype diff --git a/cmd/micro/runtime.go b/cmd/micro/runtime.go index 066ed5fe..69043519 100644 --- a/cmd/micro/runtime.go +++ b/cmd/micro/runtime.go @@ -2361,7 +2361,7 @@ func runtimeSyntaxViMicro() (*asset, error) { return a, nil } -var _runtimeSyntaxXmlMicro = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x74\xcc\xcf\x4a\xc3\x40\x10\xc7\xf1\xfb\x3e\xc5\xcf\x89\x88\x5a\x12\x1f\xa0\x7f\x72\x50\xc1\x9b\x1e\xbc\x48\x4c\x60\x69\xa7\x69\x64\x76\x53\x66\x17\xba\x81\x3c\xbc\x14\xea\x1e\x84\xde\x86\xdf\x7c\xf8\x16\x05\xde\x58\x19\x43\x80\xf5\xe0\x64\xdd\x51\x18\xfb\x51\x91\x9c\x60\x3f\x08\x87\xca\x14\x85\x31\x61\xf2\xd1\x26\x50\x72\x42\xa0\xef\xea\xbe\xf9\xd1\xd0\xd6\x87\xe8\xa4\x9e\x93\x93\x39\xf4\xe7\x4b\x7d\x3f\x1f\x65\x08\xf1\xe1\x96\xcc\x76\x94\x51\x71\x3a\x0c\x91\x41\x5d\xb5\xc8\x53\xaf\xcc\x1e\x08\xd1\x6a\x5c\xd3\x8a\xc0\x7e\xb7\xa6\xcd\xdf\x7b\x3b\x59\x0f\x80\x56\x4d\xb7\x41\xbb\xf8\x3f\x67\x37\xb1\xc8\x78\xca\x99\x9b\x97\xf7\xe7\xcf\xaf\x8f\xd7\x4b\xae\x79\x6a\xeb\xab\xb4\x2c\x2f\xaa\x2c\xb3\x51\xde\xe1\xdc\xbf\x6b\xba\x65\xfb\xb8\x24\xf3\x1b\x00\x00\xff\xff\xcc\x1b\xd3\x33\x1d\x01\x00\x00") +var _runtimeSyntaxXmlMicro = []byte("\x1f\x8b\x08\x00\x00\x09\x6e\x88\x00\xff\x74\xcd\xcd\x4a\xc4\x30\x14\xc5\xf1\x7d\x9e\xe2\x78\x47\xc4\x0f\x32\x3e\xc0\x4c\xdb\x85\x0a\xee\x74\xe1\x46\x6a\x0b\xa1\xde\x96\xc0\x4d\x52\x72\xb3\x88\xd0\x87\x17\x45\x5d\x39\xdb\xff\xf9\xc1\xd9\xed\xf0\xc8\x99\xe1\x15\x2e\x82\xab\x0b\xab\x30\xe6\x94\x51\x83\x60\xf6\xc2\xba\x37\x46\x3f\x62\x71\x15\x54\x83\x10\xe8\x6d\x7f\x59\x83\x6c\xba\x04\xe9\xb6\x1c\x97\x6d\x15\xaf\xe5\xea\x9c\xcc\x94\x24\x65\x68\x71\x85\x03\xc7\x02\x80\x8e\xfd\xd8\x62\xb8\xf9\x77\x6b\x7f\xeb\x94\xc2\x77\xd3\xe2\x72\x69\xe8\x78\x76\xff\x74\xf7\xf2\xfa\xfc\x40\xe0\xf8\xde\x50\x7f\x3b\x74\xa7\xad\xb5\x3f\xcc\xda\x3f\xa4\x2b\x4f\xde\x09\xbe\x5e\x2e\xfa\xf1\x30\x5c\x1f\xc8\x7c\x06\x00\x00\xff\xff\x1a\x6e\x79\xd4\xec\x00\x00\x00") func runtimeSyntaxXmlMicroBytes() ([]byte, error) { return bindataRead( diff --git a/cmd/micro/view.go b/cmd/micro/view.go index 2ed94700..da656e8b 100644 --- a/cmd/micro/view.go +++ b/cmd/micro/view.go @@ -494,9 +494,6 @@ func (v *View) HandleEvent(event tcell.Event) { if relocate { v.Relocate() } - if v.Buf.Settings["syntax"].(bool) { - v.matches = Match(v) - } } // GutterMessage creates a message in this view's gutter @@ -552,6 +549,9 @@ func (v *View) drawCell(x, y int, ch rune, combc []rune, style tcell.Style) { // DisplayView renders the view to the screen func (v *View) DisplayView() { + if v.Buf.Settings["syntax"].(bool) { + v.matches = Match(v) + } // The charNum we are currently displaying // starts at the start of the viewport charNum := Loc{0, v.Topline} diff --git a/runtime/syntax/xml.micro b/runtime/syntax/xml.micro index d4254afb..595871d1 100644 --- a/runtime/syntax/xml.micro +++ b/runtime/syntax/xml.micro @@ -1,11 +1,8 @@ ## Here is an example for xml files. -## syntax "xml" "\.(xml|sgml?|rng|plist)$" -color white "^.+$" -color green start="<" end=">" -color cyan "<[^> ]+" -color cyan ">" -color yellow start="" -color yellow start="" -color red "&[^;]*;" +color statement "<[^> ]+" +color statement ">" +color comment start="" +color comment start="" +color special "&[^;]*;"