diff --git a/cmd/micro/buffer.go b/cmd/micro/buffer.go index db207338..8d433795 100644 --- a/cmd/micro/buffer.go +++ b/cmd/micro/buffer.go @@ -158,7 +158,7 @@ func NewBuffer(reader io.Reader, size int64, path string) *Buffer { InitLocalSettings(b) - if b.Settings["savecursor"].(bool) || b.Settings["saveundo"].(bool) { + if len(*flagStartPos) == 0 && (b.Settings["savecursor"].(bool) || b.Settings["saveundo"].(bool)) { // If either savecursor or saveundo is turned on, we need to load the serialized information // from ~/.config/micro/buffers file, err := os.Open(configDir + "/buffers/" + EscapePath(b.AbsPath)) diff --git a/cmd/micro/command.go b/cmd/micro/command.go index 61f321ab..e429986d 100644 --- a/cmd/micro/command.go +++ b/cmd/micro/command.go @@ -57,6 +57,7 @@ func init() { "TabSwitch": TabSwitch, "MemUsage": MemUsage, "Retab": Retab, + "Raw": Raw, } } @@ -113,6 +114,7 @@ func DefaultCommands() map[string]StrCommand { "tabswitch": {"TabSwitch", []Completion{NoCompletion}}, "memusage": {"MemUsage", []Completion{NoCompletion}}, "retab": {"Retab", []Completion{NoCompletion}}, + "raw": {"Raw", []Completion{NoCompletion}}, } } @@ -203,6 +205,26 @@ func Retab(args []string) { CurView().Retab(true) } +func Raw(args []string) { + buf := NewBufferFromString("", "Raw events") + + view := NewView(buf) + view.Buf.Insert(view.Cursor.Loc, "Warning: Showing raw event escape codes\n") + view.Buf.Insert(view.Cursor.Loc, "Use CtrlQ to exit\n") + view.Type = vtRaw + tab := NewTabFromView(view) + tab.SetNum(len(tabs)) + tabs = append(tabs, tab) + curTab = len(tabs) - 1 + if len(tabs) == 2 { + for _, t := range tabs { + for _, v := range t.views { + v.ToggleTabbar() + } + } + } +} + // TabSwitch switches to a given tab either by name or by number func TabSwitch(args []string) { if len(args) > 0 { diff --git a/cmd/micro/micro.go b/cmd/micro/micro.go index 7ac93144..b74cf672 100644 --- a/cmd/micro/micro.go +++ b/cmd/micro/micro.go @@ -253,7 +253,7 @@ func LoadAll() { } } -// Passing -version as a flag will have micro print out the version number +// Command line flags var flagVersion = flag.Bool("version", false, "Show the version number and information") var flagStartPos = flag.String("startpos", "", "LINE,COL to start the cursor at when opening a buffer.") var flagConfigDir = flag.String("config-dir", "", "Specify a custom location for the configuration directory") diff --git a/cmd/micro/runtime.go b/cmd/micro/runtime.go index 93e7d4c0..e38501de 100644 --- a/cmd/micro/runtime.go +++ b/cmd/micro/runtime.go @@ -869,7 +869,7 @@ func runtimeHelpColorsMd() (*asset, error) { return a, nil } -var _runtimeHelpCommandsMd = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x57\xcd\x8e\xdb\x46\x12\x3e\x9b\x4f\x51\x18\x1f\x3c\x63\x8c\xe4\xbb\x2e\x7b\xf0\xee\x62\x17\xb0\x93\x49\x6c\x20\xc8\x29\x2c\x91\x45\xb2\x31\xcd\x6e\xba\xab\x29\x0d\xf3\xf4\x41\x55\x35\x29\xc9\x13\x20\xf6\xc5\xa3\xae\xff\xbf\xaf\x8a\x6f\xe1\x29\x32\xbb\xa3\x27\x68\xe2\x38\x62\x68\xb9\xaa\x7e\x8f\x33\x34\x18\x80\x5e\xa8\x99\x33\x81\xfc\xd9\xba\x1c\xd3\xca\x03\xc7\x05\xa6\x44\xcc\x2e\xf4\x50\x7f\xcc\xc9\xef\xa8\x86\x2e\x7a\x1f\xcf\xa4\xd4\x3c\x6c\x0a\xf7\xd5\xff\x28\x11\x60\x22\x7d\x9d\xbe\xb7\x07\x79\xc0\x0c\x4b\xb1\x39\x33\xed\xab\xea\x3d\xd4\xdf\x66\x97\xeb\x03\xfc\x32\xbb\xcc\x30\xba\x26\x45\x7b\x67\x3c\x11\x74\xce\x53\xc0\x91\xfe\x55\x1f\xe0\x0b\x9e\x88\xcd\xe0\x9c\x12\x85\x0c\xc7\xb9\xeb\x28\xed\xe1\xff\x9d\x3e\xaf\xcc\xe0\x18\xa6\x14\x4f\xae\xa5\x16\x5c\xae\x00\xce\xce\x7b\x78\xa7\x1a\x91\xdf\xdd\x30\x9b\xb1\x44\x93\xc7\x86\xe0\x8e\x09\x53\x33\xdc\xc1\xdd\x09\xfd\x4c\x77\xd0\x79\xec\xb9\x3e\xc0\xd7\xc1\xb1\xa9\x59\x59\x6b\x63\xad\xe1\xec\xf2\x00\xb5\xf2\xd7\x7b\xa8\x00\xe0\xeb\x40\x50\x9b\xa4\xa6\x23\x4e\xd9\xc5\x80\x7e\x7f\x29\x82\x52\x85\x78\x10\x81\xf7\x50\xef\xb0\x3e\xc0\xaf\x45\x37\x7a\x0f\xb1\xb1\x30\x1b\x62\xc0\x0c\x31\x34\xb4\xb2\xfa\xfa\x00\xff\x8e\x80\xe0\x5d\xa6\x84\x1e\xcc\x15\x70\x81\x33\x61\x0b\xb1\x03\x84\x44\x3d\xbd\x14\x4a\x25\x92\x3f\xc5\x4c\x56\x83\xcd\xf5\x71\xe6\x0c\x47\x02\x84\x13\x7a\xd7\x16\x99\xfb\x39\x78\x62\x56\x43\x9a\x4b\x64\xa6\xf6\x41\xf3\x1c\x03\x69\x88\xd1\x52\x8e\xa9\x9f\x47\x0a\x99\xa1\x8d\xc4\x10\x62\x86\x41\xb3\x1c\x16\xe0\x09\xc5\x77\x17\xc0\xe5\x47\xad\xfb\x88\x0b\xc4\xd1\x65\x15\xfd\x36\xc7\x4c\x7c\x93\x7e\x09\xfb\xfb\x0a\xfc\x78\xee\xf5\x47\x9c\xa5\xde\xd2\x5d\xd2\xc4\xa1\x73\x69\x44\x49\xfe\xbe\xaa\xde\x7c\x21\xda\x4c\xd5\x5b\x8b\x77\x31\xc1\x18\x13\x81\x0b\x5d\xbc\x70\x4b\x07\x52\x2e\xa5\x03\xb3\x70\x00\xa6\x6c\x2d\x58\xde\x73\x34\xd2\x1e\x44\xb9\x10\x6a\xa3\x70\x0d\x03\xf9\x09\x72\x9c\x5c\x23\x36\xc4\x2b\x29\x18\x67\xc9\x5d\x61\xda\xa6\x81\x29\x6f\x36\x7d\x6c\xd0\xff\xa8\x61\x50\x6e\xbf\xc0\x7d\x0c\x7e\x91\x64\x5f\x0d\x88\xd8\xb4\x19\x79\x28\xda\x87\x78\x2e\x1a\x44\xe7\x10\xcf\xb7\x03\x65\x2a\x4b\x6d\x7b\x77\xa2\x50\xb8\x4d\x9c\x4e\xe8\xe1\x8e\x5e\x0c\x12\x62\x90\xe2\xfc\x47\x64\x30\x4b\x93\xc2\xa7\x19\xe1\x42\xdd\x5f\x75\x9c\xce\xb5\xd5\x30\x44\xf5\x6b\x4a\x2e\x64\xe9\x93\x3c\x08\xb8\x70\xd4\x5c\xf0\x10\x67\xdf\x4a\xf9\xa0\x1e\x89\x99\x42\x4f\xe9\xf0\x99\x98\xb1\xa7\xfb\xfd\x7e\xff\x50\x4b\xe8\xad\xe3\xc9\xe3\x62\x7d\x3b\xaf\x33\x3c\x07\xe0\x61\x57\xea\x5a\x1f\x20\xcd\x81\xaf\x22\xe1\x81\xbc\xdf\xca\x5e\x32\x75\xc4\xe6\xb9\x4f\x71\x0e\xed\x5e\xc7\x56\x5c\x2b\x2c\xef\x18\xe2\x9c\xa7\x39\x9b\xdf\x47\x5a\xcd\x92\x4a\xcb\x24\x78\x17\x08\xce\x03\x49\x8b\x43\xe7\x82\xe3\x81\x58\xec\x06\x17\x7a\xf3\xea\xe8\x42\x0b\xcf\xb4\x00\x36\x25\xed\x4d\xa2\x92\xaf\x67\x5a\x84\x2c\xf1\x77\x29\x8e\xca\x96\x63\xe1\xbc\xb4\x14\x93\x3e\xb0\xce\x5d\xb8\x92\x62\xc0\x63\x14\x94\xbc\x6e\x61\x79\x13\x9f\x25\xed\xcf\xb4\x30\x48\xb4\xa6\x52\x01\x07\xf0\x84\xce\xe3\xd1\x97\xb4\x9d\x78\xf2\xea\xbd\xe1\x61\x7d\x80\x38\x91\xb0\xc2\x89\x52\x76\xd2\x8b\xc6\x61\xb3\xb6\xf1\x29\x1c\x84\x78\x8d\xba\x56\x57\x03\xde\xc7\xd7\x0a\x1c\xab\x6a\x6a\x4d\x95\x6c\x9b\x71\xca\xcb\x0a\xe3\xea\xcd\xf0\xca\x1b\x16\xdd\xc8\xab\xa3\x35\x1c\xe7\xbc\xb9\x38\xc4\xe4\xfe\x8c\x21\x5f\x6c\x5c\x41\xa0\xb8\x73\xeb\x82\xd9\xc8\x78\x7c\x1d\xee\xa5\x4f\x84\x24\x05\x46\x08\x74\x86\x8c\xc7\x4d\x8a\xcf\x2e\x37\x83\x3c\xad\xa8\xb4\x76\x93\x76\xc8\x4a\x8e\x56\xb5\x89\x1a\xd7\x39\x6a\x55\x85\xed\x04\x91\x94\x79\x17\xcf\xc8\xe5\x81\x92\xa1\xaf\x78\x14\xe6\xf1\x48\xe9\x11\x62\x12\xcb\x12\xb4\xc2\xb8\xda\x7f\x23\xff\x40\xbc\xf0\xb1\xbf\xaa\x90\x8f\xbd\x72\x79\x0f\xa3\xcd\x88\x95\xbb\xa5\xe3\xdc\x03\x67\xcc\xa4\xe8\x6c\x11\x4c\x7e\xee\x05\x8d\x03\x67\x91\xb0\x9f\x7f\x94\x2c\x94\xd7\xeb\x44\x18\xc3\x8d\x6c\xa2\x51\x1a\xee\x56\xd4\x1e\xff\x41\x52\x90\xaf\x3e\xe8\x7f\xac\x0e\x17\x83\xd4\x16\xee\x5b\x27\xe7\xa9\xc5\x2c\xca\xed\x8f\x1f\x11\x29\x4b\xf0\xd6\x37\x7b\x24\xd6\x19\x79\xe5\xe0\x15\x42\x15\x24\x96\xca\x74\x32\xb2\x17\xac\x16\xcb\xdb\xcc\xac\x96\x01\x15\xc5\x7a\x97\x87\xf9\xb8\x6f\xe2\xf8\x41\x21\x6e\x67\xf7\xd3\x07\xe3\xda\x35\x03\x86\x40\x7e\xaf\xfb\x77\xbd\xb6\xd0\x73\x04\x26\x7a\xb5\x75\xca\xe4\xea\xf1\x64\x21\x8d\x18\xb0\xa7\x54\xc0\x4a\x94\xd4\x4f\x46\xf9\x6c\x94\x7a\x05\x87\x15\xb4\x4b\x32\x6e\xd6\xcf\x4d\x96\xb6\x48\x4a\x31\x2e\x01\x6d\x21\x4a\xaa\xda\x78\x0e\x3e\x62\x0b\xf7\x59\xfa\xdc\x85\xc6\xcf\xad\x76\xd7\xa2\x53\x5e\x84\x0c\xdc\x71\xd1\x36\xf6\x89\xb0\x5d\x2e\x55\x7a\x58\x97\xbb\x28\xd2\x3e\x91\x3f\xac\x94\x69\x0e\xd9\x8d\x76\x86\x95\x32\x36\x2d\x4c\x98\x87\xfa\x00\x1f\x07\x0c\xbd\x61\xdf\x39\xa6\x67\xc1\xc7\xd6\x25\x6a\x72\x4c\xcb\x3a\x5e\x56\xc7\x5a\x25\x4a\x80\x67\x31\xf2\xa4\x7b\xe5\x7a\xa9\xbd\x52\x61\xec\x32\x43\xd7\x30\xf0\xb3\xfc\xc6\x6d\xfa\xff\xe6\xce\x2c\xd1\xd8\xf8\x97\x53\xcd\xa2\xf1\x84\x8a\xe2\x82\x11\x06\x6e\xe5\xf8\x89\x69\xa3\x95\x17\xa5\x0a\x9f\xa4\xb1\xa5\x89\x0c\xff\xa3\x59\xdc\x16\xb0\xc2\x4d\x8e\x26\x24\x01\xee\x76\xbb\xaa\x12\x10\xb1\xeb\x5b\x64\xb6\xc3\x5a\x50\x7d\x3b\x78\xcb\x51\xde\x52\x87\xb3\xdf\xca\x7b\x50\xe7\xbd\x0b\x32\x84\x9f\xbe\x4f\x91\x06\x2d\x65\xa7\x94\x62\x92\x7a\xbc\x85\x8f\x05\xda\x9e\x30\xc9\xf9\x5f\x55\xbf\xc9\x9e\x2b\xbb\x0d\x70\xb5\xfe\x78\x7d\xd1\x03\xbd\xe4\x84\xc0\x4b\xc8\xf8\xf2\x6a\xf3\xd3\xcb\xa4\xdf\x14\xd4\xc5\x44\xd5\xaa\xe9\xfa\x0b\x02\xbe\x46\x55\x23\x53\x52\x2e\xcb\xb2\x2b\x2c\x7d\xeb\x31\xc9\x6e\x9c\xfc\x02\xb2\x9b\x15\xf3\xab\x72\x4c\xde\xce\x98\x3a\x14\x4e\x2e\xc5\x30\xda\x75\x93\x9c\x34\x38\x6f\xf5\x5d\xbf\x72\x30\x29\x6c\xe6\x81\x96\x6a\x5d\xf6\xe6\xad\xc0\xb7\x36\x9c\x4b\xeb\xa5\xf7\x5f\x17\xe4\xe2\xba\x04\x2e\x6e\xe8\x57\xd4\x7a\xf9\x88\x7e\x39\x2c\xb2\x6b\x9e\xb9\xd2\x6b\xe3\x72\x44\x50\x39\x98\xb6\x4a\xd9\x5d\x62\x59\x19\xf4\x3b\xea\xaf\x00\x00\x00\xff\xff\xb1\x91\xa9\x65\xad\x0d\x00\x00") +var _runtimeHelpCommandsMd = []byte("\x1f\x8b\x08\x00\x00\x00\x00\x00\x00\xff\x8c\x57\xcd\x8e\xdc\xb8\x11\x3e\xaf\x9e\xa2\x30\x7b\xb0\xbd\x70\xf7\xde\xfb\x92\x83\x93\x20\x01\xd6\xc9\x24\x36\x10\xe4\x14\x55\x4b\x25\x89\x18\x8a\x94\x59\x64\xf7\x28\x4f\x1f\x54\x15\xa5\xee\xf6\x04\x58\xfb\xe0\x69\x91\xf5\xff\xf3\x55\xf1\x67\x78\x8e\xcc\xee\xec\x09\xba\x38\xcf\x18\x7a\x6e\x9a\x7f\xc7\x02\x1d\x06\xa0\x57\xea\x4a\x26\x90\x9f\xbd\xcb\x31\x6d\x34\x70\x5e\x61\x49\xc4\xec\xc2\x08\xed\xa7\x9c\xfc\x81\x5a\x18\xa2\xf7\xf1\x4a\x7a\x9b\xa7\x5d\xe0\xb1\xf9\x0b\x25\x02\x4c\xa4\xa7\xcb\xf7\xfa\x20\x4f\x98\x61\xad\x3a\x0b\xd3\xb1\x69\x7e\x81\xf6\x5b\x71\xb9\x3d\xc1\x3f\x8a\xcb\x0c\xb3\xeb\x52\xb4\x73\xc6\x0b\xc1\xe0\x3c\x05\x9c\xe9\x0f\xed\x09\xbe\xe0\x85\xd8\x14\x96\x94\x28\x64\x38\x97\x61\xa0\x74\x84\xbf\x0e\x7a\xbc\x11\x83\x63\x58\x52\xbc\xb8\x9e\x7a\x70\xb9\x01\xb8\x3a\xef\xe1\x9d\x4a\x44\x7e\xf7\x40\x6c\xca\x12\x2d\x1e\x3b\x82\x27\x26\x4c\xdd\xf4\x04\x4f\x17\xf4\x85\x9e\x60\xf0\x38\x72\x7b\x82\xaf\x93\x63\x13\xb3\x91\xb6\x46\xda\xc2\xd5\xe5\x09\x5a\xa5\x6f\x8f\xd0\x00\xc0\xd7\x89\xa0\x35\x4e\x0d\x47\x5c\xb2\x8b\x01\xfd\xf1\x96\x04\xbd\x95\xcb\x93\x30\xfc\x02\xed\x01\xdb\x13\xfc\xb3\xca\x46\xef\x21\x76\xe6\x66\x47\x0c\x98\x21\x86\x8e\x36\x52\xdf\x9e\xe0\x8f\x11\x10\xbc\xcb\x94\xd0\x83\x99\x02\x2e\x70\x26\xec\x21\x0e\x80\x90\x68\xa4\xd7\x7a\xd3\x08\xe7\xdf\x62\x26\xcb\xc1\x6e\xfa\x5c\x38\xc3\x99\x00\xe1\x82\xde\xf5\x95\xe7\x7d\x09\x9e\x98\x55\x91\xc6\x12\x99\xa9\xff\xa0\x71\x8e\x81\xd4\xc5\x68\x21\xc7\x34\x96\x99\x42\x66\xe8\x23\x31\x84\x98\x61\xd2\x28\x87\x15\x78\x41\xb1\xdd\x05\x70\xf9\xa3\xe6\x7d\xc6\x15\xe2\xec\xb2\xb2\x7e\x2b\x31\x13\x3f\x84\x5f\xdc\xfe\x3e\x03\x3f\x1e\x7b\xfd\x88\x45\xf2\x2d\xd5\x25\x45\x1c\x06\x97\x66\x94\xe0\x1f\x9b\xe6\xa7\x2f\x44\xbb\xaa\x76\x2f\xf1\x21\x26\x98\x63\x22\x70\x61\x88\x37\x6a\xa9\x40\xca\x35\x75\x60\x1a\x4e\xc0\x94\xad\x04\xeb\x79\x8e\x76\x75\x04\x11\x2e\x17\xad\xdd\x70\x0b\x13\xf9\x05\x72\x5c\x5c\x27\x3a\xc4\x2a\x49\x18\x67\x89\x5d\x25\xda\xbb\x81\x29\xef\x3a\x7d\xec\xd0\xff\xa8\x62\x50\x6a\xbf\xc2\xfb\x18\xfc\x2a\xc1\xbe\x6b\x10\xd1\x69\x3d\xf2\xa1\x4a\x9f\xe2\xb5\x4a\x10\x99\x53\xbc\x3e\x36\x94\x89\xac\xb9\x1d\xdd\x85\x42\xa5\x36\x76\xba\xa0\x87\x27\x7a\x35\x48\x88\x41\x92\xf3\x27\xe1\xc1\x2c\x45\x0a\xbf\x15\x84\xdb\xed\xf1\xae\xe2\xb4\xaf\x2d\x87\x21\xaa\x5d\x4b\x72\x21\x4b\x9d\xe4\x49\xc0\x85\xa3\xc6\x82\xa7\x58\x7c\x2f\xe9\x83\x76\x26\x66\x0a\x23\xa5\xd3\x67\x62\xc6\x91\xde\x1f\x8f\xc7\x0f\xad\xb8\xde\x3b\x5e\x3c\xae\x56\xb7\x65\xeb\xe1\x12\x80\xa7\x43\xcd\x6b\x7b\x82\x54\x02\xdf\x79\xc2\x13\x79\xbf\xa7\xbd\x46\xea\x8c\xdd\xcb\x98\x62\x09\xfd\x51\xdb\x56\x4c\xab\x24\xef\x18\x62\xc9\x4b\xc9\x66\xf7\x99\x36\xb5\xa4\xdc\xd2\x09\xde\x05\x82\xeb\x44\x52\xe2\x30\xb8\xe0\x78\x22\x16\xbd\xc1\x85\xd1\xac\x3a\xbb\xd0\xc3\x0b\xad\x80\x5d\x0d\x7b\x97\xa8\xc6\xeb\x85\x56\xb9\x16\xff\x87\x14\x67\x25\xcb\xb1\x52\xde\x4a\x8a\x49\x0f\x58\xfb\x2e\xdc\x71\x31\xe0\x39\x0a\x4a\xde\x97\xb0\x9c\x89\xcd\x12\xf6\x17\x5a\x19\xc4\x5b\x13\xa9\x80\x03\x78\x41\xe7\xf1\xec\x6b\xd8\x2e\xbc\x78\xb5\xde\xf0\xb0\x3d\x41\x5c\x48\x48\xe1\x42\x29\x3b\xa9\x45\xa3\xb0\x5e\xdb\xe9\x14\x0e\x42\xbc\x47\x5d\xcb\xab\x01\xef\xc7\xb7\x02\x1c\xab\x68\xea\x4d\x94\x4c\x9b\x79\xc9\xeb\x06\xe3\x6a\xcd\xf4\xc6\x1a\x16\xd9\xc8\x9b\xa1\x2d\x9c\x4b\xde\x4d\x9c\x62\x72\xff\x8d\x21\xdf\x74\xdc\x41\xa0\x98\xf3\x68\x82\xe9\xc8\x78\x7e\xeb\xee\xad\x4e\xe4\x4a\x12\x8c\x10\xe8\x0a\x19\xcf\x3b\x17\x5f\x5d\xee\x26\x39\xda\x50\x69\xab\x26\xad\x90\xed\x3a\x5a\xd6\x16\xea\xdc\xe0\xa8\x57\x11\x36\x13\x84\x53\xfa\x5d\x2c\x23\x97\x27\x4a\x86\xbe\x62\x51\x28\xf3\x99\xd2\x47\x88\x49\x34\x8b\xd3\x0a\xe3\xaa\xff\x27\xf9\x07\x62\x85\x8f\xe3\x5d\x86\x7c\x1c\x95\xca\x7b\x98\xad\x47\x2c\xdd\x3d\x9d\xcb\x08\x9c\x31\x93\xa2\xb3\x79\xb0\xf8\x32\x0a\x1a\x07\xce\xc2\x61\x9f\xff\xa9\x51\xa8\xa7\xf7\x81\x30\x82\x07\xde\x44\xb3\x14\xdc\x23\xab\x1d\xfe\x0e\xa7\x20\x5f\x7b\xd2\x3f\xac\x06\x57\x85\xd4\x57\xea\x47\x23\xcb\xd2\x63\x16\xe1\xf6\xe3\x47\x58\xea\x10\x7c\xb4\xcd\x0e\x89\xb5\x47\xde\x18\x78\x87\x50\x15\x89\x25\x33\x83\xb4\xec\x0d\xab\x45\xf3\xde\x33\x9b\x66\x40\x45\xb1\xd1\xe5\xa9\x9c\x8f\x5d\x9c\x7f\x55\x88\x3b\xd8\xfe\xf4\xab\x51\x1d\xba\x09\x43\x20\x7f\xd4\xf9\xbb\x6d\x5b\xe8\x39\x02\x13\xbd\x99\x3a\xb5\x73\x75\x79\x32\x97\x66\x0c\x38\x52\xaa\x60\x25\x42\xda\x67\xbb\xf9\x6c\x37\xed\x06\x0e\x1b\x68\xd7\x60\x3c\x8c\x9f\x87\x28\xed\x9e\xd4\x64\xdc\x1c\xda\x5d\x94\x50\xf5\xf1\x1a\x7c\xc4\x1e\xde\x67\xa9\x73\x17\x3a\x5f\x7a\xad\xae\x55\xbb\xbc\x32\x19\xb8\xe3\xaa\x65\xec\x13\x61\xbf\xde\xb2\xf4\x61\x1b\xee\x22\x48\xeb\x44\x7e\x58\x2a\x53\x09\xd9\xcd\xb6\x86\xd5\x34\x76\x3d\x2c\x98\xa7\xf6\x04\x9f\x26\x0c\xa3\x61\xdf\x35\xa6\x17\xc1\xc7\xde\x25\xea\x72\x4c\xeb\xd6\x5e\x96\xc7\x56\x39\xaa\x83\x57\x51\xf2\xac\x73\xe5\x7e\xa8\xbd\x11\x61\xe4\xd2\x43\xf7\x30\xf0\x77\xf9\xc6\xbd\xfb\xff\xcf\x9e\x59\xbd\xb1\xf6\xaf\xab\x9a\x79\xe3\x09\x15\xc5\x05\x23\x0c\xdc\xea\xf2\x13\xd3\x7e\x57\x4f\xf4\x56\xe8\x24\x8c\x3d\x2d\x64\xf8\x1f\x4d\xe3\x3e\x80\x15\x6e\x72\x34\xa6\xea\x60\xc2\x6b\x7b\x82\xcf\xb7\x51\x1a\xcd\xe4\x0a\x53\xda\xf9\x3a\xe1\x45\x12\x71\x87\x8b\xcc\x8e\x6f\x45\x76\x48\x4d\x2a\x5d\x28\xad\xf2\xbf\xad\x06\x2e\x43\xa2\x8e\x9c\xf4\xae\xce\x1f\xe1\xcb\x94\x66\xa7\xbb\xaa\x02\x9c\xed\x08\xd2\x1c\xd7\xdb\x1c\xc7\x2e\x17\x5d\x3a\x98\x2a\xab\x88\xbb\xe7\x56\x5b\xa4\x02\x8d\x57\xaa\xfd\x3a\xb9\x6e\x82\xdb\xe4\x4a\x14\xde\xe5\xdb\x2b\x41\x51\x74\x5a\x4d\xad\x5a\xc7\x30\x47\xce\xb2\x0b\x0c\xc5\x5b\x51\x0a\xac\x8d\x12\xae\xbb\x19\x78\x6c\x9a\xc3\xe1\xd0\x34\x02\xb0\xf6\x32\x11\x82\xfd\xd1\x21\x13\x6f\x7f\x0c\xd4\x07\x4b\x4f\x03\x16\xbf\x97\xfe\x49\xa3\xeb\x5d\x10\x80\xfa\xed\xfb\xf2\xd1\x82\xd0\xe8\xa5\x14\x93\xa8\xfb\x19\x3e\x55\xd8\x7f\xc6\x24\x4f\xa3\xa6\xf9\x97\xec\x00\x75\xee\x03\x6e\xda\x3f\xde\xbf\x76\x80\x5e\x73\x42\xe0\x35\x64\x7c\x7d\xb3\x15\xd1\xeb\xa2\xef\x2d\x1a\x62\xa2\x66\x93\x74\xff\xba\x82\xaf\x51\xc5\x08\x82\xd4\xad\xbb\xce\x51\x2b\xad\x6d\xd1\x66\x37\x2f\x7e\x05\xd9\x5b\x74\x1e\x36\x75\xd1\x7e\xc4\x1f\x35\x28\x5c\x5c\x8a\x61\xb6\xcd\x2f\x39\x69\x7e\xde\x6b\x7f\x7b\x01\x62\xd2\xdc\xe4\x89\xd6\x66\x5b\x84\xcc\x5a\x19\x6d\xda\x8c\x2e\x6d\x5b\xf0\x9f\x25\xf9\x7e\xbd\x39\x2e\x66\xe8\x0b\x73\xdb\x0a\x45\xbe\x2c\x5d\xd9\x75\x2f\xdc\xe8\x26\x76\x5b\xb0\xa8\x2e\x93\x7b\xa6\x6c\x67\xb3\xa8\x4c\xfa\xc6\xfc\x5f\x00\x00\x00\xff\xff\xd8\x2c\x37\xf3\xc9\x0e\x00\x00") func runtimeHelpCommandsMdBytes() ([]byte, error) { return bindataRead( diff --git a/cmd/micro/vendor/github.com/zyedidia/tcell b/cmd/micro/vendor/github.com/zyedidia/tcell index c92e80b7..869faf86 160000 --- a/cmd/micro/vendor/github.com/zyedidia/tcell +++ b/cmd/micro/vendor/github.com/zyedidia/tcell @@ -1 +1 @@ -Subproject commit c92e80b717d7d911424a2c8394af863ceca4abf0 +Subproject commit 869faf86d0607cf067597dcb302bee36648ac7ce diff --git a/cmd/micro/view.go b/cmd/micro/view.go index b0100ceb..5bab40bd 100644 --- a/cmd/micro/view.go +++ b/cmd/micro/view.go @@ -1,7 +1,9 @@ package main import ( + "fmt" "os" + "reflect" "strconv" "strings" "time" @@ -21,6 +23,7 @@ var ( vtHelp = ViewType{1, true, true} vtLog = ViewType{2, true, true} vtScratch = ViewType{3, false, true} + vtRaw = ViewType{4, true, true} ) // The View struct stores information about a view into a buffer. @@ -496,6 +499,20 @@ func (v *View) SetCursor(c *Cursor) bool { // HandleEvent handles an event passed by the main loop func (v *View) HandleEvent(event tcell.Event) { + if v.Type == vtRaw { + v.Buf.Insert(v.Cursor.Loc, reflect.TypeOf(event).String()[7:]) + v.Buf.Insert(v.Cursor.Loc, fmt.Sprintf(": %q\n", event.EscSeq())) + + switch e := event.(type) { + case *tcell.EventKey: + if e.Key() == tcell.KeyCtrlQ { + v.Quit(true) + } + } + + return + } + // This bool determines whether the view is relocated at the end of the function // By default it's true because most events should cause a relocate relocate := true @@ -506,7 +523,7 @@ func (v *View) HandleEvent(event tcell.Event) { case *tcell.EventRaw: for key, actions := range bindings { if key.keyCode == -1 { - if e.EscapeCode() == key.escape { + if e.EscSeq() == key.escape { for _, c := range v.Buf.cursors { ok := v.SetCursor(c) if !ok { @@ -712,8 +729,8 @@ func (v *View) DisplayView() { v.leftCol = 0 } - if v.Type == vtLog { - // Log views should always follow the cursor... + if v.Type == vtLog || v.Type == vtRaw { + // Log or raw views should always follow the cursor... v.Relocate() } diff --git a/runtime/help/commands.md b/runtime/help/commands.md index 5c1ed45c..b0a7d418 100644 --- a/runtime/help/commands.md +++ b/runtime/help/commands.md @@ -80,6 +80,11 @@ Here are the possible commands that you can use. * `retab`: Replaces all leading tabs with spaces or leading spaces with tabs depending on the value of `tabstospaces`. +* `raw`: Micro will open a new tab and show the escape sequence for every event + it receives from the terminal. This shows you what micro actually sees from + the terminal and helps you see which bindings aren't possible and why. This + is most useful for debugging keybindings. + --- The following commands are provided by the default plugins: