From 10de420085fa6c6b4a28b1ab5b1bb7dba645cf4c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=C3=A9rez?= Date: Sat, 14 Nov 2020 00:21:13 +0100 Subject: [PATCH 01/31] Started working on vim event modifiers --- config/config.go | 4 +++ go.mod | 4 +++ go.sum | 53 +++++++++++++++++++++++++++++ shortcuts/shortcuts.go | 76 +++++++++++++++++++++++++++++++++++++----- ui/window.go | 2 ++ 5 files changed, 131 insertions(+), 8 deletions(-) diff --git a/config/config.go b/config/config.go index 8835b723..4a005d02 100644 --- a/config/config.go +++ b/config/config.go @@ -9,6 +9,7 @@ import ( "strings" "github.com/Bios-Marcel/cordless/util/files" + "github.com/Bios-Marcel/cordless/util/vim" ) const ( @@ -155,6 +156,8 @@ type Config struct { // download files to. If FileOpenSaveFilesPermanently has been set to // true, then all opened files are saved in this folder for example. FileDownloadSaveLocation string + + VimMode *vim.Vim } // Account has a name and a token. The name is just for the users recognition. @@ -211,6 +214,7 @@ func createDefaultConfig() *Config { FileOpenHandlers: make(map[string]string), FileOpenSaveFilesPermanently: false, FileDownloadSaveLocation: "~/Downloads", + VimMode: vim.Vim{}, } } diff --git a/go.mod b/go.mod index 67f0a5ac..ca8cb417 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,5 @@ +replace github.com/Bios-Marcel/cordless => /home/gamb1t/Projects/go/src/cordless + module github.com/Bios-Marcel/cordless go 1.12 @@ -20,6 +22,8 @@ require ( github.com/robertkrimen/otto v0.0.0-20200922221731-ef014fd054ac github.com/sergi/go-diff v1.1.0 github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 + golang.org/x/tools v0.0.0-20201112171726-b38955972a18 // indirect + golang.org/x/tools/gopls v0.5.2 // indirect gopkg.in/sourcemap.v1 v1.0.5 // indirect rsc.io/qr v0.2.0 ) diff --git a/go.sum b/go.sum index 78931bda..3d79933d 100644 --- a/go.sum +++ b/go.sum @@ -6,6 +6,8 @@ github.com/Bios-Marcel/goclipimg v0.0.0-20191117180634-d0f7b06fbe82 h1:gspJ6CW9b github.com/Bios-Marcel/goclipimg v0.0.0-20191117180634-d0f7b06fbe82/go.mod h1:hiFR6fH5+uc/f2yK2syh/UfzaPfGo6F2HJSoiI4ufWU= github.com/Bios-Marcel/shortnotforlong v1.1.1 h1:cCJIp6MODd4rwH5Y+fAMAaIuFxS1FPKfwDbRzsCU9nM= github.com/Bios-Marcel/shortnotforlong v1.1.1/go.mod h1:g6bFiwq0pq7pqENRgHiCZu7uMzeYPIXwANlaBQ47LBw= +github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38 h1:smF2tmSOzy2Mm+0dGI2AIUHY+w0BUc+4tn40djz7+6U= github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38/go.mod h1:r7bzyVFMNntcxPZXK3/+KdruV1H5KSlyVY0gc+NgInI= github.com/alecthomas/chroma v0.7.3 h1:NfdAERMy+esYQs8OXk0I868/qDxxCEo7FMz1WIqMAeI= @@ -35,16 +37,20 @@ github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4/go.mod h1:kW3HQ4Uda github.com/godbus/dbus/v5 v5.0.3 h1:ZqHaoEF7TBzh4jzPmqVhE/5A1z9of6orkAe5uHoAeME= github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/go-cmp v0.5.1 h1:JFrFEBb2xKufg6XkJsJr+WbKb4FQlURi5RUcBveYu9k= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-github/v29 v29.0.3 h1:IktKCTwU//aFHnpA+2SLIi7Oo9uhAzgsdZNbcAqhgdc= github.com/google/go-github/v29 v29.0.3/go.mod h1:CHKiKKPHJ0REzfwc14QMklvtHwCveD0PxlMjLlzAM5E= github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c h1:16eHWuMGvCjSfgRJKqIzapE78onvvTbdi1rMkU00lZw= github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherwasm v1.1.0 h1:fA2uLoctU5+T3OhOn2vYP0DVT6pxc7xhTlBB1paATqQ= github.com/gopherjs/gopherwasm v1.1.0/go.mod h1:SkZ8z7CWBz5VXbhJel8TxCmAcsQqzgWGR/8nMhyhZSI= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -78,6 +84,9 @@ github.com/rivo/uniseg v0.1.0 h1:+2KBaVoUmb9XzDsrx/Ct0W/EYOSFf/nWTauy++DprtY= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/robertkrimen/otto v0.0.0-20200922221731-ef014fd054ac h1:kYPjbEN6YPYWWHI6ky1J813KzIq/8+Wg4TO4xU7A/KU= github.com/robertkrimen/otto v0.0.0-20200922221731-ef014fd054ac/go.mod h1:xvqspoSXJTIpemEonrMDFq6XzwHYYgToXWj5eRX1OtY= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.5.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= @@ -93,12 +102,28 @@ github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJy github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af h1:6yITBqGTE2lEeTPG04SN9W+iWHCRyHqlVYILiSXziwk= github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af/go.mod h1:4F09kP5F+am0jAwlQLddpoMDM+iewkxxt6nxUQ5nq5o= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E= golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208 h1:qwRHBd0NqMbJxfbotnDhm2ByMI1Shq4Y6oRJo21SGJA= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -107,19 +132,47 @@ golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200413165638-669c56c373c4 h1:opSr2sbRXk5X5/givKrrKj9HXxFpW2sdCiP8MJSKLQY= golang.org/x/sys v0.0.0-20200413165638-669c56c373c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200731060945-b5fad4ed8dd6/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20201028153306-37f0764111ff h1:TU04fJ6/hxmk+6BeFPKM3iuCGqj0ep6ghDdEdhN1cnk= +golang.org/x/tools v0.0.0-20201028153306-37f0764111ff/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= +golang.org/x/tools v0.0.0-20201112171726-b38955972a18 h1:zCVX0Qx6zEiwi5lM2jprfSFA6i6GWMXmY8o0VxPyCfo= +golang.org/x/tools v0.0.0-20201112171726-b38955972a18/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools/gopls v0.5.2 h1:lyHTekqy0QhXzz5hDFnfMGHk0Qmuq+LWH5VN/o19YLk= +golang.org/x/tools/gopls v0.5.2/go.mod h1:Ye30ua0XTIpPhh5d9Mdz5ohQchW2pCnpwCj24FWNw9g= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/sourcemap.v1 v1.0.5 h1:inv58fC9f9J3TK2Y2R1NPntXEn3/wjWHkonhIUODNTI= gopkg.in/sourcemap.v1 v1.0.5/go.mod h1:2RlvNNSMglmRrcvhfuzp4hQHwOtjxlbjX7UPY/GXb78= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +honnef.co/go/tools v0.0.1-2020.1.5 h1:nI5egYTGJakVyOryqLs1cQO5dO0ksin5XXs2pspk75k= +honnef.co/go/tools v0.0.1-2020.1.5/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +mvdan.cc/gofumpt v0.0.0-20200802201014-ab5a8192947d h1:t8TAw9WgTLghti7RYkpPmqk4JtQ3+wcP5GgZqgWeWLQ= +mvdan.cc/gofumpt v0.0.0-20200802201014-ab5a8192947d/go.mod h1:bzrjFmaD6+xqohD3KYP0H2FEuxknnBmyyOxdhLdaIws= +mvdan.cc/xurls/v2 v2.2.0 h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A= +mvdan.cc/xurls/v2 v2.2.0/go.mod h1:EV1RMtya9D6G5DMYPGD8zTQzaHet6Jh8gFlRgGRJeO8= rsc.io/qr v0.2.0 h1:6vBLea5/NRMVTz8V66gipeLycZMl/+UlFmk8DvqQ6WY= rsc.io/qr v0.2.0/go.mod h1:IF+uZjkb9fqyeF/4tlBoynqmQxUoPfWEKh921coOuXs= diff --git a/shortcuts/shortcuts.go b/shortcuts/shortcuts.go index ac9ef655..dd9f9a6f 100644 --- a/shortcuts/shortcuts.go +++ b/shortcuts/shortcuts.go @@ -13,6 +13,7 @@ import ( "github.com/Bios-Marcel/cordless/config" "github.com/Bios-Marcel/cordless/tview" "github.com/Bios-Marcel/cordless/ui/tviewutil" + "github.com/Bios-Marcel/cordless/util/vim" ) var ( @@ -23,19 +24,41 @@ var ( channeltree = addScope("channeltree", "Channeltree", globalScope) QuoteSelectedMessage = addShortcut("quote_selected_message", "Quote selected message", - chatview, tcell.NewEventKey(tcell.KeyRune, 'q', tcell.ModNone)) + chatview, tcell.NewEventKey(tcell.KeyRune, 'q', tcell.ModNone), + addVimEvent(NullVimEvent,NullVimEvent,nil) + // Normal Insert Visual + ) + EditSelectedMessage = addShortcut("edit_selected_message", "Edit selected message", - chatview, tcell.NewEventKey(tcell.KeyRune, 'e', tcell.ModNone)) + chatview, tcell.NewEventKey(tcell.KeyRune, 'e', tcell.ModNone) + addVimEvent(NullVimEvent,nil,nil) + ) + DownloadMessageFiles = addShortcut("dowbload_message_files", "Download all files in selected message", - chatview, tcell.NewEventKey(tcell.KeyRune, 'd', tcell.ModNone)) + chatview, tcell.NewEventKey(tcell.KeyRune, 'd', tcell.ModNone) + addVimEvent(NullVimEvent,NullVimEvent,nil) + ) + ReplySelectedMessage = addShortcut("reply_selected_message", "Reply to author selected message", - chatview, tcell.NewEventKey(tcell.KeyRune, 'r', tcell.ModNone)) + chatview, tcell.NewEventKey(tcell.KeyRune, 'r', tcell.ModNone) + addVimEvent(NullVimEvent,NullVimEvent,nil) + ) + NewDirectMessage = addShortcut("new_direct_message", "Create a new direct message channel with this user", - chatview, tcell.NewEventKey(tcell.KeyRune, 'p', tcell.ModNone)) + chatview, tcell.NewEventKey(tcell.KeyRune, 'p', tcell.ModNone) + addVimEvent(NullVimEvent,NullVimEvent,tcell.KeyEnter) + ) + CopySelectedMessageLink = addShortcut("copy_selected_message_link", "Copy link to selected message", - chatview, tcell.NewEventKey(tcell.KeyRune, 'l', tcell.ModNone)) + chatview, tcell.NewEventKey(tcell.KeyRune, 'l', tcell.ModNone) + addVimEvent(NullVimEvent,NullVimEvent,nil) + ) + CopySelectedMessage = addShortcut("copy_selected_message", "Copy content of selected message", - chatview, tcell.NewEventKey(tcell.KeyRune, 'c', tcell.ModNone)) + chatview, tcell.NewEventKey(tcell.KeyRune, 'c', tcell.ModNone) + addVimEvent(NullVimEvent,NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'y', tcell.ModNone)) + ) + ToggleSelectedMessageSpoilers = addShortcut("toggle_selected_message_spoilers", "Toggle spoilers in selected message", chatview, tcell.NewEventKey(tcell.KeyRune, 's', tcell.ModNone)) DeleteSelectedMessage = addShortcut("delete_selected_message", "Delete the selected message", @@ -153,10 +176,28 @@ var ( ChannelTreeMarkRead = addShortcut("channel_mark_read", "Mark channel as read", channeltree, tcell.NewEventKey(tcell.KeyCtrlR, rune(tcell.KeyCtrlR), tcell.ModCtrl)) + scopes []*Scope Shortcuts []*Shortcut ) +// Vim event holds possible modifiers for keys. They can be nil. In that case, they will default +// to the original binding. If the event is associated to NullVimEvent, any events while in that mode +// will be ignored. +type VimEvent struct { + NormalEvent *tcell.EventKey + InsertEvent *tcell.EventKey + VisualEvent *tcell.EventKey +} + +// NullVimEvent is the null event for the current vim mode. Any events that have this constant will be ignored. +const NullVimEvent = -1 + +func addVimEvent(events *tcell.EventKey...) *VimEvent { + vimE := VimEvent{NormalEvent: events[0], InsertEvent: events[1], VisualEvent: events[2]} + return vimE +} + func addScope(identifier, name string, parent *Scope) *Scope { scope := &Scope{ Parent: parent, @@ -169,13 +210,14 @@ func addScope(identifier, name string, parent *Scope) *Scope { return scope } -func addShortcut(identifier, name string, scope *Scope, event *tcell.EventKey) *Shortcut { +func addShortcut(identifier, name string, scope *Scope, event *tcell.EventKey, vimEvent *VimEvent) *Shortcut { shortcut := &Shortcut{ Identifier: identifier, Name: name, Scope: scope, Event: event, defaultEvent: event, + VimModifier: vimEvent, } Shortcuts = append(Shortcuts, shortcut) @@ -200,6 +242,9 @@ type Shortcut struct { //This shortcuts default, in order to be able to reset it. defaultEvent *tcell.EventKey + + // VimModifier is the shortcut that will be used inside vim mode. + VimModifier VimEvent } // Equals compares the given EventKey with the Shortcuts Event. @@ -377,6 +422,21 @@ func Persist() error { func DirectionalFocusHandling(event *tcell.EventKey, app *tview.Application) *tcell.EventKey { focused := app.GetFocus() + if config.VimMode.CurrentMode == vim.NormalMode { + if VimFocusUp.Equals(event) { + tviewutil.FocusNextIfPossible(tview.Up, app, focused) + } else if VimFocusDown.Equals(event) { + tviewutil.FocusNextIfPossible(tview.Down, app, focused) + } else if VimFocusRight.Equals(event) { + tviewutil.FocusNextIfPossible(tview.Right, app, focused) + } else if VimFocusLeft.Equals(event) { + tviewutil.FocusNextIfPossible(tview.Left, app, focused) + } else { + return event + } + return nil + } + if FocusUp.Equals(event) { tviewutil.FocusNextIfPossible(tview.Up, app, focused) } else if FocusDown.Equals(event) { diff --git a/ui/window.go b/ui/window.go index 56683acc..ee6fd473 100644 --- a/ui/window.go +++ b/ui/window.go @@ -42,6 +42,7 @@ import ( "github.com/Bios-Marcel/cordless/ui/shortcutdialog" "github.com/Bios-Marcel/cordless/ui/tviewutil" "github.com/Bios-Marcel/cordless/util/maths" + "github.com/Bios-Marcel/cordless/util/vim" ) var ( @@ -91,6 +92,7 @@ type Window struct { bareChat bool activeView ActiveView + } type ActiveView bool From f0515f4153d8dd98f6a781849ce9b9fa23feb043 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=C3=A9rez?= Date: Sat, 14 Nov 2020 17:20:25 +0100 Subject: [PATCH 02/31] Added most of the new vim keys (needs rework) --- go.mod | 1 + go.sum | 113 +++++++++++++++++++ shortcuts/shortcuts.go | 246 ++++++++++++++++++++++++++++++++--------- util/vim/vim.go | 44 ++++++++ 4 files changed, 353 insertions(+), 51 deletions(-) create mode 100644 util/vim/vim.go diff --git a/go.mod b/go.mod index ca8cb417..bc5c6386 100644 --- a/go.mod +++ b/go.mod @@ -11,6 +11,7 @@ require ( github.com/Bios-Marcel/shortnotforlong v1.1.1 github.com/alecthomas/chroma v0.7.3 github.com/atotto/clipboard v0.1.2 + github.com/bunyk/gokeybr v0.0.0-20201019133936-f9e4ed3fdc5d // indirect github.com/gdamore/tcell/v2 v2.0.0 github.com/gen2brain/beeep v0.0.0-20200526185328-e9c15c258e28 github.com/google/go-github/v29 v29.0.3 diff --git a/go.sum b/go.sum index 3d79933d..2089efb6 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,4 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/Bios-Marcel/discordemojimap v1.0.1 h1:b3UYPO7+h1+ciStkwU/KQCerOmpUNPHsBf4a7EjMdys= github.com/Bios-Marcel/discordemojimap v1.0.1/go.mod h1:AoHIpUwf3EVCAAUmk+keXjb9khyZcFnW84/rhJd4IkU= github.com/Bios-Marcel/discordgo v0.21.2-0.20201025194456-7046b5509389 h1:Ha9AEp9HwOZElVwWWiA/aYU4g6dOYwJIhnxYf8XsNSo= @@ -8,6 +9,7 @@ github.com/Bios-Marcel/shortnotforlong v1.1.1 h1:cCJIp6MODd4rwH5Y+fAMAaIuFxS1FPK github.com/Bios-Marcel/shortnotforlong v1.1.1/go.mod h1:g6bFiwq0pq7pqENRgHiCZu7uMzeYPIXwANlaBQ47LBw= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38 h1:smF2tmSOzy2Mm+0dGI2AIUHY+w0BUc+4tn40djz7+6U= github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38/go.mod h1:r7bzyVFMNntcxPZXK3/+KdruV1H5KSlyVY0gc+NgInI= github.com/alecthomas/chroma v0.7.3 h1:NfdAERMy+esYQs8OXk0I868/qDxxCEo7FMz1WIqMAeI= @@ -17,26 +19,59 @@ github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721/go.mod h1:QO9JBo github.com/alecthomas/kong v0.2.4/go.mod h1:kQOmtJgV+Lb4aj+I2LEn40cbtawdWJ9Y8QLq+lElKxE= github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897 h1:p9Sln00KOTlrYkxI1zYWl1QLnEqAqEARBEYa8FQnQcY= github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/atotto/clipboard v0.1.2 h1:YZCtFu5Ie8qX2VmVTBnrqLSiU9XOWwqNRmdT3gIQzbY= github.com/atotto/clipboard v0.1.2/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/bunyk/gokeybr v0.0.0-20201019133936-f9e4ed3fdc5d h1:GHWeoxIZZKoGykRh+MFh26awQ3w7LASUfflaMO9nobw= +github.com/bunyk/gokeybr v0.0.0-20201019133936-f9e4ed3fdc5d/go.mod h1:QoGx25FILnr4IxmvRiDOP8s41BaxhLKlxoBVU9suyRU= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 h1:y5HC9v93H5EPKqaS1UYVg1uYah5Xf51mBfIoWehClUQ= github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9hchkHSWYkEqJwUGisez3G1QY8Ryz0sdWrLPMGjLk= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dlclark/regexp2 v1.2.0 h1:8sAhBGEM0dRWogWqWyQeIJnxjWO6oIjl8FKqREDsGfk= github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko= github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg= +github.com/gdamore/tcell/v2 v2.0.0-dev/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA= github.com/gdamore/tcell/v2 v2.0.0 h1:GRWG8aLfWAlekj9Q6W29bVvkHENc6hp79XOqG4AWDOs= github.com/gdamore/tcell/v2 v2.0.0/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA= github.com/gen2brain/beeep v0.0.0-20200526185328-e9c15c258e28 h1:M2Zt3G2w6Q57GZndOYk42p7RvMeO8izO8yKTfIxGqxA= github.com/gen2brain/beeep v0.0.0-20200526185328-e9c15c258e28/go.mod h1:ElSskYZe3oM8kThaHGJ+kiN2yyUMVXMZ7WxF9QqLDS8= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4 h1:qZNfIGkIANxGv/OqtnntR4DfOY2+BgwR60cAcu/i3SE= github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4/go.mod h1:kW3HQ4UdaAyrUCSSDR4xUzBKW6O2iA4uHhk7AtyYp10= github.com/godbus/dbus/v5 v5.0.3 h1:ZqHaoEF7TBzh4jzPmqVhE/5A1z9of6orkAe5uHoAeME= github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.5.1 h1:JFrFEBb2xKufg6XkJsJr+WbKb4FQlURi5RUcBveYu9k= github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-github/v29 v29.0.3 h1:IktKCTwU//aFHnpA+2SLIi7Oo9uhAzgsdZNbcAqhgdc= @@ -48,9 +83,21 @@ github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c h1:16eHWuMGvCjSf github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherwasm v1.1.0 h1:fA2uLoctU5+T3OhOn2vYP0DVT6pxc7xhTlBB1paATqQ= github.com/gopherjs/gopherwasm v1.1.0/go.mod h1:SkZ8z7CWBz5VXbhJel8TxCmAcsQqzgWGR/8nMhyhZSI= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -58,6 +105,7 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac= github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= @@ -68,32 +116,63 @@ github.com/mattn/go-runewidth v0.0.7 h1:Ei8KR0497xHyKJPAv59M1dkC+rOZCMBJ+t3fZ+tw github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mdp/qrterminal v1.0.1 h1:07+fzVDlPuBlXS8tB0ktTAyf+Lp1j2+2zK3fBOL5b7c= github.com/mdp/qrterminal v1.0.1/go.mod h1:Z33WhxQe9B6CdW37HaVqcRKzP+kByF3q/qLxOGe12xQ= github.com/mdp/qrterminal/v3 v3.0.0 h1:ywQqLRBXWTktytQNDKFjhAvoGkLVN3J2tAFZ0kMd9xQ= github.com/mdp/qrterminal/v3 v3.0.0/go.mod h1:NJpfAs7OAm77Dy8EkWrtE4aq+cE6McoLXlBqXQEwvE0= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rivo/uniseg v0.1.0 h1:+2KBaVoUmb9XzDsrx/Ct0W/EYOSFf/nWTauy++DprtY= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/robertkrimen/otto v0.0.0-20200922221731-ef014fd054ac h1:kYPjbEN6YPYWWHI6ky1J813KzIq/8+Wg4TO4xU7A/KU= github.com/robertkrimen/otto v0.0.0-20200922221731-ef014fd054ac/go.mod h1:xvqspoSXJTIpemEonrMDFq6XzwHYYgToXWj5eRX1OtY= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.5.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 h1:JIAuq3EEf9cgbU6AtGPK4CTG3Zf6CKMNqf0MHTggAUA= github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v1.0.0 h1:6m/oheQuQ13N9ks4hubMG6BnvwOeaJrqSPLahSnczz8= +github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= @@ -102,28 +181,50 @@ github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJy github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af h1:6yITBqGTE2lEeTPG04SN9W+iWHCRyHqlVYILiSXziwk= github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af/go.mod h1:4F09kP5F+am0jAwlQLddpoMDM+iewkxxt6nxUQ5nq5o= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E= golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208 h1:qwRHBd0NqMbJxfbotnDhm2ByMI1Shq4Y6oRJo21SGJA= golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -141,7 +242,11 @@ golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200731060945-b5fad4ed8dd6/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= @@ -157,17 +262,25 @@ golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8T golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/sourcemap.v1 v1.0.5 h1:inv58fC9f9J3TK2Y2R1NPntXEn3/wjWHkonhIUODNTI= gopkg.in/sourcemap.v1 v1.0.5/go.mod h1:2RlvNNSMglmRrcvhfuzp4hQHwOtjxlbjX7UPY/GXb78= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2020.1.5 h1:nI5egYTGJakVyOryqLs1cQO5dO0ksin5XXs2pspk75k= honnef.co/go/tools v0.0.1-2020.1.5/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= mvdan.cc/gofumpt v0.0.0-20200802201014-ab5a8192947d h1:t8TAw9WgTLghti7RYkpPmqk4JtQ3+wcP5GgZqgWeWLQ= diff --git a/shortcuts/shortcuts.go b/shortcuts/shortcuts.go index dd9f9a6f..4914daae 100644 --- a/shortcuts/shortcuts.go +++ b/shortcuts/shortcuts.go @@ -34,14 +34,15 @@ var ( addVimEvent(NullVimEvent,nil,nil) ) - DownloadMessageFiles = addShortcut("dowbload_message_files", "Download all files in selected message", + DownloadMessageFiles = addShortcut("download_message_files", "Download all files in selected message", chatview, tcell.NewEventKey(tcell.KeyRune, 'd', tcell.ModNone) - addVimEvent(NullVimEvent,NullVimEvent,nil) + // FIXME solve delete messages keybinding conflict in visual mode + addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent) ) ReplySelectedMessage = addShortcut("reply_selected_message", "Reply to author selected message", chatview, tcell.NewEventKey(tcell.KeyRune, 'r', tcell.ModNone) - addVimEvent(NullVimEvent,NullVimEvent,nil) + addVimEvent(nil,NullVimEvent,NullVimEvent) ) NewDirectMessage = addShortcut("new_direct_message", "Create a new direct message channel with this user", @@ -60,59 +61,136 @@ var ( ) ToggleSelectedMessageSpoilers = addShortcut("toggle_selected_message_spoilers", "Toggle spoilers in selected message", - chatview, tcell.NewEventKey(tcell.KeyRune, 's', tcell.ModNone)) + chatview, tcell.NewEventKey(tcell.KeyRune, 's', tcell.ModNone) + addVimEvent(NullVimEvent,NullVimEvent,nil) + ) + DeleteSelectedMessage = addShortcut("delete_selected_message", "Delete the selected message", - chatview, tcell.NewEventKey(tcell.KeyDelete, 0, tcell.ModNone)) + chatview, tcell.NewEventKey(tcell.KeyDelete, 0, tcell.ModNone) + addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'd', tcell.ModNone)) + ) + ViewSelectedMessageImages = addShortcut("view_selected_message_images", "View selected message's attached files", - chatview, tcell.NewEventKey(tcell.KeyRune, 'o', tcell.ModNone)) + chatview, tcell.NewEventKey(tcell.KeyRune, 'o', tcell.ModNone) + addVimEvent(NullVimEvent, NullVimEvent, nil) + ) + ChatViewSelectionUp = addShortcut("selection_up", "Move selection up by one", - chatview, tcell.NewEventKey(tcell.KeyUp, 0, tcell.ModNone)) + chatview, tcell.NewEventKey(tcell.KeyUp, 0, tcell.ModNone) + addVimEvent(NullVimEvent,NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'k', tcell.ModNone)) + ) + ChatViewSelectionDown = addShortcut("selection_down", "Move selection down by one", - chatview, tcell.NewEventKey(tcell.KeyDown, 0, tcell.ModNone)) + chatview, tcell.NewEventKey(tcell.KeyDown, 0, tcell.ModNone) + addVimEvent(NullVimEvent,NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'j', tcell.ModNone)) + ) + ChatViewSelectionTop = addShortcut("selection_top", "Move selection to the upmost message", - chatview, tcell.NewEventKey(tcell.KeyHome, 0, tcell.ModNone)) + chatview, tcell.NewEventKey(tcell.KeyHome, 0, tcell.ModNone) + addVimEvent(NullVimEvent,NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'g', tcell.ModNone)) + ) + ChatViewSelectionBottom = addShortcut("selection_bottom", "Move selection to the downmost message", - chatview, tcell.NewEventKey(tcell.KeyEnd, 0, tcell.ModNone)) + chatview, tcell.NewEventKey(tcell.KeyEnd, 0, tcell.ModNone) + addVimEvent(NullVimEvent,NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'G', tcell.ModNone)) + ) + // START OF INPUT ExpandSelectionToLeft = addShortcut("expand_selection_word_to_left", "Expand selection word to left", - multilineTextInput, tcell.NewEventKey(tcell.KeyLeft, 0, tcell.ModShift)) + multilineTextInput, tcell.NewEventKey(tcell.KeyLeft, 0, tcell.ModShift) + addVimEvent(NullVimEvent,NullVimEvent,nil) + ) + ExpandSelectionToRight = addShortcut("expand_selection_word_to_right", "Expand selection word to right", - multilineTextInput, tcell.NewEventKey(tcell.KeyRight, 0, tcell.ModShift)) + multilineTextInput, tcell.NewEventKey(tcell.KeyRight, 0, tcell.ModShift) + addVimEvent(NullVimEvent,NullVimEvent,nil) + ) + SelectAll = addShortcut("select_all", "Select all", - multilineTextInput, tcell.NewEventKey(tcell.KeyCtrlA, rune(tcell.KeyCtrlA), tcell.ModCtrl)) + multilineTextInput, tcell.NewEventKey(tcell.KeyCtrlA, rune(tcell.KeyCtrlA), tcell.ModCtrl) + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'v', tcell.ModNone),NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'V', tcell.ModNone)) + ) + SelectWordLeft = addShortcut("select_word_to_left", "Select word to left", - multilineTextInput, tcell.NewEventKey(tcell.KeyLeft, 0, tcell.ModCtrl|tcell.ModShift)) + multilineTextInput, tcell.NewEventKey(tcell.KeyLeft, 0, tcell.ModCtrl|tcell.ModShift) + addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'b', tcell.ModNone)) + ) + SelectWordRight = addShortcut("select_word_to_right", "Select word to right", - multilineTextInput, tcell.NewEventKey(tcell.KeyRight, 0, tcell.ModCtrl|tcell.ModShift)) + multilineTextInput, tcell.NewEventKey(tcell.KeyRight, 0, tcell.ModCtrl|tcell.ModShift) + addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'w', tcell.ModNone)) + ) + + // TODO create a way to store keys making multi key commands like yw, di or y$ SelectToStartOfLine = addShortcut("select_to_start_of_line", "Select to start of line", - multilineTextInput, tcell.NewEventKey(tcell.KeyHome, 0, tcell.ModShift)) + multilineTextInput, tcell.NewEventKey(tcell.KeyHome, 0, tcell.ModShift) + addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, '0', tcell.ModNone)) + ) + SelectToEndOfLine = addShortcut("select_to_end_of_line", "Select to end of line", - multilineTextInput, tcell.NewEventKey(tcell.KeyEnd, 0, tcell.ModShift)) + multilineTextInput, tcell.NewEventKey(tcell.KeyEnd, 0, tcell.ModShift) + addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, '$', tcell.ModNone)) + ) + SelectToStartOfText = addShortcut("select_to_start_of_text", "Select to start of text", - multilineTextInput, tcell.NewEventKey(tcell.KeyHome, 0, tcell.ModCtrl|tcell.ModShift)) + multilineTextInput, tcell.NewEventKey(tcell.KeyHome, 0, tcell.ModCtrl|tcell.ModShift) + addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'g', tcell.ModNone)) + ) + SelectToEndOfText = addShortcut("select_to_end_of_text", "Select to end of text", - multilineTextInput, tcell.NewEventKey(tcell.KeyEnd, 0, tcell.ModCtrl|tcell.ModShift)) + multilineTextInput, tcell.NewEventKey(tcell.KeyEnd, 0, tcell.ModCtrl|tcell.ModShift) + addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'G', tcell.ModNone)) + ) MoveCursorLeft = addShortcut("move_cursor_to_left", "Move cursor to left", - multilineTextInput, tcell.NewEventKey(tcell.KeyLeft, 0, tcell.ModNone)) + multilineTextInput, tcell.NewEventKey(tcell.KeyLeft, 0, tcell.ModNone) + // Normal mode should exclude cursor movement, instead that should be managed by visual mode. + // For container movement, see directional focus. + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'h', tcell.ModNone),NullVimEvent,NullVimEvent) + ) + MoveCursorRight = addShortcut("move_cursor_to_right", "Move cursor to right", - multilineTextInput, tcell.NewEventKey(tcell.KeyRight, 0, tcell.ModNone)) + multilineTextInput, tcell.NewEventKey(tcell.KeyRight, 0, tcell.ModNone) + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'l', tcell.ModNone),NullVimEvent,NullVimEvent) + ) + MoveCursorWordLeft = addShortcut("move_cursor_to_word_left", "Move cursor to word left", - multilineTextInput, tcell.NewEventKey(tcell.KeyLeft, 0, tcell.ModCtrl)) + multilineTextInput, tcell.NewEventKey(tcell.KeyLeft, 0, tcell.ModCtrl) + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'b', tcell.ModNone),NullVimEvent,NullVimEvent) + ) + MoveCursorWordRight = addShortcut("move_cursor_to_word_right", "Move cursor to word right", - multilineTextInput, tcell.NewEventKey(tcell.KeyRight, 0, tcell.ModCtrl)) + multilineTextInput, tcell.NewEventKey(tcell.KeyRight, 0, tcell.ModCtrl) + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'w', tcell.ModNone),NullVimEvent,NullVimEvent) + ) + MoveCursorStartOfLine = addShortcut("move_cursor_to_start_of_line", "Move cursor to start of line", - multilineTextInput, tcell.NewEventKey(tcell.KeyHome, 0, tcell.ModNone)) + multilineTextInput, tcell.NewEventKey(tcell.KeyHome, 0, tcell.ModNone) + addVimEvent(tcell.NewEventKey(tcell.KeyRune, '0', tcell.ModNone),NullVimEvent,NullVimEvent) + ) + MoveCursorEndOfLine = addShortcut("move_cursor_to_end_of_line", "Move cursor to end of line", - multilineTextInput, tcell.NewEventKey(tcell.KeyEnd, 0, tcell.ModNone)) + multilineTextInput, tcell.NewEventKey(tcell.KeyEnd, 0, tcell.ModNone) + addVimEvent(tcell.NewEventKey(tcell.KeyRune, '$', tcell.ModNone),NullVimEvent,NullVimEvent) + ) + MoveCursorStartOfText = addShortcut("move_cursor_to_start_of_text", "Move cursor to start of text", - multilineTextInput, tcell.NewEventKey(tcell.KeyHome, 0, tcell.ModCtrl)) + multilineTextInput, tcell.NewEventKey(tcell.KeyHome, 0, tcell.ModCtrl) + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'g', tcell.ModNone),NullVimEvent,NullVimEvent) + ) + MoveCursorEndOfText = addShortcut("move_cursor_to_end_of_text", "Move cursor to end of text", - multilineTextInput, tcell.NewEventKey(tcell.KeyEnd, 0, tcell.ModCtrl)) + multilineTextInput, tcell.NewEventKey(tcell.KeyEnd, 0, tcell.ModCtrl) + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'G', tcell.ModNone),NullVimEvent,NullVimEvent) + ) + + // FIXME Gotta add this later, as there is Backspace and Backspace and those differ on linux. // DeleteLeft = addShortcut("delete_left","Delete left",multilineTextInput,tcell.NewEventKey(tcell.KeyBackspace2, rune(tcell.KeyBackspace2), tcell.ModNone)) + // TODO section + DeleteRight = addShortcut("delete_right", "Delete right", multilineTextInput, tcell.NewEventKey(tcell.KeyDelete, 0, tcell.ModNone)) DeleteWordLeft = addShortcut("delete_word_left", "Delete word left", @@ -120,61 +198,119 @@ var ( InputNewLine = addShortcut("add_new_line_character", "Add new line character", multilineTextInput, tcell.NewEventKey(tcell.KeyEnter, rune(tcell.KeyEnter), tcell.ModAlt)) + CopySelection = addShortcut("copy_selection", "Copy selected text", - multilineTextInput, tcell.NewEventKey(tcell.KeyRune, 'C', tcell.ModAlt)) - //Don't fix the typo, it'll break stuff ;) + multilineTextInput, tcell.NewEventKey(tcell.KeyRune, 'C', tcell.ModAlt) + addVimEvent(NullVimEvent,NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'y', tcell.ModNone)) + ) + //Don't fix the typo, it'll break stuff ;) ---- (glups) PasteAtSelection = addShortcut("paste_at_selectiom", "Paste clipboard content", - multilineTextInput, tcell.NewEventKey(tcell.KeyCtrlV, rune(tcell.KeyCtrlV), tcell.ModCtrl)) + multilineTextInput, tcell.NewEventKey(tcell.KeyCtrlV, rune(tcell.KeyCtrlV), tcell.ModCtrl) + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'p',tcell.ModNone),NullVimEvent,NullVimEvent) + ) SendMessage = addShortcut("send_message", "Sends the typed message", - multilineTextInput, tcell.NewEventKey(tcell.KeyEnter, rune(tcell.KeyEnter), tcell.ModNone)) + multilineTextInput, tcell.NewEventKey(tcell.KeyEnter, rune(tcell.KeyEnter), tcell.ModNone) + addVimEvent(NullVimEvent,nil,nil) + ) AddNewLineInCodeBlock = addShortcut("add_new_line_in_code_block", "Adds a new line inside a code block", - multilineTextInput, tcell.NewEventKey(tcell.KeyEnter, rune(tcell.KeyEnter), tcell.ModNone)) + multilineTextInput, tcell.NewEventKey(tcell.KeyEnter, rune(tcell.KeyEnter), tcell.ModNone) + addVimEvent(NullVimEvent,nil,NullVimEvent) + ) ExitApplication = addShortcut("exit_application", "Exit application", - globalScope, tcell.NewEventKey(tcell.KeyCtrlC, rune(tcell.KeyCtrlC), tcell.ModCtrl)) + globalScope, tcell.NewEventKey(tcell.KeyCtrlC, rune(tcell.KeyCtrlC), tcell.ModCtrl) + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'q', tcell.ModNone),NullVimEvent,NullVimEvent) + ) FocusUp = addShortcut("focus_up", "Focus the next widget above", - globalScope, tcell.NewEventKey(tcell.KeyUp, 0, tcell.ModAlt)) + globalScope, tcell.NewEventKey(tcell.KeyUp, 0, tcell.ModAlt) + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'k', tcell.ModNone),NullVimEvent,NullVimEvent) + ) + FocusDown = addShortcut("focus_down", "Focus the next widget below", - globalScope, tcell.NewEventKey(tcell.KeyDown, 0, tcell.ModAlt)) + globalScope, tcell.NewEventKey(tcell.KeyDown, 0, tcell.ModAlt) + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'j', tcell.ModNone),NullVimEvent,NullVimEvent) + ) + FocusLeft = addShortcut("focus_left", "Focus the next widget to the left", - globalScope, tcell.NewEventKey(tcell.KeyLeft, 0, tcell.ModAlt)) + globalScope, tcell.NewEventKey(tcell.KeyLeft, 0, tcell.ModAlt) + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'h', tcell.ModNone),NullVimEvent,NullVimEvent) + ) + FocusRight = addShortcut("focus_right", "Focus the next widget to the right", - globalScope, tcell.NewEventKey(tcell.KeyRight, 0, tcell.ModAlt)) + globalScope, tcell.NewEventKey(tcell.KeyRight, 0, tcell.ModAlt) + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'l', tcell.ModNone),NullVimEvent,NullVimEvent) + ) FocusChannelContainer = addShortcut("focus_channel_container", "Focus channel container", - globalScope, tcell.NewEventKey(tcell.KeyRune, 'c', tcell.ModAlt)) + globalScope, tcell.NewEventKey(tcell.KeyRune, 'c', tcell.ModAlt) + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'c', tcell.ModNone),NullVimEvent,NullVimEvent) + ) + FocusUserContainer = addShortcut("focus_user_container", "Focus user container", - globalScope, tcell.NewEventKey(tcell.KeyRune, 'u', tcell.ModAlt)) + globalScope, tcell.NewEventKey(tcell.KeyRune, 'u', tcell.ModAlt) + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'u', tcell.ModNone),NullVimEvent,NullVimEvent) + ) + FocusGuildContainer = addShortcut("focus_guild_container", "Focus guild container", - globalScope, tcell.NewEventKey(tcell.KeyRune, 's', tcell.ModAlt)) + globalScope, tcell.NewEventKey(tcell.KeyRune, 's', tcell.ModAlt) + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 's', tcell.ModNone),NullVimEvent,NullVimEvent) + ) + FocusPrivateChatPage = addShortcut("focus_private_chat_page", "Focus private chat page", - globalScope, tcell.NewEventKey(tcell.KeyRune, 'p', tcell.ModAlt)) + globalScope, tcell.NewEventKey(tcell.KeyRune, 'p', tcell.ModAlt) + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'p', tcell.ModNone),NullVimEvent,NullVimEvent) + ) + SwitchToPreviousChannel = addShortcut("switch_to_previous_channel", "Switch to previous channel", - globalScope, tcell.NewEventKey(tcell.KeyRune, 'l', tcell.ModAlt)) + globalScope, tcell.NewEventKey(tcell.KeyRune, 'l', tcell.ModAlt) + // FIXME unbound + addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent) + ) + FocusMessageInput = addShortcut("focus_message_input", "Focus message input", - globalScope, tcell.NewEventKey(tcell.KeyRune, 'm', tcell.ModAlt)) + globalScope, tcell.NewEventKey(tcell.KeyRune, 'm', tcell.ModAlt) + // Toggle insert mode + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'i', tcell.ModNone),NullVimEvent,NullVimEvent) + ) + FocusMessageContainer = addShortcut("focus_message_container", "Focus message container", - globalScope, tcell.NewEventKey(tcell.KeyRune, 't', tcell.ModAlt)) + globalScope, tcell.NewEventKey(tcell.KeyRune, 't', tcell.ModAlt) + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 't', tcell.ModNone),NullVimEvent,NullVimEvent) + ) + FocusCommandInput = addShortcut("focus_command_input", "Focus command input", - globalScope, nil) + globalScope, nil, addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent)) FocusCommandOutput = addShortcut("focus_command_output", "Focus command output", - globalScope, nil) + globalScope, nil, addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent)) ToggleUserContainer = addShortcut("toggle_user_container", "Toggle user container", - globalScope, tcell.NewEventKey(tcell.KeyRune, 'U', tcell.ModAlt)) + globalScope, tcell.NewEventKey(tcell.KeyRune, 'U', tcell.ModAlt) + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'U', tcell.ModNone),NullVimEvent,NullVimEvent) + ) + ToggleCommandView = addShortcut("toggle_command_view", "Toggle command view", - globalScope, tcell.NewEventKey(tcell.KeyRune, '.', tcell.ModAlt)) + globalScope, tcell.NewEventKey(tcell.KeyRune, '.', tcell.ModAlt) + addVimEvent(tcell.NewEventKey(tcell.KeyRune, ':', tcell.ModNone),NullVimEvent,NullVimEvent) + ) + ToggleBareChat = addShortcut("toggle_bare_chat", "Toggle bare chat", - globalScope, tcell.NewEventKey(tcell.KeyCtrlB, rune(tcell.KeyCtrlB), tcell.ModCtrl)) + globalScope, tcell.NewEventKey(tcell.KeyCtrlB, rune(tcell.KeyCtrlB), tcell.ModCtrl) + // FIXME unknown binding + addVimEvent(nil,NullVimEvent,NullVimEvent) + ) GuildListMarkRead = addShortcut("guild_mark_read", "Mark server as read", - guildlist, tcell.NewEventKey(tcell.KeyCtrlR, rune(tcell.KeyCtrlR), tcell.ModCtrl)) + guildlist, tcell.NewEventKey(tcell.KeyCtrlR, rune(tcell.KeyCtrlR), tcell.ModCtrl) + addVimEvent(NullVimEvent,NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'm', tcell.ModNone)) + ) ChannelTreeMarkRead = addShortcut("channel_mark_read", "Mark channel as read", - channeltree, tcell.NewEventKey(tcell.KeyCtrlR, rune(tcell.KeyCtrlR), tcell.ModCtrl)) + channeltree, tcell.NewEventKey(tcell.KeyCtrlR, rune(tcell.KeyCtrlR), tcell.ModCtrl) + addVimEvent(NullVimEvent,NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'm', tcell.ModNone)) + ) scopes []*Scope @@ -198,6 +334,14 @@ func addVimEvent(events *tcell.EventKey...) *VimEvent { return vimE } +// func createMask(runes rune...) int { +// mask := 0 +// for _, r := range runes { +// mask = mask&tcell.NewEventKey(tcell.KeyRune, r, tcell.ModNone) +// } +// return mask +// } + func addScope(identifier, name string, parent *Scope) *Scope { scope := &Scope{ Parent: parent, diff --git a/util/vim/vim.go b/util/vim/vim.go new file mode 100644 index 00000000..72399bf0 --- /dev/null +++ b/util/vim/vim.go @@ -0,0 +1,44 @@ +package vim + +const ( + // NormalMode : every key is interpreted as focus movement, + // let it be from containers or text lines. + NormalMode int = iota // 0 + // InsertMode : every key is sent to the program as normal, + // such as input boxes. + InsertMode // 1 + // TODO + VisualMode // 2 +) + +// Vim stores information about vim-mode, such as +// current mode. +type Vim struct { + CurrentMode int +} + +// SetMode sets new vim mode. If provided mode falls out +// the defined range 0-2 it will fall back to normal mode. +func (v *Vim) SetMode(mode int) { + if mode < 0 || mode > 2 { + // fallback + v.CurrentMode = NormalMode + return + } + v.CurrentMode = mode +} + +// CurrentModeString returns a stringified version +// of the current mode. (Useful for visual feedback to user) +func (v *Vim) CurrentModeString() string { + switch v.CurrentMode { + case NormalMode: + return "Normal" + case InsertMode: + return "Insert" + case VisualMode: + return "Visual" + default: + return "Err" + } +} From a15d76c95969b97af9e32d64c1d9dc70044a97dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=C3=A9rez?= Date: Sun, 15 Nov 2020 21:29:22 +0100 Subject: [PATCH 03/31] Partially working vim movements. Cannot get ESC key to work. --- config/config.go | 2 +- shortcuts/shortcuts.go | 281 ++++++++++++++++++++++------------------- ui/editor.go | 12 ++ ui/window.go | 39 +++++- util/vim/vim.go | 33 ++++- 5 files changed, 235 insertions(+), 132 deletions(-) diff --git a/config/config.go b/config/config.go index 4a005d02..b949d3ae 100644 --- a/config/config.go +++ b/config/config.go @@ -214,7 +214,7 @@ func createDefaultConfig() *Config { FileOpenHandlers: make(map[string]string), FileOpenSaveFilesPermanently: false, FileDownloadSaveLocation: "~/Downloads", - VimMode: vim.Vim{}, + VimMode: &vim.Vim{CurrentMode: vim.Disabled}, } } diff --git a/shortcuts/shortcuts.go b/shortcuts/shortcuts.go index 4914daae..751d5125 100644 --- a/shortcuts/shortcuts.go +++ b/shortcuts/shortcuts.go @@ -14,6 +14,7 @@ import ( "github.com/Bios-Marcel/cordless/tview" "github.com/Bios-Marcel/cordless/ui/tviewutil" "github.com/Bios-Marcel/cordless/util/vim" + //"github.com/Bios-Marcel/cordless/util/vim" ) var ( @@ -23,165 +24,167 @@ var ( guildlist = addScope("guildlist", "Guildlist", globalScope) channeltree = addScope("channeltree", "Channeltree", globalScope) + // Normal mode will always prevail in any scope. To go to parent scope press ESC. If you are inside + // insert or visual mode, pressing ESC will only return to normal mode in the same scope you were in. + // + // A nil VimEvent means the original non-vim key will be used. QuoteSelectedMessage = addShortcut("quote_selected_message", "Quote selected message", chatview, tcell.NewEventKey(tcell.KeyRune, 'q', tcell.ModNone), - addVimEvent(NullVimEvent,NullVimEvent,nil) + addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent), // Normal Insert Visual ) EditSelectedMessage = addShortcut("edit_selected_message", "Edit selected message", - chatview, tcell.NewEventKey(tcell.KeyRune, 'e', tcell.ModNone) - addVimEvent(NullVimEvent,nil,nil) + chatview, tcell.NewEventKey(tcell.KeyRune, 'e', tcell.ModNone), + addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent), ) DownloadMessageFiles = addShortcut("download_message_files", "Download all files in selected message", - chatview, tcell.NewEventKey(tcell.KeyRune, 'd', tcell.ModNone) + chatview, tcell.NewEventKey(tcell.KeyRune, 'd', tcell.ModNone), // FIXME solve delete messages keybinding conflict in visual mode - addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent) + addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent), ) ReplySelectedMessage = addShortcut("reply_selected_message", "Reply to author selected message", - chatview, tcell.NewEventKey(tcell.KeyRune, 'r', tcell.ModNone) - addVimEvent(nil,NullVimEvent,NullVimEvent) + chatview, tcell.NewEventKey(tcell.KeyRune, 'r', tcell.ModNone), + addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent), ) NewDirectMessage = addShortcut("new_direct_message", "Create a new direct message channel with this user", - chatview, tcell.NewEventKey(tcell.KeyRune, 'p', tcell.ModNone) - addVimEvent(NullVimEvent,NullVimEvent,tcell.KeyEnter) + chatview, tcell.NewEventKey(tcell.KeyRune, 'p', tcell.ModNone), + addVimEvent(tcell.NewEventKey(tcell.KeyEnter,rune(tcell.KeyEnter),tcell.ModNone),NullVimEvent,NullVimEvent), ) CopySelectedMessageLink = addShortcut("copy_selected_message_link", "Copy link to selected message", - chatview, tcell.NewEventKey(tcell.KeyRune, 'l', tcell.ModNone) - addVimEvent(NullVimEvent,NullVimEvent,nil) + chatview, tcell.NewEventKey(tcell.KeyRune, 'l', tcell.ModNone), + addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent), ) CopySelectedMessage = addShortcut("copy_selected_message", "Copy content of selected message", - chatview, tcell.NewEventKey(tcell.KeyRune, 'c', tcell.ModNone) - addVimEvent(NullVimEvent,NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'y', tcell.ModNone)) + chatview, tcell.NewEventKey(tcell.KeyRune, 'c', tcell.ModNone), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'y', tcell.ModNone),NullVimEvent,NullVimEvent), ) ToggleSelectedMessageSpoilers = addShortcut("toggle_selected_message_spoilers", "Toggle spoilers in selected message", - chatview, tcell.NewEventKey(tcell.KeyRune, 's', tcell.ModNone) - addVimEvent(NullVimEvent,NullVimEvent,nil) + chatview, tcell.NewEventKey(tcell.KeyRune, 's', tcell.ModNone), + addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent), ) DeleteSelectedMessage = addShortcut("delete_selected_message", "Delete the selected message", - chatview, tcell.NewEventKey(tcell.KeyDelete, 0, tcell.ModNone) - addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'd', tcell.ModNone)) + chatview, tcell.NewEventKey(tcell.KeyDelete, 0, tcell.ModNone), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'd', tcell.ModNone),NullVimEvent,NullVimEvent), ) ViewSelectedMessageImages = addShortcut("view_selected_message_images", "View selected message's attached files", - chatview, tcell.NewEventKey(tcell.KeyRune, 'o', tcell.ModNone) - addVimEvent(NullVimEvent, NullVimEvent, nil) + chatview, tcell.NewEventKey(tcell.KeyRune, 'o', tcell.ModNone), + addVimEvent(NullVimEvent, NullVimEvent, NullVimEvent), ) ChatViewSelectionUp = addShortcut("selection_up", "Move selection up by one", - chatview, tcell.NewEventKey(tcell.KeyUp, 0, tcell.ModNone) - addVimEvent(NullVimEvent,NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'k', tcell.ModNone)) + chatview, tcell.NewEventKey(tcell.KeyUp, 0, tcell.ModNone), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'k', tcell.ModNone),NullVimEvent,NullVimEvent), ) ChatViewSelectionDown = addShortcut("selection_down", "Move selection down by one", - chatview, tcell.NewEventKey(tcell.KeyDown, 0, tcell.ModNone) - addVimEvent(NullVimEvent,NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'j', tcell.ModNone)) + chatview, tcell.NewEventKey(tcell.KeyDown, 0, tcell.ModNone), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'j', tcell.ModNone),NullVimEvent,NullVimEvent), ) ChatViewSelectionTop = addShortcut("selection_top", "Move selection to the upmost message", - chatview, tcell.NewEventKey(tcell.KeyHome, 0, tcell.ModNone) - addVimEvent(NullVimEvent,NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'g', tcell.ModNone)) + chatview, tcell.NewEventKey(tcell.KeyHome, 0, tcell.ModNone), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'g', tcell.ModNone),NullVimEvent,NullVimEvent), ) ChatViewSelectionBottom = addShortcut("selection_bottom", "Move selection to the downmost message", - chatview, tcell.NewEventKey(tcell.KeyEnd, 0, tcell.ModNone) - addVimEvent(NullVimEvent,NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'G', tcell.ModNone)) + chatview, tcell.NewEventKey(tcell.KeyEnd, 0, tcell.ModNone), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'G', tcell.ModNone),NullVimEvent,NullVimEvent), ) // START OF INPUT ExpandSelectionToLeft = addShortcut("expand_selection_word_to_left", "Expand selection word to left", - multilineTextInput, tcell.NewEventKey(tcell.KeyLeft, 0, tcell.ModShift) - addVimEvent(NullVimEvent,NullVimEvent,nil) + multilineTextInput, tcell.NewEventKey(tcell.KeyLeft, 0, tcell.ModShift), + addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'h', tcell.ModNone)), ) ExpandSelectionToRight = addShortcut("expand_selection_word_to_right", "Expand selection word to right", - multilineTextInput, tcell.NewEventKey(tcell.KeyRight, 0, tcell.ModShift) - addVimEvent(NullVimEvent,NullVimEvent,nil) + multilineTextInput, tcell.NewEventKey(tcell.KeyRight, 0, tcell.ModShift), + addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'l', tcell.ModNone)), ) SelectAll = addShortcut("select_all", "Select all", - multilineTextInput, tcell.NewEventKey(tcell.KeyCtrlA, rune(tcell.KeyCtrlA), tcell.ModCtrl) - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'v', tcell.ModNone),NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'V', tcell.ModNone)) + multilineTextInput, tcell.NewEventKey(tcell.KeyCtrlA, rune(tcell.KeyCtrlA), tcell.ModCtrl), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'v', tcell.ModNone),NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'V', tcell.ModNone)), ) SelectWordLeft = addShortcut("select_word_to_left", "Select word to left", - multilineTextInput, tcell.NewEventKey(tcell.KeyLeft, 0, tcell.ModCtrl|tcell.ModShift) - addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'b', tcell.ModNone)) + multilineTextInput, tcell.NewEventKey(tcell.KeyLeft, 0, tcell.ModCtrl|tcell.ModShift), + addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'b', tcell.ModNone)), ) SelectWordRight = addShortcut("select_word_to_right", "Select word to right", - multilineTextInput, tcell.NewEventKey(tcell.KeyRight, 0, tcell.ModCtrl|tcell.ModShift) - addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'w', tcell.ModNone)) + multilineTextInput, tcell.NewEventKey(tcell.KeyRight, 0, tcell.ModCtrl|tcell.ModShift), + addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'w', tcell.ModNone)), ) // TODO create a way to store keys making multi key commands like yw, di or y$ SelectToStartOfLine = addShortcut("select_to_start_of_line", "Select to start of line", - multilineTextInput, tcell.NewEventKey(tcell.KeyHome, 0, tcell.ModShift) - addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, '0', tcell.ModNone)) + multilineTextInput, tcell.NewEventKey(tcell.KeyHome, 0, tcell.ModShift), + addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, '0', tcell.ModNone)), ) SelectToEndOfLine = addShortcut("select_to_end_of_line", "Select to end of line", - multilineTextInput, tcell.NewEventKey(tcell.KeyEnd, 0, tcell.ModShift) - addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, '$', tcell.ModNone)) + multilineTextInput, tcell.NewEventKey(tcell.KeyEnd, 0, tcell.ModShift), + addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, '$', tcell.ModNone)), ) SelectToStartOfText = addShortcut("select_to_start_of_text", "Select to start of text", - multilineTextInput, tcell.NewEventKey(tcell.KeyHome, 0, tcell.ModCtrl|tcell.ModShift) - addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'g', tcell.ModNone)) + multilineTextInput, tcell.NewEventKey(tcell.KeyHome, 0, tcell.ModCtrl|tcell.ModShift), + addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'g', tcell.ModNone)), ) SelectToEndOfText = addShortcut("select_to_end_of_text", "Select to end of text", - multilineTextInput, tcell.NewEventKey(tcell.KeyEnd, 0, tcell.ModCtrl|tcell.ModShift) - addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'G', tcell.ModNone)) + multilineTextInput, tcell.NewEventKey(tcell.KeyEnd, 0, tcell.ModCtrl|tcell.ModShift), + addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'G', tcell.ModNone)), ) MoveCursorLeft = addShortcut("move_cursor_to_left", "Move cursor to left", - multilineTextInput, tcell.NewEventKey(tcell.KeyLeft, 0, tcell.ModNone) - // Normal mode should exclude cursor movement, instead that should be managed by visual mode. - // For container movement, see directional focus. - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'h', tcell.ModNone),NullVimEvent,NullVimEvent) + multilineTextInput, tcell.NewEventKey(tcell.KeyLeft, 0, tcell.ModNone), + addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent), ) MoveCursorRight = addShortcut("move_cursor_to_right", "Move cursor to right", - multilineTextInput, tcell.NewEventKey(tcell.KeyRight, 0, tcell.ModNone) - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'l', tcell.ModNone),NullVimEvent,NullVimEvent) + multilineTextInput, tcell.NewEventKey(tcell.KeyRight, 0, tcell.ModNone), + addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent), ) MoveCursorWordLeft = addShortcut("move_cursor_to_word_left", "Move cursor to word left", - multilineTextInput, tcell.NewEventKey(tcell.KeyLeft, 0, tcell.ModCtrl) - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'b', tcell.ModNone),NullVimEvent,NullVimEvent) + multilineTextInput, tcell.NewEventKey(tcell.KeyLeft, 0, tcell.ModCtrl), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'b', tcell.ModNone),NullVimEvent,NullVimEvent), ) MoveCursorWordRight = addShortcut("move_cursor_to_word_right", "Move cursor to word right", - multilineTextInput, tcell.NewEventKey(tcell.KeyRight, 0, tcell.ModCtrl) - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'w', tcell.ModNone),NullVimEvent,NullVimEvent) + multilineTextInput, tcell.NewEventKey(tcell.KeyRight, 0, tcell.ModCtrl), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'w', tcell.ModNone),NullVimEvent,NullVimEvent), ) MoveCursorStartOfLine = addShortcut("move_cursor_to_start_of_line", "Move cursor to start of line", - multilineTextInput, tcell.NewEventKey(tcell.KeyHome, 0, tcell.ModNone) - addVimEvent(tcell.NewEventKey(tcell.KeyRune, '0', tcell.ModNone),NullVimEvent,NullVimEvent) + multilineTextInput, tcell.NewEventKey(tcell.KeyHome, 0, tcell.ModNone), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, '0', tcell.ModNone),NullVimEvent,NullVimEvent), ) MoveCursorEndOfLine = addShortcut("move_cursor_to_end_of_line", "Move cursor to end of line", - multilineTextInput, tcell.NewEventKey(tcell.KeyEnd, 0, tcell.ModNone) - addVimEvent(tcell.NewEventKey(tcell.KeyRune, '$', tcell.ModNone),NullVimEvent,NullVimEvent) + multilineTextInput, tcell.NewEventKey(tcell.KeyEnd, 0, tcell.ModNone), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, '$', tcell.ModNone),NullVimEvent,NullVimEvent), ) MoveCursorStartOfText = addShortcut("move_cursor_to_start_of_text", "Move cursor to start of text", - multilineTextInput, tcell.NewEventKey(tcell.KeyHome, 0, tcell.ModCtrl) - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'g', tcell.ModNone),NullVimEvent,NullVimEvent) + multilineTextInput, tcell.NewEventKey(tcell.KeyHome, 0, tcell.ModCtrl), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'g', tcell.ModNone),NullVimEvent,NullVimEvent), ) MoveCursorEndOfText = addShortcut("move_cursor_to_end_of_text", "Move cursor to end of text", - multilineTextInput, tcell.NewEventKey(tcell.KeyEnd, 0, tcell.ModCtrl) - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'G', tcell.ModNone),NullVimEvent,NullVimEvent) + multilineTextInput, tcell.NewEventKey(tcell.KeyEnd, 0, tcell.ModCtrl), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'G', tcell.ModNone),NullVimEvent,NullVimEvent), ) @@ -192,93 +195,93 @@ var ( // TODO section DeleteRight = addShortcut("delete_right", "Delete right", - multilineTextInput, tcell.NewEventKey(tcell.KeyDelete, 0, tcell.ModNone)) + multilineTextInput, tcell.NewEventKey(tcell.KeyDelete, 0, tcell.ModNone),addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent)) DeleteWordLeft = addShortcut("delete_word_left", "Delete word left", - multilineTextInput, tcell.NewEventKey(tcell.KeyCtrlW, rune(tcell.KeyCtrlW), tcell.ModCtrl)) + multilineTextInput, tcell.NewEventKey(tcell.KeyCtrlW, rune(tcell.KeyCtrlW), tcell.ModCtrl),addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent)) InputNewLine = addShortcut("add_new_line_character", "Add new line character", - multilineTextInput, tcell.NewEventKey(tcell.KeyEnter, rune(tcell.KeyEnter), tcell.ModAlt)) + multilineTextInput, tcell.NewEventKey(tcell.KeyEnter, rune(tcell.KeyEnter), tcell.ModAlt),addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent)) CopySelection = addShortcut("copy_selection", "Copy selected text", - multilineTextInput, tcell.NewEventKey(tcell.KeyRune, 'C', tcell.ModAlt) - addVimEvent(NullVimEvent,NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'y', tcell.ModNone)) + multilineTextInput, tcell.NewEventKey(tcell.KeyRune, 'C', tcell.ModAlt), + addVimEvent(NullVimEvent,NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'y', tcell.ModNone)), ) //Don't fix the typo, it'll break stuff ;) ---- (glups) PasteAtSelection = addShortcut("paste_at_selectiom", "Paste clipboard content", - multilineTextInput, tcell.NewEventKey(tcell.KeyCtrlV, rune(tcell.KeyCtrlV), tcell.ModCtrl) - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'p',tcell.ModNone),NullVimEvent,NullVimEvent) + multilineTextInput, tcell.NewEventKey(tcell.KeyCtrlV, rune(tcell.KeyCtrlV), tcell.ModCtrl), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'p',tcell.ModNone),NullVimEvent,NullVimEvent), ) SendMessage = addShortcut("send_message", "Sends the typed message", - multilineTextInput, tcell.NewEventKey(tcell.KeyEnter, rune(tcell.KeyEnter), tcell.ModNone) - addVimEvent(NullVimEvent,nil,nil) + multilineTextInput, tcell.NewEventKey(tcell.KeyEnter, rune(tcell.KeyEnter), tcell.ModNone), + addVimEvent(NullVimEvent,nil,nil), ) AddNewLineInCodeBlock = addShortcut("add_new_line_in_code_block", "Adds a new line inside a code block", - multilineTextInput, tcell.NewEventKey(tcell.KeyEnter, rune(tcell.KeyEnter), tcell.ModNone) - addVimEvent(NullVimEvent,nil,NullVimEvent) + multilineTextInput, tcell.NewEventKey(tcell.KeyEnter, rune(tcell.KeyEnter), tcell.ModNone), + addVimEvent(NullVimEvent,nil,NullVimEvent), ) ExitApplication = addShortcut("exit_application", "Exit application", - globalScope, tcell.NewEventKey(tcell.KeyCtrlC, rune(tcell.KeyCtrlC), tcell.ModCtrl) - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'q', tcell.ModNone),NullVimEvent,NullVimEvent) + globalScope, tcell.NewEventKey(tcell.KeyCtrlC, rune(tcell.KeyCtrlC), tcell.ModCtrl), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'q', tcell.ModNone),NullVimEvent,NullVimEvent), ) FocusUp = addShortcut("focus_up", "Focus the next widget above", - globalScope, tcell.NewEventKey(tcell.KeyUp, 0, tcell.ModAlt) - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'k', tcell.ModNone),NullVimEvent,NullVimEvent) + globalScope, tcell.NewEventKey(tcell.KeyUp, 0, tcell.ModAlt), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'k', tcell.ModNone),NullVimEvent,NullVimEvent), ) FocusDown = addShortcut("focus_down", "Focus the next widget below", - globalScope, tcell.NewEventKey(tcell.KeyDown, 0, tcell.ModAlt) - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'j', tcell.ModNone),NullVimEvent,NullVimEvent) + globalScope, tcell.NewEventKey(tcell.KeyDown, 0, tcell.ModAlt), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'j', tcell.ModNone),NullVimEvent,NullVimEvent), ) FocusLeft = addShortcut("focus_left", "Focus the next widget to the left", - globalScope, tcell.NewEventKey(tcell.KeyLeft, 0, tcell.ModAlt) - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'h', tcell.ModNone),NullVimEvent,NullVimEvent) + globalScope, tcell.NewEventKey(tcell.KeyLeft, 0, tcell.ModAlt), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'h', tcell.ModNone),NullVimEvent,NullVimEvent), ) FocusRight = addShortcut("focus_right", "Focus the next widget to the right", - globalScope, tcell.NewEventKey(tcell.KeyRight, 0, tcell.ModAlt) - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'l', tcell.ModNone),NullVimEvent,NullVimEvent) + globalScope, tcell.NewEventKey(tcell.KeyRight, 0, tcell.ModAlt), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'l', tcell.ModNone),NullVimEvent,NullVimEvent), ) FocusChannelContainer = addShortcut("focus_channel_container", "Focus channel container", - globalScope, tcell.NewEventKey(tcell.KeyRune, 'c', tcell.ModAlt) - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'c', tcell.ModNone),NullVimEvent,NullVimEvent) + globalScope, tcell.NewEventKey(tcell.KeyRune, 'c', tcell.ModAlt), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'c', tcell.ModNone),NullVimEvent,NullVimEvent), ) FocusUserContainer = addShortcut("focus_user_container", "Focus user container", - globalScope, tcell.NewEventKey(tcell.KeyRune, 'u', tcell.ModAlt) - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'u', tcell.ModNone),NullVimEvent,NullVimEvent) + globalScope, tcell.NewEventKey(tcell.KeyRune, 'u', tcell.ModAlt), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'u', tcell.ModNone),NullVimEvent,NullVimEvent), ) FocusGuildContainer = addShortcut("focus_guild_container", "Focus guild container", - globalScope, tcell.NewEventKey(tcell.KeyRune, 's', tcell.ModAlt) - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 's', tcell.ModNone),NullVimEvent,NullVimEvent) + globalScope, tcell.NewEventKey(tcell.KeyRune, 's', tcell.ModAlt), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 's', tcell.ModNone),NullVimEvent,NullVimEvent), ) FocusPrivateChatPage = addShortcut("focus_private_chat_page", "Focus private chat page", - globalScope, tcell.NewEventKey(tcell.KeyRune, 'p', tcell.ModAlt) - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'p', tcell.ModNone),NullVimEvent,NullVimEvent) + globalScope, tcell.NewEventKey(tcell.KeyRune, 'p', tcell.ModAlt), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'p', tcell.ModNone),NullVimEvent,NullVimEvent), ) SwitchToPreviousChannel = addShortcut("switch_to_previous_channel", "Switch to previous channel", - globalScope, tcell.NewEventKey(tcell.KeyRune, 'l', tcell.ModAlt) + globalScope, tcell.NewEventKey(tcell.KeyRune, 'l', tcell.ModAlt), // FIXME unbound - addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent) + addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent), ) FocusMessageInput = addShortcut("focus_message_input", "Focus message input", - globalScope, tcell.NewEventKey(tcell.KeyRune, 'm', tcell.ModAlt) + globalScope, tcell.NewEventKey(tcell.KeyRune, 'm', tcell.ModAlt), // Toggle insert mode - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'i', tcell.ModNone),NullVimEvent,NullVimEvent) + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'i', tcell.ModNone),NullVimEvent,NullVimEvent), ) FocusMessageContainer = addShortcut("focus_message_container", "Focus message container", - globalScope, tcell.NewEventKey(tcell.KeyRune, 't', tcell.ModAlt) - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 't', tcell.ModNone),NullVimEvent,NullVimEvent) + globalScope, tcell.NewEventKey(tcell.KeyRune, 't', tcell.ModAlt), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 't', tcell.ModNone),NullVimEvent,NullVimEvent), ) FocusCommandInput = addShortcut("focus_command_input", "Focus command input", @@ -287,31 +290,45 @@ var ( globalScope, nil, addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent)) ToggleUserContainer = addShortcut("toggle_user_container", "Toggle user container", - globalScope, tcell.NewEventKey(tcell.KeyRune, 'U', tcell.ModAlt) - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'U', tcell.ModNone),NullVimEvent,NullVimEvent) + globalScope, tcell.NewEventKey(tcell.KeyRune, 'U', tcell.ModAlt), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'U', tcell.ModNone),NullVimEvent,NullVimEvent), ) ToggleCommandView = addShortcut("toggle_command_view", "Toggle command view", - globalScope, tcell.NewEventKey(tcell.KeyRune, '.', tcell.ModAlt) - addVimEvent(tcell.NewEventKey(tcell.KeyRune, ':', tcell.ModNone),NullVimEvent,NullVimEvent) + globalScope, tcell.NewEventKey(tcell.KeyRune, '.', tcell.ModAlt), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, ':', tcell.ModNone),NullVimEvent,NullVimEvent), ) ToggleBareChat = addShortcut("toggle_bare_chat", "Toggle bare chat", - globalScope, tcell.NewEventKey(tcell.KeyCtrlB, rune(tcell.KeyCtrlB), tcell.ModCtrl) + globalScope, tcell.NewEventKey(tcell.KeyCtrlB, rune(tcell.KeyCtrlB), tcell.ModCtrl), // FIXME unknown binding - addVimEvent(nil,NullVimEvent,NullVimEvent) + addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent), ) GuildListMarkRead = addShortcut("guild_mark_read", "Mark server as read", - guildlist, tcell.NewEventKey(tcell.KeyCtrlR, rune(tcell.KeyCtrlR), tcell.ModCtrl) - addVimEvent(NullVimEvent,NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'm', tcell.ModNone)) + guildlist, tcell.NewEventKey(tcell.KeyCtrlR, rune(tcell.KeyCtrlR), tcell.ModCtrl), + addVimEvent(NullVimEvent,NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'm', tcell.ModNone)), ) ChannelTreeMarkRead = addShortcut("channel_mark_read", "Mark channel as read", - channeltree, tcell.NewEventKey(tcell.KeyCtrlR, rune(tcell.KeyCtrlR), tcell.ModCtrl) - addVimEvent(NullVimEvent,NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'm', tcell.ModNone)) + channeltree, tcell.NewEventKey(tcell.KeyCtrlR, rune(tcell.KeyCtrlR), tcell.ModCtrl), + addVimEvent(NullVimEvent,NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'm', tcell.ModNone)), ) + VimInsertMode = addShortcut("vim_insert_mode", "Change to Vim insert mode", + globalScope, nil, + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'i', tcell.ModNone),NullVimEvent,NullVimEvent), + ) + + VimVisualMode = addShortcut("vim_visual_mode", "Change to Vim visual mode", + globalScope, nil, + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'v', tcell.ModNone),NullVimEvent,NullVimEvent), + ) + + VimNormalMode = addShortcut("vim_normal_mode", "Return to vim normal mode", + globalScope, nil, + addVimEvent(tcell.NewEventKey(tcell.KeyRune, '-', tcell.ModNone),tcell.NewEventKey(tcell.KeyRune, '-', tcell.ModNone),tcell.NewEventKey(tcell.KeyRune, '-', tcell.ModNone)), + ) scopes []*Scope Shortcuts []*Shortcut @@ -326,12 +343,12 @@ type VimEvent struct { VisualEvent *tcell.EventKey } -// NullVimEvent is the null event for the current vim mode. Any events that have this constant will be ignored. -const NullVimEvent = -1 +// NullVimEvent is the null event for the current vim mode. Any events that have this will be ignored. +var NullVimEvent *tcell.EventKey = new(tcell.EventKey) -func addVimEvent(events *tcell.EventKey...) *VimEvent { +func addVimEvent(events... *tcell.EventKey) *VimEvent { vimE := VimEvent{NormalEvent: events[0], InsertEvent: events[1], VisualEvent: events[2]} - return vimE + return &vimE } // func createMask(runes rune...) int { @@ -388,16 +405,38 @@ type Shortcut struct { defaultEvent *tcell.EventKey // VimModifier is the shortcut that will be used inside vim mode. - VimModifier VimEvent + VimModifier *VimEvent } // Equals compares the given EventKey with the Shortcuts Event. +// If any vim mode is enabled, it will replace the default event. func (shortcut *Shortcut) Equals(event *tcell.EventKey) bool { - return EventsEqual(shortcut.Event, event) + if config.Current.VimMode.CurrentMode == vim.NormalMode { + selectedEvent := shortcut.VimModifier.NormalEvent + if selectedEvent == nil { + selectedEvent = shortcut.Event + } + return EventsEqual(selectedEvent, event) + } else if config.Current.VimMode.CurrentMode == vim.InsertMode { + selectedEvent := shortcut.VimModifier.InsertEvent + if selectedEvent == nil { + selectedEvent = shortcut.Event + } + return EventsEqual(selectedEvent, event) + } else if config.Current.VimMode.CurrentMode == vim.VisualMode { + selectedEvent := shortcut.VimModifier.VisualEvent + if selectedEvent == nil { + selectedEvent = shortcut.Event + } + return EventsEqual(selectedEvent, event) + } else { + return EventsEqual(shortcut.Event, event) + } } // EventsEqual compares the given events, respecting everything except for the // When field. +// Special event NullVimEvent will always return nil, because it is empty. func EventsEqual(eventOne, eventTwo *tcell.EventKey) bool { if (eventOne == nil && eventTwo != nil) || (eventOne != nil && eventTwo == nil) { return false @@ -566,20 +605,6 @@ func Persist() error { func DirectionalFocusHandling(event *tcell.EventKey, app *tview.Application) *tcell.EventKey { focused := app.GetFocus() - if config.VimMode.CurrentMode == vim.NormalMode { - if VimFocusUp.Equals(event) { - tviewutil.FocusNextIfPossible(tview.Up, app, focused) - } else if VimFocusDown.Equals(event) { - tviewutil.FocusNextIfPossible(tview.Down, app, focused) - } else if VimFocusRight.Equals(event) { - tviewutil.FocusNextIfPossible(tview.Right, app, focused) - } else if VimFocusLeft.Equals(event) { - tviewutil.FocusNextIfPossible(tview.Left, app, focused) - } else { - return event - } - return nil - } if FocusUp.Equals(event) { tviewutil.FocusNextIfPossible(tview.Up, app, focused) diff --git a/ui/editor.go b/ui/editor.go index f4ff3f75..55b565d9 100644 --- a/ui/editor.go +++ b/ui/editor.go @@ -417,6 +417,18 @@ func NewEditor() *Editor { if shortcuts.MoveCursorLeft.Equals(event) { editor.MoveCursorLeft() + + // Vim mode shortcuts + } else if shortcuts.VimInsertMode.Equals(event) { + config.Current.VimMode.Insert() + return nil + } else if shortcuts.VimVisualMode.Equals(event) { + config.Current.VimMode.Visual() + return nil + } else if shortcuts.VimNormalMode.Equals(event) { + config.Current.VimMode.Normal() + + } else if shortcuts.ExpandSelectionToLeft.Equals(event) { editor.SelectionToLeft() } else if shortcuts.MoveCursorRight.Equals(event) { diff --git a/ui/window.go b/ui/window.go index ee6fd473..8a29571d 100644 --- a/ui/window.go +++ b/ui/window.go @@ -18,6 +18,7 @@ import ( "github.com/Bios-Marcel/cordless/util/files" "github.com/Bios-Marcel/cordless/util/fuzzy" "github.com/Bios-Marcel/cordless/util/text" + "github.com/Bios-Marcel/cordless/util/vim" "github.com/Bios-Marcel/cordless/version" "github.com/Bios-Marcel/discordemojimap" @@ -42,7 +43,7 @@ import ( "github.com/Bios-Marcel/cordless/ui/shortcutdialog" "github.com/Bios-Marcel/cordless/ui/tviewutil" "github.com/Bios-Marcel/cordless/util/maths" - "github.com/Bios-Marcel/cordless/util/vim" + //"github.com/Bios-Marcel/cordless/util/vim" ) var ( @@ -744,7 +745,13 @@ func NewWindow(app *tview.Application, session *discordgo.Session, readyEvent *d window.userList = NewUserTree(window.session.State) - if config.Current.OnTypeInListBehaviour == config.SearchOnTypeInList { + // Disable search on type when in Vim mode. TODO add / shourtcut to search. + if config.Current.VimMode.CurrentMode != vim.Disabled { + guildList.SetSearchOnTypeEnabled(false) + channelTree.SetSearchOnTypeEnabled(false) + window.userList.internalTreeView.SetSearchOnTypeEnabled(false) + window.privateList.internalTreeView.SetSearchOnTypeEnabled(false) + } else if config.Current.OnTypeInListBehaviour == config.SearchOnTypeInList { guildList.SetSearchOnTypeEnabled(true) channelTree.SetSearchOnTypeEnabled(true) window.userList.internalTreeView.SetSearchOnTypeEnabled(true) @@ -760,6 +767,11 @@ func NewWindow(app *tview.Application, session *discordgo.Session, readyEvent *d } newGuildHandler := func(event *tcell.EventKey) *tcell.EventKey { + if shortcuts.VimNormalMode.Equals(event) { + config.Current.VimMode.Normal() + return nil + } + if shortcuts.GuildListMarkRead.Equals(event) { selectedGuildNode := guildList.GetCurrentNode() if selectedGuildNode != nil && !readstate.HasGuildBeenRead(selectedGuildNode.GetReference().(string)) { @@ -789,6 +801,10 @@ func NewWindow(app *tview.Application, session *discordgo.Session, readyEvent *d } newChannelListHandler := func(event *tcell.EventKey) *tcell.EventKey { + if shortcuts.VimNormalMode.Equals(event) { + config.Current.VimMode.Normal() + return nil + } if shortcuts.ChannelTreeMarkRead.Equals(event) { selectedChannelNode := channelTree.GetCurrentNode() if selectedChannelNode != nil { @@ -864,6 +880,9 @@ func NewWindow(app *tview.Application, session *discordgo.Session, readyEvent *d bottomBar := components.NewBottomBar() bottomBar.AddItem(fmt.Sprintf("Logged in as: '%s'", tviewutil.Escape(session.State.User.Username))) bottomBar.AddItem(fmt.Sprintf("View / Change shortcuts: %s", shortcutdialog.EventToString(shortcutsDialogShortcut))) + // FIXME + //bottomBar.AddItem(fmt.Sprintf("Focused: %s", app.GetFocus())) + bottomBar.AddItem(fmt.Sprintf("Vim: %s", config.Current.VimMode.CurrentModeString())) window.rootContainer.AddItem(bottomBar, 1, 0, false) } @@ -2107,6 +2126,14 @@ func (window *Window) handleGlobalShortcuts(event *tcell.EventKey) *tcell.EventK //window#Shutdown unnecessary, as we shut the whole process down. window.app.Stop() return nil + } else if shortcuts.VimInsertMode.Equals(event) { + config.Current.VimMode.Insert() + return nil + } else if shortcuts.VimVisualMode.Equals(event) { + config.Current.VimMode.Visual() + return nil + } else if shortcuts.VimNormalMode.Equals(event) { + config.Current.VimMode.SetMode(vim.NormalMode) } // Maybe compare directly to table? @@ -2132,6 +2159,14 @@ func (window *Window) handleChatWindowShortcuts(event *tcell.EventKey) *tcell.Ev if shortcuts.ToggleBareChat.Equals(event) { window.toggleBareChat() + } else if shortcuts.VimInsertMode.Equals(event) { + config.Current.VimMode.Insert() + return nil + } else if shortcuts.VimVisualMode.Equals(event) { + config.Current.VimMode.Visual() + return nil + } else if shortcuts.VimNormalMode.Equals(event) { + config.Current.VimMode.Normal() } else if shortcuts.FocusMessageInput.Equals(event) { window.app.SetFocus(window.messageInput.GetPrimitive()) } else if shortcuts.FocusMessageContainer.Equals(event) { diff --git a/util/vim/vim.go b/util/vim/vim.go index 72399bf0..e1fe6505 100644 --- a/util/vim/vim.go +++ b/util/vim/vim.go @@ -9,12 +9,17 @@ const ( InsertMode // 1 // TODO VisualMode // 2 + + // Default: disabled + Disabled = -1 ) // Vim stores information about vim-mode, such as // current mode. type Vim struct { + // CurrentMode holds the integer value of the current vim mode. CurrentMode int + IsRoot bool } // SetMode sets new vim mode. If provided mode falls out @@ -28,6 +33,29 @@ func (v *Vim) SetMode(mode int) { v.CurrentMode = mode } +// Quick mode switch + +// SetRoot stores whether we are currently in the root window, +// because we have to manage some keys differently inside it. +func (v *Vim) SetRoot(s bool) { + v.IsRoot = s +} + +// Normal quickly switches to normal mode. +func (v *Vim) Normal() { + v.CurrentMode = NormalMode +} + +// Insert quickly switches to insert mode. +func (v *Vim) Insert() { + v.CurrentMode = InsertMode +} + +// Visual quickly switches to visual mode. +func (v *Vim) Visual() { + v.CurrentMode = VisualMode +} + // CurrentModeString returns a stringified version // of the current mode. (Useful for visual feedback to user) func (v *Vim) CurrentModeString() string { @@ -38,7 +66,10 @@ func (v *Vim) CurrentModeString() string { return "Insert" case VisualMode: return "Visual" + case Disabled: + return "Disabled" + // Should not be needed, but better to always add a default case. default: - return "Err" + return "Disabled" } } From 26d6a152ab8c0795a82a998832c24c01c9496fa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=C3=A9rez?= Date: Mon, 16 Nov 2020 15:50:31 +0100 Subject: [PATCH 04/31] Removed some useless lines --- shortcuts/shortcuts.go | 32 ++++++++++++++++---------------- ui/window.go | 17 +---------------- 2 files changed, 17 insertions(+), 32 deletions(-) diff --git a/shortcuts/shortcuts.go b/shortcuts/shortcuts.go index 751d5125..3b9664e2 100644 --- a/shortcuts/shortcuts.go +++ b/shortcuts/shortcuts.go @@ -24,19 +24,19 @@ var ( guildlist = addScope("guildlist", "Guildlist", globalScope) channeltree = addScope("channeltree", "Channeltree", globalScope) - // Normal mode will always prevail in any scope. To go to parent scope press ESC. If you are inside - // insert or visual mode, pressing ESC will only return to normal mode in the same scope you were in. + // Normal mode will always prevail in any scope. To exit insert or visual mode press ESC. // // A nil VimEvent means the original non-vim key will be used. + // A NullVimEvent will ignore that mapping inside the selected mode. QuoteSelectedMessage = addShortcut("quote_selected_message", "Quote selected message", chatview, tcell.NewEventKey(tcell.KeyRune, 'q', tcell.ModNone), - addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent), + addVimEvent(NullVimEvent,nil,NullVimEvent), // Normal Insert Visual ) EditSelectedMessage = addShortcut("edit_selected_message", "Edit selected message", chatview, tcell.NewEventKey(tcell.KeyRune, 'e', tcell.ModNone), - addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent), + addVimEvent(NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'i', tcell.ModNone),NullVimEvent), ) DownloadMessageFiles = addShortcut("download_message_files", "Download all files in selected message", @@ -47,7 +47,7 @@ var ( ReplySelectedMessage = addShortcut("reply_selected_message", "Reply to author selected message", chatview, tcell.NewEventKey(tcell.KeyRune, 'r', tcell.ModNone), - addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent), + addVimEvent(NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'a', tcell.ModNone),NullVimEvent), ) NewDirectMessage = addShortcut("new_direct_message", "Create a new direct message channel with this user", @@ -57,17 +57,17 @@ var ( CopySelectedMessageLink = addShortcut("copy_selected_message_link", "Copy link to selected message", chatview, tcell.NewEventKey(tcell.KeyRune, 'l', tcell.ModNone), - addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent), + addVimEvent(NullVimEvent,nil,NullVimEvent), ) CopySelectedMessage = addShortcut("copy_selected_message", "Copy content of selected message", chatview, tcell.NewEventKey(tcell.KeyRune, 'c', tcell.ModNone), - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'y', tcell.ModNone),NullVimEvent,NullVimEvent), + addVimEvent(NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'y', tcell.ModNone),NullVimEvent), ) ToggleSelectedMessageSpoilers = addShortcut("toggle_selected_message_spoilers", "Toggle spoilers in selected message", chatview, tcell.NewEventKey(tcell.KeyRune, 's', tcell.ModNone), - addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent), + addVimEvent(NullVimEvent,nil,NullVimEvent), ) DeleteSelectedMessage = addShortcut("delete_selected_message", "Delete the selected message", @@ -77,27 +77,27 @@ var ( ViewSelectedMessageImages = addShortcut("view_selected_message_images", "View selected message's attached files", chatview, tcell.NewEventKey(tcell.KeyRune, 'o', tcell.ModNone), - addVimEvent(NullVimEvent, NullVimEvent, NullVimEvent), + addVimEvent(NullVimEvent, nil, NullVimEvent), ) ChatViewSelectionUp = addShortcut("selection_up", "Move selection up by one", chatview, tcell.NewEventKey(tcell.KeyUp, 0, tcell.ModNone), - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'k', tcell.ModNone),NullVimEvent,NullVimEvent), + addVimEvent(NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'k', tcell.ModNone),NullVimEvent), ) ChatViewSelectionDown = addShortcut("selection_down", "Move selection down by one", chatview, tcell.NewEventKey(tcell.KeyDown, 0, tcell.ModNone), - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'j', tcell.ModNone),NullVimEvent,NullVimEvent), + addVimEvent(NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'j', tcell.ModNone),NullVimEvent), ) ChatViewSelectionTop = addShortcut("selection_top", "Move selection to the upmost message", chatview, tcell.NewEventKey(tcell.KeyHome, 0, tcell.ModNone), - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'g', tcell.ModNone),NullVimEvent,NullVimEvent), + addVimEvent(NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'g', tcell.ModNone),NullVimEvent), ) ChatViewSelectionBottom = addShortcut("selection_bottom", "Move selection to the downmost message", chatview, tcell.NewEventKey(tcell.KeyEnd, 0, tcell.ModNone), - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'G', tcell.ModNone),NullVimEvent,NullVimEvent), + addVimEvent(NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'G', tcell.ModNone),NullVimEvent), ) // START OF INPUT @@ -113,7 +113,7 @@ var ( SelectAll = addShortcut("select_all", "Select all", multilineTextInput, tcell.NewEventKey(tcell.KeyCtrlA, rune(tcell.KeyCtrlA), tcell.ModCtrl), - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'v', tcell.ModNone),NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'V', tcell.ModNone)), + addVimEvent(NullVimEvent, NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'V', tcell.ModNone)), ) SelectWordLeft = addShortcut("select_word_to_left", "Select word to left", @@ -149,12 +149,12 @@ var ( MoveCursorLeft = addShortcut("move_cursor_to_left", "Move cursor to left", multilineTextInput, tcell.NewEventKey(tcell.KeyLeft, 0, tcell.ModNone), - addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent), + addVimEvent(NullVimEvent,nil,NullVimEvent), ) MoveCursorRight = addShortcut("move_cursor_to_right", "Move cursor to right", multilineTextInput, tcell.NewEventKey(tcell.KeyRight, 0, tcell.ModNone), - addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent), + addVimEvent(NullVimEvent,nil,NullVimEvent), ) MoveCursorWordLeft = addShortcut("move_cursor_to_word_left", "Move cursor to word left", diff --git a/ui/window.go b/ui/window.go index 8a29571d..064681d0 100644 --- a/ui/window.go +++ b/ui/window.go @@ -767,10 +767,6 @@ func NewWindow(app *tview.Application, session *discordgo.Session, readyEvent *d } newGuildHandler := func(event *tcell.EventKey) *tcell.EventKey { - if shortcuts.VimNormalMode.Equals(event) { - config.Current.VimMode.Normal() - return nil - } if shortcuts.GuildListMarkRead.Equals(event) { selectedGuildNode := guildList.GetCurrentNode() @@ -801,10 +797,7 @@ func NewWindow(app *tview.Application, session *discordgo.Session, readyEvent *d } newChannelListHandler := func(event *tcell.EventKey) *tcell.EventKey { - if shortcuts.VimNormalMode.Equals(event) { - config.Current.VimMode.Normal() - return nil - } + if shortcuts.ChannelTreeMarkRead.Equals(event) { selectedChannelNode := channelTree.GetCurrentNode() if selectedChannelNode != nil { @@ -2159,14 +2152,6 @@ func (window *Window) handleChatWindowShortcuts(event *tcell.EventKey) *tcell.Ev if shortcuts.ToggleBareChat.Equals(event) { window.toggleBareChat() - } else if shortcuts.VimInsertMode.Equals(event) { - config.Current.VimMode.Insert() - return nil - } else if shortcuts.VimVisualMode.Equals(event) { - config.Current.VimMode.Visual() - return nil - } else if shortcuts.VimNormalMode.Equals(event) { - config.Current.VimMode.Normal() } else if shortcuts.FocusMessageInput.Equals(event) { window.app.SetFocus(window.messageInput.GetPrimitive()) } else if shortcuts.FocusMessageContainer.Equals(event) { From 714e23bb49a437ea1323f2c387320d93729ae33c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=C3=A9rez?= Date: Mon, 16 Nov 2020 16:26:27 +0100 Subject: [PATCH 05/31] Vim mode working. Added simulation keys inside some lists. --- shortcuts/shortcuts.go | 15 +++++++++++++++ ui/window.go | 40 +++++++++++++++++++++++++++++++++++++--- util/vim/vim.go | 15 ++++++++------- 3 files changed, 60 insertions(+), 10 deletions(-) diff --git a/shortcuts/shortcuts.go b/shortcuts/shortcuts.go index 3b9664e2..7435d6a8 100644 --- a/shortcuts/shortcuts.go +++ b/shortcuts/shortcuts.go @@ -330,6 +330,21 @@ var ( addVimEvent(tcell.NewEventKey(tcell.KeyRune, '-', tcell.ModNone),tcell.NewEventKey(tcell.KeyRune, '-', tcell.ModNone),tcell.NewEventKey(tcell.KeyRune, '-', tcell.ModNone)), ) + VimSimKeyUp = addShortcut("vim_sim_up", "Simulate an arrow key press in vim mode.", + globalScope, nil, + addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'k', tcell.ModNone))) + + VimSimKeyDown = addShortcut("vim_sim_down", "Simulate an arrow key press in vim mode.", + globalScope, nil, + addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'j', tcell.ModNone))) + + VimSimKeyLeft = addShortcut("vim_sim_left", "Simulate an arrow key press in vim mode.", + globalScope, nil, + addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'h', tcell.ModNone))) + + VimSimKeyRight = addShortcut("vim_sim_right", "Simulate an arrow key press in vim mode.", + globalScope, nil, + addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'l', tcell.ModNone))) scopes []*Scope Shortcuts []*Shortcut ) diff --git a/ui/window.go b/ui/window.go index 064681d0..0b0bd809 100644 --- a/ui/window.go +++ b/ui/window.go @@ -768,6 +768,16 @@ func NewWindow(app *tview.Application, session *discordgo.Session, readyEvent *d newGuildHandler := func(event *tcell.EventKey) *tcell.EventKey { + // Workaround for vim bindings inside list + if shortcuts.VimSimKeyDown.Equals(event) { + return tcell.NewEventKey(tcell.KeyDown, rune(tcell.KeyDown), tcell.ModNone) + } else if shortcuts.VimSimKeyUp.Equals(event) { + return tcell.NewEventKey(tcell.KeyUp, rune(tcell.KeyUp), tcell.ModNone) + } else if shortcuts.VimSimKeyRight.Equals(event) { + return tcell.NewEventKey(tcell.KeyRight, rune(tcell.KeyRight), tcell.ModNone) + } else if shortcuts.VimSimKeyLeft.Equals(event) { + return tcell.NewEventKey(tcell.KeyLeft, rune(tcell.KeyLeft), tcell.ModNone) + } if shortcuts.GuildListMarkRead.Equals(event) { selectedGuildNode := guildList.GetCurrentNode() if selectedGuildNode != nil && !readstate.HasGuildBeenRead(selectedGuildNode.GetReference().(string)) { @@ -798,6 +808,16 @@ func NewWindow(app *tview.Application, session *discordgo.Session, readyEvent *d newChannelListHandler := func(event *tcell.EventKey) *tcell.EventKey { + // Workaround for vim bindings inside list + if shortcuts.VimSimKeyDown.Equals(event) { + return tcell.NewEventKey(tcell.KeyDown, rune(tcell.KeyDown), tcell.ModNone) + } else if shortcuts.VimSimKeyUp.Equals(event) { + return tcell.NewEventKey(tcell.KeyUp, rune(tcell.KeyUp), tcell.ModNone) + } else if shortcuts.VimSimKeyRight.Equals(event) { + return tcell.NewEventKey(tcell.KeyRight, rune(tcell.KeyRight), tcell.ModNone) + } else if shortcuts.VimSimKeyLeft.Equals(event) { + return tcell.NewEventKey(tcell.KeyLeft, rune(tcell.KeyLeft), tcell.ModNone) + } if shortcuts.ChannelTreeMarkRead.Equals(event) { selectedChannelNode := channelTree.GetCurrentNode() if selectedChannelNode != nil { @@ -873,9 +893,9 @@ func NewWindow(app *tview.Application, session *discordgo.Session, readyEvent *d bottomBar := components.NewBottomBar() bottomBar.AddItem(fmt.Sprintf("Logged in as: '%s'", tviewutil.Escape(session.State.User.Username))) bottomBar.AddItem(fmt.Sprintf("View / Change shortcuts: %s", shortcutdialog.EventToString(shortcutsDialogShortcut))) + bottomBar.AddItem(fmt.Sprintf("Vim: %s", config.Current.VimMode.EnabledString())) // FIXME - //bottomBar.AddItem(fmt.Sprintf("Focused: %s", app.GetFocus())) - bottomBar.AddItem(fmt.Sprintf("Vim: %s", config.Current.VimMode.CurrentModeString())) + //bottomBar.AddItem(fmt.Sprintf("Vim Mode: %s", config.Current.VimMode.CurrentModeString())) window.rootContainer.AddItem(bottomBar, 1, 0, false) } @@ -2126,9 +2146,12 @@ func (window *Window) handleGlobalShortcuts(event *tcell.EventKey) *tcell.EventK config.Current.VimMode.Visual() return nil } else if shortcuts.VimNormalMode.Equals(event) { - config.Current.VimMode.SetMode(vim.NormalMode) + config.Current.VimMode.Normal() } + window.app.QueueUpdateDraw(func() { + }) + // Maybe compare directly to table? if config.Current.DesktopNotificationsUserInactivityThreshold > 0 { window.userActive = true @@ -2146,6 +2169,17 @@ func (window *Window) handleChatWindowShortcuts(event *tcell.EventKey) *tcell.Ev return event } + // Workaround for vim bindings inside list + if shortcuts.VimSimKeyDown.Equals(event) { + return tcell.NewEventKey(tcell.KeyDown, rune(tcell.KeyDown), tcell.ModNone) + } else if shortcuts.VimSimKeyUp.Equals(event) { + return tcell.NewEventKey(tcell.KeyUp, rune(tcell.KeyUp), tcell.ModNone) + } else if shortcuts.VimSimKeyRight.Equals(event) { + return tcell.NewEventKey(tcell.KeyRight, rune(tcell.KeyRight), tcell.ModNone) + } else if shortcuts.VimSimKeyLeft.Equals(event) { + return tcell.NewEventKey(tcell.KeyLeft, rune(tcell.KeyLeft), tcell.ModNone) + } + if shortcuts.DirectionalFocusHandling(event, window.app) == nil { return nil } diff --git a/util/vim/vim.go b/util/vim/vim.go index e1fe6505..be4bbc17 100644 --- a/util/vim/vim.go +++ b/util/vim/vim.go @@ -19,7 +19,6 @@ const ( type Vim struct { // CurrentMode holds the integer value of the current vim mode. CurrentMode int - IsRoot bool } // SetMode sets new vim mode. If provided mode falls out @@ -35,12 +34,6 @@ func (v *Vim) SetMode(mode int) { // Quick mode switch -// SetRoot stores whether we are currently in the root window, -// because we have to manage some keys differently inside it. -func (v *Vim) SetRoot(s bool) { - v.IsRoot = s -} - // Normal quickly switches to normal mode. func (v *Vim) Normal() { v.CurrentMode = NormalMode @@ -73,3 +66,11 @@ func (v *Vim) CurrentModeString() string { return "Disabled" } } + +func (v *Vim) EnabledString() string { + if v.CurrentMode == Disabled { + return "Disabled" + } else { + return "Enabled" + } +} From ce0056696544262788bd4744b0b4cff032d1a6d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=C3=A9rez?= Date: Mon, 16 Nov 2020 22:46:32 +0100 Subject: [PATCH 06/31] Dynamic status bar and shortcuts menu --- bbar.diff | 47 +++++++++++++++++++++++++++++++++ ui/components/bottombar.go | 22 ++++++++++++---- ui/shortcutdialog/table.go | 54 ++++++++++++++++++++++++++++++++++++++ ui/window.go | 12 ++++++--- 4 files changed, 127 insertions(+), 8 deletions(-) create mode 100644 bbar.diff diff --git a/bbar.diff b/bbar.diff new file mode 100644 index 00000000..84fc0371 --- /dev/null +++ b/bbar.diff @@ -0,0 +1,47 @@ +diff --git a/ui/components/bottombar.go b/ui/components/bottombar.go +index e65c07a..e79eb6c 100644 +--- a/ui/components/bottombar.go ++++ b/ui/components/bottombar.go +@@ -15,11 +15,13 @@ import ( + type BottomBar struct { + *sync.Mutex + *tview.Box +- items []*bottomBarItem ++ items []*BottomBarItem + } + +-type bottomBarItem struct { +- content string ++// BottomBarItem represents an entry in a BottomBar. It simply holds a static ++// text that can technically be changed after adding the item. ++type BottomBarItem struct { ++ Content string + } + + // Draw draws this primitive onto the screen. Implementers can call the +@@ -45,7 +47,7 @@ func (b *BottomBar) Draw(screen tcell.Screen) bool { + + xPos, yPos, _, _ := b.GetInnerRect() + for _, item := range b.items { +- gr := uniseg.NewGraphemes(item.content) ++ gr := uniseg.NewGraphemes(item.Content) + for gr.Next() { + r := gr.Runes() + width := runewidth.StringWidth(gr.Str()) +@@ -69,4 +71,14 @@ func (b *BottomBar) Draw(screen tcell.Screen) bool { + func (b *BottomBar) AddItem(text string) { + b.Lock() + defer b.Unlock() +- b.items = append(b.items, &bottomBarItem{text}) ++ b.items = append(b.items, &BottomBarItem{text}) ++} ++ ++// AddDynamicItem adds an item without content that can be filled from outside ++// by assigning a new value to the Content field off the returned item. ++func (b *BottomBar) AddDynamicItem() *BottomBarItem { ++ newItem := &BottomBarItem{} ++ b.Lock() ++ defer b.Unlock() ++ b.items = append(b.items, newItem) ++ return newItem ++ } diff --git a/ui/components/bottombar.go b/ui/components/bottombar.go index e65c07af..17e50801 100644 --- a/ui/components/bottombar.go +++ b/ui/components/bottombar.go @@ -15,11 +15,13 @@ import ( type BottomBar struct { *sync.Mutex *tview.Box - items []*bottomBarItem + items []*BottomBarItem } -type bottomBarItem struct { - content string +// BottomBarItem represents an entry in a BottomBar. It simply holds a static +// text that can technically be changed after adding the item. +type BottomBarItem struct { + Content string } // Draw draws this primitive onto the screen. Implementers can call the @@ -45,7 +47,7 @@ func (b *BottomBar) Draw(screen tcell.Screen) bool { xPos, yPos, _, _ := b.GetInnerRect() for _, item := range b.items { - gr := uniseg.NewGraphemes(item.content) + gr := uniseg.NewGraphemes(item.Content) for gr.Next() { r := gr.Runes() width := runewidth.StringWidth(gr.Str()) @@ -69,7 +71,7 @@ func (b *BottomBar) Draw(screen tcell.Screen) bool { func (b *BottomBar) AddItem(text string) { b.Lock() defer b.Unlock() - b.items = append(b.items, &bottomBarItem{text}) + b.items = append(b.items, &BottomBarItem{text}) } // NewBottomBar creates a new bar to be put at the bottom aplication. @@ -83,3 +85,13 @@ func NewBottomBar() *BottomBar { return bottomBar } + +// AddDynamicItem adds and item without content that can be filled from outside +// by assigning a new value to the Content field of the returned item. +func (b *BottomBar) AddDynamicItem() *BottomBarItem { + newItem := &BottomBarItem{} + b.Lock() + defer b.Unlock() + b.items = append(b.items, newItem) + return newItem +} diff --git a/ui/shortcutdialog/table.go b/ui/shortcutdialog/table.go index fffd592c..0cbc6cc7 100644 --- a/ui/shortcutdialog/table.go +++ b/ui/shortcutdialog/table.go @@ -13,6 +13,9 @@ const ( actionCellIndex int = iota scopeCellIndex shortcutCellIndex + vimNormalCellIndex + vimInsertCellIndex + vimVisualCellIndex ) // ShortcutTable is a component that displays shortcuts and allows changing @@ -20,6 +23,7 @@ const ( type ShortcutTable struct { table *tview.Table shortcuts []*shortcuts.Shortcut + vimBindings []*shortcuts.VimEvent selection int focusNext func() focusPrevious func() @@ -42,6 +46,9 @@ func NewShortcutTable() *ShortcutTable { table.SetCell(0, actionCellIndex, createHeaderCell("Action")) table.SetCell(0, scopeCellIndex, createHeaderCell("Scope")) table.SetCell(0, shortcutCellIndex, createHeaderCell("Shortcut")) + table.SetCell(0, vimNormalCellIndex, createHeaderCell("Vim: N")) + table.SetCell(0, vimInsertCellIndex, createHeaderCell("Vim: I")) + table.SetCell(0, vimVisualCellIndex, createHeaderCell("Vim: V")) table.SetInputCapture(shortcutsTable.handleInput) @@ -90,6 +97,53 @@ func (shortcutTable *ShortcutTable) SetShortcuts(shortcuts []*shortcuts.Shortcut SetMaxWidth(1) shortcutTable.table.SetCell(row, shortcutCellIndex, eventCell) + normalKey := "" + insertKey := "" + visualKey := "" + + // Empty tcell EventKey corresponds to Ctrl-Space + if shortcut.VimModifier.NormalEvent == nil { + normalKey = EventToString(shortcut.Event) + } else if shortcut.VimModifier.NormalEvent.Rune() == rune(tcell.KeyCtrlSpace){ + normalKey = "" + } else { + normalKey = EventToString(shortcut.VimModifier.NormalEvent) + } + + if shortcut.VimModifier.InsertEvent == nil { + insertKey = EventToString(shortcut.Event) + } else if shortcut.VimModifier.InsertEvent.Rune() == rune(tcell.KeyCtrlSpace){ + insertKey = "" + } else { + insertKey = EventToString(shortcut.VimModifier.InsertEvent) + } + + if shortcut.VimModifier.VisualEvent == nil { + visualKey = EventToString(shortcut.Event) + } else if shortcut.VimModifier.VisualEvent.Rune() == rune(tcell.KeyCtrlSpace){ + visualKey = "" + } else { + visualKey = EventToString(shortcut.VimModifier.VisualEvent) + } + + vimNormalCell := tview.NewTableCell(fmt.Sprintf("%s", + normalKey)). + SetExpansion(1). + SetMaxWidth(1) + shortcutTable.table.SetCell(row, vimNormalCellIndex, vimNormalCell) + + vimInsertCell := tview.NewTableCell(fmt.Sprintf("%s", + insertKey)). + SetExpansion(1). + SetMaxWidth(1) + shortcutTable.table.SetCell(row, vimInsertCellIndex, vimInsertCell) + + vimVisualCell := tview.NewTableCell(fmt.Sprintf("%s", + visualKey)). + SetExpansion(1). + SetMaxWidth(1) + shortcutTable.table.SetCell(row, vimVisualCellIndex, vimVisualCell) + row++ } } diff --git a/ui/window.go b/ui/window.go index 0b0bd809..47ca413a 100644 --- a/ui/window.go +++ b/ui/window.go @@ -94,6 +94,7 @@ type Window struct { bareChat bool activeView ActiveView + vimStatus *components.BottomBarItem } type ActiveView bool @@ -893,9 +894,10 @@ func NewWindow(app *tview.Application, session *discordgo.Session, readyEvent *d bottomBar := components.NewBottomBar() bottomBar.AddItem(fmt.Sprintf("Logged in as: '%s'", tviewutil.Escape(session.State.User.Username))) bottomBar.AddItem(fmt.Sprintf("View / Change shortcuts: %s", shortcutdialog.EventToString(shortcutsDialogShortcut))) - bottomBar.AddItem(fmt.Sprintf("Vim: %s", config.Current.VimMode.EnabledString())) - // FIXME - //bottomBar.AddItem(fmt.Sprintf("Vim Mode: %s", config.Current.VimMode.CurrentModeString())) + // bottomBar.AddItem(fmt.Sprintf("Vim: %s", config.Current.VimMode.EnabledString())) + window.vimStatus = bottomBar.AddDynamicItem() + // Default content + window.vimStatus.Content = fmt.Sprintf("Vim: %s", config.Current.VimMode.CurrentModeString()) window.rootContainer.AddItem(bottomBar, 1, 0, false) } @@ -2141,12 +2143,16 @@ func (window *Window) handleGlobalShortcuts(event *tcell.EventKey) *tcell.EventK return nil } else if shortcuts.VimInsertMode.Equals(event) { config.Current.VimMode.Insert() + window.vimStatus.Content = fmt.Sprintf("Vim: %s",config.Current.VimMode.CurrentModeString()) return nil } else if shortcuts.VimVisualMode.Equals(event) { config.Current.VimMode.Visual() + window.vimStatus.Content = fmt.Sprintf("Vim: %s",config.Current.VimMode.CurrentModeString()) return nil } else if shortcuts.VimNormalMode.Equals(event) { config.Current.VimMode.Normal() + window.vimStatus.Content = fmt.Sprintf("Vim: %s",config.Current.VimMode.CurrentModeString()) + return nil } window.app.QueueUpdateDraw(func() { From 56fcff0c41b2cb6819fa042e425938033e345da5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=C3=A9rez?= Date: Mon, 16 Nov 2020 22:46:52 +0100 Subject: [PATCH 07/31] Dynamic status bar and shortcuts menu --- bbar.diff | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) delete mode 100644 bbar.diff diff --git a/bbar.diff b/bbar.diff deleted file mode 100644 index 84fc0371..00000000 --- a/bbar.diff +++ /dev/null @@ -1,47 +0,0 @@ -diff --git a/ui/components/bottombar.go b/ui/components/bottombar.go -index e65c07a..e79eb6c 100644 ---- a/ui/components/bottombar.go -+++ b/ui/components/bottombar.go -@@ -15,11 +15,13 @@ import ( - type BottomBar struct { - *sync.Mutex - *tview.Box -- items []*bottomBarItem -+ items []*BottomBarItem - } - --type bottomBarItem struct { -- content string -+// BottomBarItem represents an entry in a BottomBar. It simply holds a static -+// text that can technically be changed after adding the item. -+type BottomBarItem struct { -+ Content string - } - - // Draw draws this primitive onto the screen. Implementers can call the -@@ -45,7 +47,7 @@ func (b *BottomBar) Draw(screen tcell.Screen) bool { - - xPos, yPos, _, _ := b.GetInnerRect() - for _, item := range b.items { -- gr := uniseg.NewGraphemes(item.content) -+ gr := uniseg.NewGraphemes(item.Content) - for gr.Next() { - r := gr.Runes() - width := runewidth.StringWidth(gr.Str()) -@@ -69,4 +71,14 @@ func (b *BottomBar) Draw(screen tcell.Screen) bool { - func (b *BottomBar) AddItem(text string) { - b.Lock() - defer b.Unlock() -- b.items = append(b.items, &bottomBarItem{text}) -+ b.items = append(b.items, &BottomBarItem{text}) -+} -+ -+// AddDynamicItem adds an item without content that can be filled from outside -+// by assigning a new value to the Content field off the returned item. -+func (b *BottomBar) AddDynamicItem() *BottomBarItem { -+ newItem := &BottomBarItem{} -+ b.Lock() -+ defer b.Unlock() -+ b.items = append(b.items, newItem) -+ return newItem -+ } From 20164623d74780439af636569acb5b19ecf92e5f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=C3=A9rez?= Date: Mon, 16 Nov 2020 22:57:59 +0100 Subject: [PATCH 08/31] Fixed some keybindings --- shortcuts/shortcuts.go | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/shortcuts/shortcuts.go b/shortcuts/shortcuts.go index 7435d6a8..98f4d32e 100644 --- a/shortcuts/shortcuts.go +++ b/shortcuts/shortcuts.go @@ -52,7 +52,7 @@ var ( NewDirectMessage = addShortcut("new_direct_message", "Create a new direct message channel with this user", chatview, tcell.NewEventKey(tcell.KeyRune, 'p', tcell.ModNone), - addVimEvent(tcell.NewEventKey(tcell.KeyEnter,rune(tcell.KeyEnter),tcell.ModNone),NullVimEvent,NullVimEvent), + addVimEvent(NullVimEvent,tcell.NewEventKey(tcell.KeyEnter,rune(tcell.KeyEnter),tcell.ModNone),NullVimEvent), ) CopySelectedMessageLink = addShortcut("copy_selected_message_link", "Copy link to selected message", @@ -72,7 +72,7 @@ var ( DeleteSelectedMessage = addShortcut("delete_selected_message", "Delete the selected message", chatview, tcell.NewEventKey(tcell.KeyDelete, 0, tcell.ModNone), - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'd', tcell.ModNone),NullVimEvent,NullVimEvent), + addVimEvent(NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'd', tcell.ModNone),NullVimEvent), ) ViewSelectedMessageImages = addShortcut("view_selected_message_images", "View selected message's attached files", @@ -195,11 +195,11 @@ var ( // TODO section DeleteRight = addShortcut("delete_right", "Delete right", - multilineTextInput, tcell.NewEventKey(tcell.KeyDelete, 0, tcell.ModNone),addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent)) + multilineTextInput, tcell.NewEventKey(tcell.KeyDelete, 0, tcell.ModNone),addVimEvent(NullVimEvent,nil,NullVimEvent)) DeleteWordLeft = addShortcut("delete_word_left", "Delete word left", - multilineTextInput, tcell.NewEventKey(tcell.KeyCtrlW, rune(tcell.KeyCtrlW), tcell.ModCtrl),addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent)) + multilineTextInput, tcell.NewEventKey(tcell.KeyCtrlW, rune(tcell.KeyCtrlW), tcell.ModCtrl),addVimEvent(NullVimEvent,nil,NullVimEvent)) InputNewLine = addShortcut("add_new_line_character", "Add new line character", - multilineTextInput, tcell.NewEventKey(tcell.KeyEnter, rune(tcell.KeyEnter), tcell.ModAlt),addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent)) + multilineTextInput, tcell.NewEventKey(tcell.KeyEnter, rune(tcell.KeyEnter), tcell.ModAlt),addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'o', tcell.ModNone),NullVimEvent,NullVimEvent)) CopySelection = addShortcut("copy_selection", "Copy selected text", @@ -214,12 +214,12 @@ var ( SendMessage = addShortcut("send_message", "Sends the typed message", multilineTextInput, tcell.NewEventKey(tcell.KeyEnter, rune(tcell.KeyEnter), tcell.ModNone), - addVimEvent(NullVimEvent,nil,nil), + addVimEvent(NullVimEvent,nil,NullVimEvent), ) AddNewLineInCodeBlock = addShortcut("add_new_line_in_code_block", "Adds a new line inside a code block", multilineTextInput, tcell.NewEventKey(tcell.KeyEnter, rune(tcell.KeyEnter), tcell.ModNone), - addVimEvent(NullVimEvent,nil,NullVimEvent), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'o', tcell.ModNone),NullVimEvent,NullVimEvent), ) ExitApplication = addShortcut("exit_application", "Exit application", @@ -264,7 +264,7 @@ var ( FocusPrivateChatPage = addShortcut("focus_private_chat_page", "Focus private chat page", globalScope, tcell.NewEventKey(tcell.KeyRune, 'p', tcell.ModAlt), - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'p', tcell.ModNone),NullVimEvent,NullVimEvent), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'P', tcell.ModNone),NullVimEvent,NullVimEvent), ) SwitchToPreviousChannel = addShortcut("switch_to_previous_channel", "Switch to previous channel", @@ -276,7 +276,7 @@ var ( FocusMessageInput = addShortcut("focus_message_input", "Focus message input", globalScope, tcell.NewEventKey(tcell.KeyRune, 'm', tcell.ModAlt), // Toggle insert mode - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'i', tcell.ModNone),NullVimEvent,NullVimEvent), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'I', tcell.ModNone),NullVimEvent,NullVimEvent), ) FocusMessageContainer = addShortcut("focus_message_container", "Focus message container", @@ -285,13 +285,15 @@ var ( ) FocusCommandInput = addShortcut("focus_command_input", "Focus command input", + // FIXME unbound globalScope, nil, addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent)) FocusCommandOutput = addShortcut("focus_command_output", "Focus command output", + // FIXME unbound globalScope, nil, addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent)) ToggleUserContainer = addShortcut("toggle_user_container", "Toggle user container", globalScope, tcell.NewEventKey(tcell.KeyRune, 'U', tcell.ModAlt), - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'U', tcell.ModNone),NullVimEvent,NullVimEvent), + addVimEvent(nil,NullVimEvent,NullVimEvent), ) ToggleCommandView = addShortcut("toggle_command_view", "Toggle command view", @@ -307,12 +309,12 @@ var ( GuildListMarkRead = addShortcut("guild_mark_read", "Mark server as read", guildlist, tcell.NewEventKey(tcell.KeyCtrlR, rune(tcell.KeyCtrlR), tcell.ModCtrl), - addVimEvent(NullVimEvent,NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'm', tcell.ModNone)), + addVimEvent(NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'm', tcell.ModNone), tcell.NewEventKey(tcell.KeyRune, 'm', tcell.ModNone)), ) ChannelTreeMarkRead = addShortcut("channel_mark_read", "Mark channel as read", channeltree, tcell.NewEventKey(tcell.KeyCtrlR, rune(tcell.KeyCtrlR), tcell.ModCtrl), - addVimEvent(NullVimEvent,NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'm', tcell.ModNone)), + addVimEvent(NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'm', tcell.ModNone), tcell.NewEventKey(tcell.KeyRune, 'm', tcell.ModNone)), ) VimInsertMode = addShortcut("vim_insert_mode", "Change to Vim insert mode", @@ -327,6 +329,7 @@ var ( VimNormalMode = addShortcut("vim_normal_mode", "Return to vim normal mode", globalScope, nil, + // FIXME escape key not working in my machine. Using hyphen instead temporarily. addVimEvent(tcell.NewEventKey(tcell.KeyRune, '-', tcell.ModNone),tcell.NewEventKey(tcell.KeyRune, '-', tcell.ModNone),tcell.NewEventKey(tcell.KeyRune, '-', tcell.ModNone)), ) From 7219309073c7333abed8cf262cc98eb3351b0a9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=C3=A9rez?= Date: Mon, 16 Nov 2020 23:23:34 +0100 Subject: [PATCH 09/31] Fixed little issues --- shortcuts/shortcuts.go | 1 + shortcuts/shortcuts_nix.go | 3 ++- shortcuts/shortcuts_win.go | 2 +- ui/shortcutdialog/table.go | 1 + 4 files changed, 5 insertions(+), 2 deletions(-) diff --git a/shortcuts/shortcuts.go b/shortcuts/shortcuts.go index 287c0772..3339c2f6 100644 --- a/shortcuts/shortcuts.go +++ b/shortcuts/shortcuts.go @@ -348,6 +348,7 @@ var ( VimSimKeyRight = addShortcut("vim_sim_right", "Simulate an arrow key press in vim mode.", globalScope, nil, addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'l', tcell.ModNone))) + scopes []*Scope Shortcuts []*Shortcut ) diff --git a/shortcuts/shortcuts_nix.go b/shortcuts/shortcuts_nix.go index 7acc4389..1a8630d5 100644 --- a/shortcuts/shortcuts_nix.go +++ b/shortcuts/shortcuts_nix.go @@ -5,5 +5,6 @@ package shortcuts import tcell "github.com/gdamore/tcell/v2" func addDeleteLeftShortcut() *Shortcut { - return addShortcut("delete_left", "Delete left", multilineTextInput, tcell.NewEventKey(tcell.KeyBackspace2, rune(tcell.KeyBackspace2), tcell.ModNone)) + // FIXME don't know what to do with this vim binding + return addShortcut("delete_left", "Delete left", multilineTextInput, tcell.NewEventKey(tcell.KeyBackspace2, rune(tcell.KeyBackspace2), tcell.ModNone),addVimEvent(NullVimEvent,nil,NullVimEvent)) } diff --git a/shortcuts/shortcuts_win.go b/shortcuts/shortcuts_win.go index 3d3ad45f..e06bfcff 100644 --- a/shortcuts/shortcuts_win.go +++ b/shortcuts/shortcuts_win.go @@ -5,5 +5,5 @@ package shortcuts import tcell "github.com/gdamore/tcell/v2" func addDeleteLeftShortcut() *Shortcut { - return addShortcut("delete_left", "Delete left", multilineTextInput, tcell.NewEventKey(tcell.KeyBackspace, rune(tcell.KeyBackspace), tcell.ModNone)) + return addShortcut("delete_left", "Delete left", multilineTextInput, tcell.NewEventKey(tcell.KeyBackspace, rune(tcell.KeyBackspace), tcell.ModNone),addVimKey(NullVimKey,nil,NullVimKey)) } diff --git a/ui/shortcutdialog/table.go b/ui/shortcutdialog/table.go index 0cbc6cc7..efee811e 100644 --- a/ui/shortcutdialog/table.go +++ b/ui/shortcutdialog/table.go @@ -101,6 +101,7 @@ func (shortcutTable *ShortcutTable) SetShortcuts(shortcuts []*shortcuts.Shortcut insertKey := "" visualKey := "" + // HACK // Empty tcell EventKey corresponds to Ctrl-Space if shortcut.VimModifier.NormalEvent == nil { normalKey = EventToString(shortcut.Event) From 155c1605f240b930bbfd72ba64a05c2eed0a9370 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=C3=A9rez?= Date: Mon, 16 Nov 2020 23:39:19 +0100 Subject: [PATCH 10/31] Edited changelog --- ui/window.go | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ui/window.go b/ui/window.go index 82dce6ba..b64b80d8 100644 --- a/ui/window.go +++ b/ui/window.go @@ -991,8 +991,16 @@ important changes of the last two versions officially released. [::b]THIS VERSION - Features - - Changes - - Bugfixes +[::b]2020-11-16 + - Features + - Added Vim mode + - Enable vim mode in your config file, setting VimMode to 0. + - Navigate menus with h j k l in normal mode, enter focus with either + - insert mode or visual mode. + - Navigate inside lists with vim keys. + - Use some of your known bindings inside chat view, or selection mode. + - More vim features will be added in next updates, and bugs will try to be + - fixed :) [::b]2020-10-24 - Features - DM people via "p" in the chatview or use the dm-open command From ad82e0ef4cb1a39beb77a6bb3ceb0c8784edee73 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20P=C3=A9rez?= Date: Mon, 16 Nov 2020 23:41:59 +0100 Subject: [PATCH 11/31] Fixed go.sum --- go.mod | 2 - go.sum | 166 --------------------------------------------------------- 2 files changed, 168 deletions(-) diff --git a/go.mod b/go.mod index bc5c6386..d3200a8e 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,3 @@ -replace github.com/Bios-Marcel/cordless => /home/gamb1t/Projects/go/src/cordless - module github.com/Bios-Marcel/cordless go 1.12 diff --git a/go.sum b/go.sum index 2089efb6..78931bda 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,3 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/Bios-Marcel/discordemojimap v1.0.1 h1:b3UYPO7+h1+ciStkwU/KQCerOmpUNPHsBf4a7EjMdys= github.com/Bios-Marcel/discordemojimap v1.0.1/go.mod h1:AoHIpUwf3EVCAAUmk+keXjb9khyZcFnW84/rhJd4IkU= github.com/Bios-Marcel/discordgo v0.21.2-0.20201025194456-7046b5509389 h1:Ha9AEp9HwOZElVwWWiA/aYU4g6dOYwJIhnxYf8XsNSo= @@ -7,9 +6,6 @@ github.com/Bios-Marcel/goclipimg v0.0.0-20191117180634-d0f7b06fbe82 h1:gspJ6CW9b github.com/Bios-Marcel/goclipimg v0.0.0-20191117180634-d0f7b06fbe82/go.mod h1:hiFR6fH5+uc/f2yK2syh/UfzaPfGo6F2HJSoiI4ufWU= github.com/Bios-Marcel/shortnotforlong v1.1.1 h1:cCJIp6MODd4rwH5Y+fAMAaIuFxS1FPKfwDbRzsCU9nM= github.com/Bios-Marcel/shortnotforlong v1.1.1/go.mod h1:g6bFiwq0pq7pqENRgHiCZu7uMzeYPIXwANlaBQ47LBw= -github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38 h1:smF2tmSOzy2Mm+0dGI2AIUHY+w0BUc+4tn40djz7+6U= github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38/go.mod h1:r7bzyVFMNntcxPZXK3/+KdruV1H5KSlyVY0gc+NgInI= github.com/alecthomas/chroma v0.7.3 h1:NfdAERMy+esYQs8OXk0I868/qDxxCEo7FMz1WIqMAeI= @@ -19,85 +15,36 @@ github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721/go.mod h1:QO9JBo github.com/alecthomas/kong v0.2.4/go.mod h1:kQOmtJgV+Lb4aj+I2LEn40cbtawdWJ9Y8QLq+lElKxE= github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897 h1:p9Sln00KOTlrYkxI1zYWl1QLnEqAqEARBEYa8FQnQcY= github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/atotto/clipboard v0.1.2 h1:YZCtFu5Ie8qX2VmVTBnrqLSiU9XOWwqNRmdT3gIQzbY= github.com/atotto/clipboard v0.1.2/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/bunyk/gokeybr v0.0.0-20201019133936-f9e4ed3fdc5d h1:GHWeoxIZZKoGykRh+MFh26awQ3w7LASUfflaMO9nobw= -github.com/bunyk/gokeybr v0.0.0-20201019133936-f9e4ed3fdc5d/go.mod h1:QoGx25FILnr4IxmvRiDOP8s41BaxhLKlxoBVU9suyRU= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 h1:y5HC9v93H5EPKqaS1UYVg1uYah5Xf51mBfIoWehClUQ= github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9hchkHSWYkEqJwUGisez3G1QY8Ryz0sdWrLPMGjLk= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dlclark/regexp2 v1.2.0 h1:8sAhBGEM0dRWogWqWyQeIJnxjWO6oIjl8FKqREDsGfk= github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko= github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg= -github.com/gdamore/tcell/v2 v2.0.0-dev/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA= github.com/gdamore/tcell/v2 v2.0.0 h1:GRWG8aLfWAlekj9Q6W29bVvkHENc6hp79XOqG4AWDOs= github.com/gdamore/tcell/v2 v2.0.0/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA= github.com/gen2brain/beeep v0.0.0-20200526185328-e9c15c258e28 h1:M2Zt3G2w6Q57GZndOYk42p7RvMeO8izO8yKTfIxGqxA= github.com/gen2brain/beeep v0.0.0-20200526185328-e9c15c258e28/go.mod h1:ElSskYZe3oM8kThaHGJ+kiN2yyUMVXMZ7WxF9QqLDS8= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4 h1:qZNfIGkIANxGv/OqtnntR4DfOY2+BgwR60cAcu/i3SE= github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4/go.mod h1:kW3HQ4UdaAyrUCSSDR4xUzBKW6O2iA4uHhk7AtyYp10= github.com/godbus/dbus/v5 v5.0.3 h1:ZqHaoEF7TBzh4jzPmqVhE/5A1z9of6orkAe5uHoAeME= github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.5.1 h1:JFrFEBb2xKufg6XkJsJr+WbKb4FQlURi5RUcBveYu9k= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-github/v29 v29.0.3 h1:IktKCTwU//aFHnpA+2SLIi7Oo9uhAzgsdZNbcAqhgdc= github.com/google/go-github/v29 v29.0.3/go.mod h1:CHKiKKPHJ0REzfwc14QMklvtHwCveD0PxlMjLlzAM5E= github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c h1:16eHWuMGvCjSfgRJKqIzapE78onvvTbdi1rMkU00lZw= github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherwasm v1.1.0 h1:fA2uLoctU5+T3OhOn2vYP0DVT6pxc7xhTlBB1paATqQ= github.com/gopherjs/gopherwasm v1.1.0/go.mod h1:SkZ8z7CWBz5VXbhJel8TxCmAcsQqzgWGR/8nMhyhZSI= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/inconshreveable/mousetrap v1.0.0 h1:Z8tu5sraLXCXIcARxBp/8cbvlwVa7Z1NHg9XEKhtSvM= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -105,7 +52,6 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac= github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= @@ -116,63 +62,29 @@ github.com/mattn/go-runewidth v0.0.7 h1:Ei8KR0497xHyKJPAv59M1dkC+rOZCMBJ+t3fZ+tw github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mdp/qrterminal v1.0.1 h1:07+fzVDlPuBlXS8tB0ktTAyf+Lp1j2+2zK3fBOL5b7c= github.com/mdp/qrterminal v1.0.1/go.mod h1:Z33WhxQe9B6CdW37HaVqcRKzP+kByF3q/qLxOGe12xQ= github.com/mdp/qrterminal/v3 v3.0.0 h1:ywQqLRBXWTktytQNDKFjhAvoGkLVN3J2tAFZ0kMd9xQ= github.com/mdp/qrterminal/v3 v3.0.0/go.mod h1:NJpfAs7OAm77Dy8EkWrtE4aq+cE6McoLXlBqXQEwvE0= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rivo/uniseg v0.1.0 h1:+2KBaVoUmb9XzDsrx/Ct0W/EYOSFf/nWTauy++DprtY= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/robertkrimen/otto v0.0.0-20200922221731-ef014fd054ac h1:kYPjbEN6YPYWWHI6ky1J813KzIq/8+Wg4TO4xU7A/KU= github.com/robertkrimen/otto v0.0.0-20200922221731-ef014fd054ac/go.mod h1:xvqspoSXJTIpemEonrMDFq6XzwHYYgToXWj5eRX1OtY= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.5.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 h1:JIAuq3EEf9cgbU6AtGPK4CTG3Zf6CKMNqf0MHTggAUA= github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog= -github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v1.0.0 h1:6m/oheQuQ13N9ks4hubMG6BnvwOeaJrqSPLahSnczz8= -github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.3 h1:zPAT6CGy6wXeQ7NtTnaTerfKOsV6V6F8agHXFiazDkg= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= @@ -181,50 +93,12 @@ github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJy github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af h1:6yITBqGTE2lEeTPG04SN9W+iWHCRyHqlVYILiSXziwk= github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af/go.mod h1:4F09kP5F+am0jAwlQLddpoMDM+iewkxxt6nxUQ5nq5o= -github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= -github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E= golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208 h1:qwRHBd0NqMbJxfbotnDhm2ByMI1Shq4Y6oRJo21SGJA= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -233,59 +107,19 @@ golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200413165638-669c56c373c4 h1:opSr2sbRXk5X5/givKrrKj9HXxFpW2sdCiP8MJSKLQY= golang.org/x/sys v0.0.0-20200413165638-669c56c373c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200731060945-b5fad4ed8dd6/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20201028153306-37f0764111ff h1:TU04fJ6/hxmk+6BeFPKM3iuCGqj0ep6ghDdEdhN1cnk= -golang.org/x/tools v0.0.0-20201028153306-37f0764111ff/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= -golang.org/x/tools v0.0.0-20201112171726-b38955972a18 h1:zCVX0Qx6zEiwi5lM2jprfSFA6i6GWMXmY8o0VxPyCfo= -golang.org/x/tools v0.0.0-20201112171726-b38955972a18/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools/gopls v0.5.2 h1:lyHTekqy0QhXzz5hDFnfMGHk0Qmuq+LWH5VN/o19YLk= -golang.org/x/tools/gopls v0.5.2/go.mod h1:Ye30ua0XTIpPhh5d9Mdz5ohQchW2pCnpwCj24FWNw9g= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/sourcemap.v1 v1.0.5 h1:inv58fC9f9J3TK2Y2R1NPntXEn3/wjWHkonhIUODNTI= gopkg.in/sourcemap.v1 v1.0.5/go.mod h1:2RlvNNSMglmRrcvhfuzp4hQHwOtjxlbjX7UPY/GXb78= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2020.1.5 h1:nI5egYTGJakVyOryqLs1cQO5dO0ksin5XXs2pspk75k= -honnef.co/go/tools v0.0.1-2020.1.5/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -mvdan.cc/gofumpt v0.0.0-20200802201014-ab5a8192947d h1:t8TAw9WgTLghti7RYkpPmqk4JtQ3+wcP5GgZqgWeWLQ= -mvdan.cc/gofumpt v0.0.0-20200802201014-ab5a8192947d/go.mod h1:bzrjFmaD6+xqohD3KYP0H2FEuxknnBmyyOxdhLdaIws= -mvdan.cc/xurls/v2 v2.2.0 h1:NSZPykBXJFCetGZykLAxaL6SIpvbVy/UFEniIfHAa8A= -mvdan.cc/xurls/v2 v2.2.0/go.mod h1:EV1RMtya9D6G5DMYPGD8zTQzaHet6Jh8gFlRgGRJeO8= rsc.io/qr v0.2.0 h1:6vBLea5/NRMVTz8V66gipeLycZMl/+UlFmk8DvqQ6WY= rsc.io/qr v0.2.0/go.mod h1:IF+uZjkb9fqyeF/4tlBoynqmQxUoPfWEKh921coOuXs= From 9e0b15ddbbd36152a647913889c0840c5e65e9b5 Mon Sep 17 00:00:00 2001 From: Daniel Perez Date: Tue, 17 Nov 2020 11:02:16 +0100 Subject: [PATCH 12/31] Vim directional keys working everywhere (only in visual mode) --- go.sum | 151 +++++++++++++++++++++++++++++++++++++++++ shortcuts/shortcuts.go | 2 +- ui/window.go | 41 +++-------- 3 files changed, 162 insertions(+), 32 deletions(-) diff --git a/go.sum b/go.sum index 78931bda..bbe277d5 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,4 @@ +cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/Bios-Marcel/discordemojimap v1.0.1 h1:b3UYPO7+h1+ciStkwU/KQCerOmpUNPHsBf4a7EjMdys= github.com/Bios-Marcel/discordemojimap v1.0.1/go.mod h1:AoHIpUwf3EVCAAUmk+keXjb9khyZcFnW84/rhJd4IkU= github.com/Bios-Marcel/discordgo v0.21.2-0.20201025194456-7046b5509389 h1:Ha9AEp9HwOZElVwWWiA/aYU4g6dOYwJIhnxYf8XsNSo= @@ -6,6 +7,8 @@ github.com/Bios-Marcel/goclipimg v0.0.0-20191117180634-d0f7b06fbe82 h1:gspJ6CW9b github.com/Bios-Marcel/goclipimg v0.0.0-20191117180634-d0f7b06fbe82/go.mod h1:hiFR6fH5+uc/f2yK2syh/UfzaPfGo6F2HJSoiI4ufWU= github.com/Bios-Marcel/shortnotforlong v1.1.1 h1:cCJIp6MODd4rwH5Y+fAMAaIuFxS1FPKfwDbRzsCU9nM= github.com/Bios-Marcel/shortnotforlong v1.1.1/go.mod h1:g6bFiwq0pq7pqENRgHiCZu7uMzeYPIXwANlaBQ47LBw= +github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= +github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38 h1:smF2tmSOzy2Mm+0dGI2AIUHY+w0BUc+4tn40djz7+6U= github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38/go.mod h1:r7bzyVFMNntcxPZXK3/+KdruV1H5KSlyVY0gc+NgInI= github.com/alecthomas/chroma v0.7.3 h1:NfdAERMy+esYQs8OXk0I868/qDxxCEo7FMz1WIqMAeI= @@ -15,36 +18,82 @@ github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721/go.mod h1:QO9JBo github.com/alecthomas/kong v0.2.4/go.mod h1:kQOmtJgV+Lb4aj+I2LEn40cbtawdWJ9Y8QLq+lElKxE= github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897 h1:p9Sln00KOTlrYkxI1zYWl1QLnEqAqEARBEYa8FQnQcY= github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ= +github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= +github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= +github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/atotto/clipboard v0.1.2 h1:YZCtFu5Ie8qX2VmVTBnrqLSiU9XOWwqNRmdT3gIQzbY= github.com/atotto/clipboard v0.1.2/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= +github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= +github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= +github.com/bunyk/gokeybr v0.0.0-20201019133936-f9e4ed3fdc5d/go.mod h1:QoGx25FILnr4IxmvRiDOP8s41BaxhLKlxoBVU9suyRU= +github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= +github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= +github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= +github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= +github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= +github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= +github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= +github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 h1:y5HC9v93H5EPKqaS1UYVg1uYah5Xf51mBfIoWehClUQ= github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9hchkHSWYkEqJwUGisez3G1QY8Ryz0sdWrLPMGjLk= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= +github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dlclark/regexp2 v1.2.0 h1:8sAhBGEM0dRWogWqWyQeIJnxjWO6oIjl8FKqREDsGfk= github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= +github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko= github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg= +github.com/gdamore/tcell/v2 v2.0.0-dev/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA= github.com/gdamore/tcell/v2 v2.0.0 h1:GRWG8aLfWAlekj9Q6W29bVvkHENc6hp79XOqG4AWDOs= github.com/gdamore/tcell/v2 v2.0.0/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA= github.com/gen2brain/beeep v0.0.0-20200526185328-e9c15c258e28 h1:M2Zt3G2w6Q57GZndOYk42p7RvMeO8izO8yKTfIxGqxA= github.com/gen2brain/beeep v0.0.0-20200526185328-e9c15c258e28/go.mod h1:ElSskYZe3oM8kThaHGJ+kiN2yyUMVXMZ7WxF9QqLDS8= +github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= +github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= +github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= +github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= +github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4 h1:qZNfIGkIANxGv/OqtnntR4DfOY2+BgwR60cAcu/i3SE= github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4/go.mod h1:kW3HQ4UdaAyrUCSSDR4xUzBKW6O2iA4uHhk7AtyYp10= github.com/godbus/dbus/v5 v5.0.3 h1:ZqHaoEF7TBzh4jzPmqVhE/5A1z9of6orkAe5uHoAeME= github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= +github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= +github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= +github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= +github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= +github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= +github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= +github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-github/v29 v29.0.3 h1:IktKCTwU//aFHnpA+2SLIi7Oo9uhAzgsdZNbcAqhgdc= github.com/google/go-github/v29 v29.0.3/go.mod h1:CHKiKKPHJ0REzfwc14QMklvtHwCveD0PxlMjLlzAM5E= github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= +github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c h1:16eHWuMGvCjSfgRJKqIzapE78onvvTbdi1rMkU00lZw= github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherwasm v1.1.0 h1:fA2uLoctU5+T3OhOn2vYP0DVT6pxc7xhTlBB1paATqQ= github.com/gopherjs/gopherwasm v1.1.0/go.mod h1:SkZ8z7CWBz5VXbhJel8TxCmAcsQqzgWGR/8nMhyhZSI= +github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= +github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= +github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= +github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= +github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= +github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= +github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -52,6 +101,7 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac= github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= +github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= @@ -62,29 +112,61 @@ github.com/mattn/go-runewidth v0.0.7 h1:Ei8KR0497xHyKJPAv59M1dkC+rOZCMBJ+t3fZ+tw github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= +github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mdp/qrterminal v1.0.1 h1:07+fzVDlPuBlXS8tB0ktTAyf+Lp1j2+2zK3fBOL5b7c= github.com/mdp/qrterminal v1.0.1/go.mod h1:Z33WhxQe9B6CdW37HaVqcRKzP+kByF3q/qLxOGe12xQ= github.com/mdp/qrterminal/v3 v3.0.0 h1:ywQqLRBXWTktytQNDKFjhAvoGkLVN3J2tAFZ0kMd9xQ= github.com/mdp/qrterminal/v3 v3.0.0/go.mod h1:NJpfAs7OAm77Dy8EkWrtE4aq+cE6McoLXlBqXQEwvE0= +github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= +github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U= +github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= +github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= +github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= +github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= +github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= +github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= +github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= +github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= +github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rivo/uniseg v0.1.0 h1:+2KBaVoUmb9XzDsrx/Ct0W/EYOSFf/nWTauy++DprtY= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/robertkrimen/otto v0.0.0-20200922221731-ef014fd054ac h1:kYPjbEN6YPYWWHI6ky1J813KzIq/8+Wg4TO4xU7A/KU= github.com/robertkrimen/otto v0.0.0-20200922221731-ef014fd054ac/go.mod h1:xvqspoSXJTIpemEonrMDFq6XzwHYYgToXWj5eRX1OtY= +github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= +github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= +github.com/rogpeppe/go-internal v1.5.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= +github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= +github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= +github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 h1:JIAuq3EEf9cgbU6AtGPK4CTG3Zf6CKMNqf0MHTggAUA= github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog= +github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= +github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= +github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= +github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= +github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= +github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= +github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= +github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= @@ -93,12 +175,48 @@ github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJy github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af h1:6yITBqGTE2lEeTPG04SN9W+iWHCRyHqlVYILiSXziwk= github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af/go.mod h1:4F09kP5F+am0jAwlQLddpoMDM+iewkxxt6nxUQ5nq5o= +github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= +github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= +github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= +github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= +github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= +go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= +go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= +go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= +golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E= golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= +golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= +golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -107,19 +225,52 @@ golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200413165638-669c56c373c4 h1:opSr2sbRXk5X5/givKrrKj9HXxFpW2sdCiP8MJSKLQY= golang.org/x/sys v0.0.0-20200413165638-669c56c373c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= +golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200731060945-b5fad4ed8dd6/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= +golang.org/x/tools v0.0.0-20201028153306-37f0764111ff/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= +golang.org/x/tools v0.0.0-20201112171726-b38955972a18/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools/gopls v0.5.2/go.mod h1:Ye30ua0XTIpPhh5d9Mdz5ohQchW2pCnpwCj24FWNw9g= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= +google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= +google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= +gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= +gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/sourcemap.v1 v1.0.5 h1:inv58fC9f9J3TK2Y2R1NPntXEn3/wjWHkonhIUODNTI= gopkg.in/sourcemap.v1 v1.0.5/go.mod h1:2RlvNNSMglmRrcvhfuzp4hQHwOtjxlbjX7UPY/GXb78= +gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +honnef.co/go/tools v0.0.1-2020.1.5/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= +mvdan.cc/gofumpt v0.0.0-20200802201014-ab5a8192947d/go.mod h1:bzrjFmaD6+xqohD3KYP0H2FEuxknnBmyyOxdhLdaIws= +mvdan.cc/xurls/v2 v2.2.0/go.mod h1:EV1RMtya9D6G5DMYPGD8zTQzaHet6Jh8gFlRgGRJeO8= rsc.io/qr v0.2.0 h1:6vBLea5/NRMVTz8V66gipeLycZMl/+UlFmk8DvqQ6WY= rsc.io/qr v0.2.0/go.mod h1:IF+uZjkb9fqyeF/4tlBoynqmQxUoPfWEKh921coOuXs= diff --git a/shortcuts/shortcuts.go b/shortcuts/shortcuts.go index 3339c2f6..4df324f1 100644 --- a/shortcuts/shortcuts.go +++ b/shortcuts/shortcuts.go @@ -330,7 +330,7 @@ var ( VimNormalMode = addShortcut("vim_normal_mode", "Return to vim normal mode", globalScope, nil, // FIXME escape key not working in my machine. Using hyphen instead temporarily. - addVimEvent(tcell.NewEventKey(tcell.KeyRune, '-', tcell.ModNone),tcell.NewEventKey(tcell.KeyRune, '-', tcell.ModNone),tcell.NewEventKey(tcell.KeyRune, '-', tcell.ModNone)), + addVimEvent(tcell.NewEventKey(tcell.KeyEscape, rune(tcell.KeyEscape), tcell.ModNone),tcell.NewEventKey(tcell.KeyEscape, rune(tcell.KeyEscape), tcell.ModNone),tcell.NewEventKey(tcell.KeyEscape, rune(tcell.KeyEscape), tcell.ModNone)), ) VimSimKeyUp = addShortcut("vim_sim_up", "Simulate an arrow key press in vim mode.", diff --git a/ui/window.go b/ui/window.go index b64b80d8..d96aa14a 100644 --- a/ui/window.go +++ b/ui/window.go @@ -769,16 +769,6 @@ func NewWindow(app *tview.Application, session *discordgo.Session, readyEvent *d newGuildHandler := func(event *tcell.EventKey) *tcell.EventKey { - // Workaround for vim bindings inside list - if shortcuts.VimSimKeyDown.Equals(event) { - return tcell.NewEventKey(tcell.KeyDown, rune(tcell.KeyDown), tcell.ModNone) - } else if shortcuts.VimSimKeyUp.Equals(event) { - return tcell.NewEventKey(tcell.KeyUp, rune(tcell.KeyUp), tcell.ModNone) - } else if shortcuts.VimSimKeyRight.Equals(event) { - return tcell.NewEventKey(tcell.KeyRight, rune(tcell.KeyRight), tcell.ModNone) - } else if shortcuts.VimSimKeyLeft.Equals(event) { - return tcell.NewEventKey(tcell.KeyLeft, rune(tcell.KeyLeft), tcell.ModNone) - } if shortcuts.GuildListMarkRead.Equals(event) { selectedGuildNode := guildList.GetCurrentNode() if selectedGuildNode != nil && !readstate.HasGuildBeenRead(selectedGuildNode.GetReference().(string)) { @@ -809,16 +799,6 @@ func NewWindow(app *tview.Application, session *discordgo.Session, readyEvent *d newChannelListHandler := func(event *tcell.EventKey) *tcell.EventKey { - // Workaround for vim bindings inside list - if shortcuts.VimSimKeyDown.Equals(event) { - return tcell.NewEventKey(tcell.KeyDown, rune(tcell.KeyDown), tcell.ModNone) - } else if shortcuts.VimSimKeyUp.Equals(event) { - return tcell.NewEventKey(tcell.KeyUp, rune(tcell.KeyUp), tcell.ModNone) - } else if shortcuts.VimSimKeyRight.Equals(event) { - return tcell.NewEventKey(tcell.KeyRight, rune(tcell.KeyRight), tcell.ModNone) - } else if shortcuts.VimSimKeyLeft.Equals(event) { - return tcell.NewEventKey(tcell.KeyLeft, rune(tcell.KeyLeft), tcell.ModNone) - } if shortcuts.ChannelTreeMarkRead.Equals(event) { selectedChannelNode := channelTree.GetCurrentNode() if selectedChannelNode != nil { @@ -2172,6 +2152,16 @@ func (window *Window) handleGlobalShortcuts(event *tcell.EventKey) *tcell.EventK return nil } + if shortcuts.VimSimKeyDown.Equals(event) && config.Current.VimMode.CurrentMode == vim.VisualMode { + return tcell.NewEventKey(tcell.KeyDown, rune(tcell.KeyDown), tcell.ModNone) + } else if shortcuts.VimSimKeyUp.Equals(event) && config.Current.VimMode.CurrentMode == vim.VisualMode { + return tcell.NewEventKey(tcell.KeyUp, rune(tcell.KeyUp), tcell.ModNone) + } else if shortcuts.VimSimKeyLeft.Equals(event) && config.Current.VimMode.CurrentMode == vim.VisualMode { + return tcell.NewEventKey(tcell.KeyLeft, rune(tcell.KeyLeft), tcell.ModNone) + } else if shortcuts.VimSimKeyRight.Equals(event) && config.Current.VimMode.CurrentMode == vim.VisualMode { + return tcell.NewEventKey(tcell.KeyRight, rune(tcell.KeyRight), tcell.ModNone) + } + window.app.QueueUpdateDraw(func() { }) @@ -2192,17 +2182,6 @@ func (window *Window) handleChatWindowShortcuts(event *tcell.EventKey) *tcell.Ev return event } - // Workaround for vim bindings inside list - if shortcuts.VimSimKeyDown.Equals(event) { - return tcell.NewEventKey(tcell.KeyDown, rune(tcell.KeyDown), tcell.ModNone) - } else if shortcuts.VimSimKeyUp.Equals(event) { - return tcell.NewEventKey(tcell.KeyUp, rune(tcell.KeyUp), tcell.ModNone) - } else if shortcuts.VimSimKeyRight.Equals(event) { - return tcell.NewEventKey(tcell.KeyRight, rune(tcell.KeyRight), tcell.ModNone) - } else if shortcuts.VimSimKeyLeft.Equals(event) { - return tcell.NewEventKey(tcell.KeyLeft, rune(tcell.KeyLeft), tcell.ModNone) - } - if shortcuts.DirectionalFocusHandling(event, window.app) == nil { return nil } From 1b1c0c1982c6cebff3935e26a8d8c8cab24ba342 Mon Sep 17 00:00:00 2001 From: Daniel Perez Date: Tue, 17 Nov 2020 11:39:51 +0100 Subject: [PATCH 13/31] Added brief manpage of vim mode --- app/app.go | 1 + commands/commandimpls/vim.go | 66 ++++++++++++++++++++++++++++++++++++ shortcuts/shortcuts.go | 2 +- 3 files changed, 68 insertions(+), 1 deletion(-) create mode 100644 commands/commandimpls/vim.go diff --git a/app/app.go b/app/app.go index 080c26fe..ab991f88 100644 --- a/app/app.go +++ b/app/app.go @@ -128,6 +128,7 @@ func SetupApplicationWithAccount(app *tview.Application, account string) { window.RegisterCommand(serverCreateCmd) window.RegisterCommand(commandimpls.NewServerCommand(serverJoinCmd, serverLeaveCmd, serverCreateCmd)) window.RegisterCommand(commandimpls.NewNickSetCmd(discord, window)) + window.RegisterCommand(commandimpls.NewVimCmd()) tfaEnableCmd := commandimpls.NewTFAEnableCommand(window, discord) tfaDisableCmd := commandimpls.NewTFADisableCommand(discord) tfaBackupGetCmd := commandimpls.NewTFABackupGetCmd(discord, window) diff --git a/commands/commandimpls/vim.go b/commands/commandimpls/vim.go new file mode 100644 index 00000000..b585d66a --- /dev/null +++ b/commands/commandimpls/vim.go @@ -0,0 +1,66 @@ +package commandimpls + +import ( + "fmt" + "io" + + "github.com/Bios-Marcel/cordless/config" + "github.com/Bios-Marcel/cordless/util/vim" +) + +const ( + vimOpenHelpPage = `[::b]NAME + vim-mode - minor vim mode for cordless + +[::b]SYNOPSIS + [::b]Normal Mode: Navigate around the containers with hjkl. + Perform some usual commands inside text box input, as pasting, moving cursor or such. + Press ESC anywhere to return to normal mode. + + [::b]Insert Mode: Type inside box input, perform actions inside chatview. + Insert without any key restriction inside the text box using insert mode. + Inside chat view, perform useful commands such as editing message "i" or replying to user "a" + + [::b]Visual Mode: Move around everywhere with vim keys. + This mode allows to use hjkl pretty much anywhere inside the app. Due to some restrictions, this is + the only mode that officially supports using hjkl anywhere. + Also allows using same commands as insert mode inside chat view, or selecting text inside text input. + + +[::b]DESCRIPTION + This is a minor mode for vim. See all the shorcuts with Ctrl K, and edit them inside shortcuts/shortcuts.go` +) + +type VimHelp struct { +} + +func NewVimCmd() *VimHelp { + return new(VimHelp) +} + +// PrintHelp prints a static help page for this command +func (v VimHelp) PrintHelp(writer io.Writer) { + fmt.Fprintln(writer, vimOpenHelpPage) +} + +func (v VimHelp) Execute(writer io.Writer, parameters []string) { + if config.Current.VimMode.CurrentMode == vim.Disabled { + config.Current.VimMode.Normal() + fmt.Fprintf(writer, "Vim mode enabled") + } else { + config.Current.VimMode.SetMode(vim.Disabled) + fmt.Fprintf(writer, "Vim mode disabled") + } + config.PersistConfig() +} + +// Name returns the primary name for this command. This name will also be +// used for listing the command in the commandlist. +func (v VimHelp) Name() string { + return "vim" +} + +// Aliases are a list of aliases for this command. There might be none. +func (v VimHelp) Aliases() []string { + return []string{"vim", "vim-mode"} +} diff --git a/shortcuts/shortcuts.go b/shortcuts/shortcuts.go index 4df324f1..3339c2f6 100644 --- a/shortcuts/shortcuts.go +++ b/shortcuts/shortcuts.go @@ -330,7 +330,7 @@ var ( VimNormalMode = addShortcut("vim_normal_mode", "Return to vim normal mode", globalScope, nil, // FIXME escape key not working in my machine. Using hyphen instead temporarily. - addVimEvent(tcell.NewEventKey(tcell.KeyEscape, rune(tcell.KeyEscape), tcell.ModNone),tcell.NewEventKey(tcell.KeyEscape, rune(tcell.KeyEscape), tcell.ModNone),tcell.NewEventKey(tcell.KeyEscape, rune(tcell.KeyEscape), tcell.ModNone)), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, '-', tcell.ModNone),tcell.NewEventKey(tcell.KeyRune, '-', tcell.ModNone),tcell.NewEventKey(tcell.KeyRune, '-', tcell.ModNone)), ) VimSimKeyUp = addShortcut("vim_sim_up", "Simulate an arrow key press in vim mode.", From 86df4fd5493f55304a26f3976d11809daeaeb8a9 Mon Sep 17 00:00:00 2001 From: Daniel Perez Date: Tue, 17 Nov 2020 11:41:37 +0100 Subject: [PATCH 14/31] Fixed normal mode binding --- shortcuts/shortcuts.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shortcuts/shortcuts.go b/shortcuts/shortcuts.go index 3339c2f6..4df324f1 100644 --- a/shortcuts/shortcuts.go +++ b/shortcuts/shortcuts.go @@ -330,7 +330,7 @@ var ( VimNormalMode = addShortcut("vim_normal_mode", "Return to vim normal mode", globalScope, nil, // FIXME escape key not working in my machine. Using hyphen instead temporarily. - addVimEvent(tcell.NewEventKey(tcell.KeyRune, '-', tcell.ModNone),tcell.NewEventKey(tcell.KeyRune, '-', tcell.ModNone),tcell.NewEventKey(tcell.KeyRune, '-', tcell.ModNone)), + addVimEvent(tcell.NewEventKey(tcell.KeyEscape, rune(tcell.KeyEscape), tcell.ModNone),tcell.NewEventKey(tcell.KeyEscape, rune(tcell.KeyEscape), tcell.ModNone),tcell.NewEventKey(tcell.KeyEscape, rune(tcell.KeyEscape), tcell.ModNone)), ) VimSimKeyUp = addShortcut("vim_sim_up", "Simulate an arrow key press in vim mode.", From a2cc7de4b6ddb3724f1ff5c566a57a62fe1d0ebd Mon Sep 17 00:00:00 2001 From: Daniel Perez Date: Tue, 17 Nov 2020 11:45:21 +0100 Subject: [PATCH 15/31] Removed useless go sum lines --- go.sum | 151 --------------------------------------------------------- 1 file changed, 151 deletions(-) diff --git a/go.sum b/go.sum index bbe277d5..78931bda 100644 --- a/go.sum +++ b/go.sum @@ -1,4 +1,3 @@ -cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= github.com/Bios-Marcel/discordemojimap v1.0.1 h1:b3UYPO7+h1+ciStkwU/KQCerOmpUNPHsBf4a7EjMdys= github.com/Bios-Marcel/discordemojimap v1.0.1/go.mod h1:AoHIpUwf3EVCAAUmk+keXjb9khyZcFnW84/rhJd4IkU= github.com/Bios-Marcel/discordgo v0.21.2-0.20201025194456-7046b5509389 h1:Ha9AEp9HwOZElVwWWiA/aYU4g6dOYwJIhnxYf8XsNSo= @@ -7,8 +6,6 @@ github.com/Bios-Marcel/goclipimg v0.0.0-20191117180634-d0f7b06fbe82 h1:gspJ6CW9b github.com/Bios-Marcel/goclipimg v0.0.0-20191117180634-d0f7b06fbe82/go.mod h1:hiFR6fH5+uc/f2yK2syh/UfzaPfGo6F2HJSoiI4ufWU= github.com/Bios-Marcel/shortnotforlong v1.1.1 h1:cCJIp6MODd4rwH5Y+fAMAaIuFxS1FPKfwDbRzsCU9nM= github.com/Bios-Marcel/shortnotforlong v1.1.1/go.mod h1:g6bFiwq0pq7pqENRgHiCZu7uMzeYPIXwANlaBQ47LBw= -github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38 h1:smF2tmSOzy2Mm+0dGI2AIUHY+w0BUc+4tn40djz7+6U= github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38/go.mod h1:r7bzyVFMNntcxPZXK3/+KdruV1H5KSlyVY0gc+NgInI= github.com/alecthomas/chroma v0.7.3 h1:NfdAERMy+esYQs8OXk0I868/qDxxCEo7FMz1WIqMAeI= @@ -18,82 +15,36 @@ github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721/go.mod h1:QO9JBo github.com/alecthomas/kong v0.2.4/go.mod h1:kQOmtJgV+Lb4aj+I2LEn40cbtawdWJ9Y8QLq+lElKxE= github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897 h1:p9Sln00KOTlrYkxI1zYWl1QLnEqAqEARBEYa8FQnQcY= github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ= -github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= -github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/atotto/clipboard v0.1.2 h1:YZCtFu5Ie8qX2VmVTBnrqLSiU9XOWwqNRmdT3gIQzbY= github.com/atotto/clipboard v0.1.2/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= -github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= -github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= -github.com/bunyk/gokeybr v0.0.0-20201019133936-f9e4ed3fdc5d/go.mod h1:QoGx25FILnr4IxmvRiDOP8s41BaxhLKlxoBVU9suyRU= -github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= -github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk= -github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= -github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/coreos/go-systemd v0.0.0-20190321100706-95778dfbb74e/go.mod h1:F5haX7vjVVG0kc13fIWeqUViNPyEJxv/OmvnBo0Yme4= -github.com/coreos/pkg v0.0.0-20180928190104-399ea9e2e55f/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= -github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 h1:y5HC9v93H5EPKqaS1UYVg1uYah5Xf51mBfIoWehClUQ= github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9hchkHSWYkEqJwUGisez3G1QY8Ryz0sdWrLPMGjLk= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ= -github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= github.com/dlclark/regexp2 v1.2.0 h1:8sAhBGEM0dRWogWqWyQeIJnxjWO6oIjl8FKqREDsGfk= github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= -github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko= github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg= -github.com/gdamore/tcell/v2 v2.0.0-dev/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA= github.com/gdamore/tcell/v2 v2.0.0 h1:GRWG8aLfWAlekj9Q6W29bVvkHENc6hp79XOqG4AWDOs= github.com/gdamore/tcell/v2 v2.0.0/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA= github.com/gen2brain/beeep v0.0.0-20200526185328-e9c15c258e28 h1:M2Zt3G2w6Q57GZndOYk42p7RvMeO8izO8yKTfIxGqxA= github.com/gen2brain/beeep v0.0.0-20200526185328-e9c15c258e28/go.mod h1:ElSskYZe3oM8kThaHGJ+kiN2yyUMVXMZ7WxF9QqLDS8= -github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= -github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= -github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= -github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk= -github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4 h1:qZNfIGkIANxGv/OqtnntR4DfOY2+BgwR60cAcu/i3SE= github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4/go.mod h1:kW3HQ4UdaAyrUCSSDR4xUzBKW6O2iA4uHhk7AtyYp10= github.com/godbus/dbus/v5 v5.0.3 h1:ZqHaoEF7TBzh4jzPmqVhE/5A1z9of6orkAe5uHoAeME= github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= -github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= -github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= -github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= -github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= -github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= -github.com/google/go-cmp v0.5.1/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-github/v29 v29.0.3 h1:IktKCTwU//aFHnpA+2SLIi7Oo9uhAzgsdZNbcAqhgdc= github.com/google/go-github/v29 v29.0.3/go.mod h1:CHKiKKPHJ0REzfwc14QMklvtHwCveD0PxlMjLlzAM5E= github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= -github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c h1:16eHWuMGvCjSfgRJKqIzapE78onvvTbdi1rMkU00lZw= github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherwasm v1.1.0 h1:fA2uLoctU5+T3OhOn2vYP0DVT6pxc7xhTlBB1paATqQ= github.com/gopherjs/gopherwasm v1.1.0/go.mod h1:SkZ8z7CWBz5VXbhJel8TxCmAcsQqzgWGR/8nMhyhZSI= -github.com/gorilla/websocket v1.4.0/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/grpc-ecosystem/go-grpc-middleware v1.0.0/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= -github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= -github.com/grpc-ecosystem/grpc-gateway v1.9.0/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= -github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= -github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= -github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= -github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= -github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= -github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= -github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -101,7 +52,6 @@ github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac= github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= -github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= @@ -112,61 +62,29 @@ github.com/mattn/go-runewidth v0.0.7 h1:Ei8KR0497xHyKJPAv59M1dkC+rOZCMBJ+t3fZ+tw github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= github.com/mdp/qrterminal v1.0.1 h1:07+fzVDlPuBlXS8tB0ktTAyf+Lp1j2+2zK3fBOL5b7c= github.com/mdp/qrterminal v1.0.1/go.mod h1:Z33WhxQe9B6CdW37HaVqcRKzP+kByF3q/qLxOGe12xQ= github.com/mdp/qrterminal/v3 v3.0.0 h1:ywQqLRBXWTktytQNDKFjhAvoGkLVN3J2tAFZ0kMd9xQ= github.com/mdp/qrterminal/v3 v3.0.0/go.mod h1:NJpfAs7OAm77Dy8EkWrtE4aq+cE6McoLXlBqXQEwvE0= -github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= -github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= -github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= -github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= -github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw= -github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso= -github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= -github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= -github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= -github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= -github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= github.com/rivo/uniseg v0.1.0 h1:+2KBaVoUmb9XzDsrx/Ct0W/EYOSFf/nWTauy++DprtY= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/robertkrimen/otto v0.0.0-20200922221731-ef014fd054ac h1:kYPjbEN6YPYWWHI6ky1J813KzIq/8+Wg4TO4xU7A/KU= github.com/robertkrimen/otto v0.0.0-20200922221731-ef014fd054ac/go.mod h1:xvqspoSXJTIpemEonrMDFq6XzwHYYgToXWj5eRX1OtY= -github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= -github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.5.2/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= -github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sergi/go-diff v1.0.0 h1:Kpca3qRNrduNnOQeazBd0ysaKrUJiIuISHxogkT9RPQ= github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= github.com/sergi/go-diff v1.1.0 h1:we8PVUC3FE2uYfodKH/nBHMSetSfHDR6scGdBi+erh0= github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= -github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= -github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 h1:JIAuq3EEf9cgbU6AtGPK4CTG3Zf6CKMNqf0MHTggAUA= github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog= -github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= -github.com/spaolacci/murmur3 v0.0.0-20180118202830-f09979ecbc72/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA= -github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ= -github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE= -github.com/spf13/cobra v1.0.0/go.mod h1:/6GTrnGXV9HjY+aR4k0oJ5tcvakLuG6EuKReYlHNrgE= -github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= -github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= -github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= -github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.2.2 h1:bSDNvY7ZPG5RlJ8otE/7V6gMiyenm9RtJ7IUVIAoJ1w= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0 h1:TivCn/peBQ7UY8ooIcPgZFpTNSz0Q2U6UrFlUfqbe0Q= @@ -175,48 +93,12 @@ github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJy github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af h1:6yITBqGTE2lEeTPG04SN9W+iWHCRyHqlVYILiSXziwk= github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af/go.mod h1:4F09kP5F+am0jAwlQLddpoMDM+iewkxxt6nxUQ5nq5o= -github.com/tmc/grpc-websocket-proxy v0.0.0-20190109142713-0ad062ec5ee5/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= -github.com/ugorji/go v1.1.4/go.mod h1:uQMGLiO92mf5W77hV/PUCpI3pbzQx3CRekS0kk+RGrc= -github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= -go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= -go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= -golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E= golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= -golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= -golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= -golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= -golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= -golang.org/x/net v0.0.0-20181220203305-927f97764cc3/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= -golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= -golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= -golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181107165924-66b7b1311ac8/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20181116152217-5ac8a444bdc5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -225,52 +107,19 @@ golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200413165638-669c56c373c4 h1:opSr2sbRXk5X5/givKrrKj9HXxFpW2sdCiP8MJSKLQY= golang.org/x/sys v0.0.0-20200413165638-669c56c373c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f h1:+Nyd8tzPX9R7BWHguqsrbFdRx3WQ/1ib8I44HXV5yTA= -golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= -golang.org/x/text v0.3.3 h1:cokOdA+Jmi5PJGXLlLllQSgYigAEfHXJAERHVMaCc2k= -golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= -golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= -golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= -golang.org/x/tools v0.0.0-20200731060945-b5fad4ed8dd6/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA= -golang.org/x/tools v0.0.0-20201028153306-37f0764111ff/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= -golang.org/x/tools v0.0.0-20201112171726-b38955972a18/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools/gopls v0.5.2/go.mod h1:Ye30ua0XTIpPhh5d9Mdz5ohQchW2pCnpwCj24FWNw9g= -golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= -google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc= -google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= -google.golang.org/grpc v1.21.0/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM= -gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo= gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= -gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/sourcemap.v1 v1.0.5 h1:inv58fC9f9J3TK2Y2R1NPntXEn3/wjWHkonhIUODNTI= gopkg.in/sourcemap.v1 v1.0.5/go.mod h1:2RlvNNSMglmRrcvhfuzp4hQHwOtjxlbjX7UPY/GXb78= -gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= -gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= -honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -honnef.co/go/tools v0.0.1-2020.1.5/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -mvdan.cc/gofumpt v0.0.0-20200802201014-ab5a8192947d/go.mod h1:bzrjFmaD6+xqohD3KYP0H2FEuxknnBmyyOxdhLdaIws= -mvdan.cc/xurls/v2 v2.2.0/go.mod h1:EV1RMtya9D6G5DMYPGD8zTQzaHet6Jh8gFlRgGRJeO8= rsc.io/qr v0.2.0 h1:6vBLea5/NRMVTz8V66gipeLycZMl/+UlFmk8DvqQ6WY= rsc.io/qr v0.2.0/go.mod h1:IF+uZjkb9fqyeF/4tlBoynqmQxUoPfWEKh921coOuXs= From 50509546ddaeaa3bf2d0a5e0b044f350edc2bf54 Mon Sep 17 00:00:00 2001 From: Daniel Perez Date: Tue, 17 Nov 2020 11:54:57 +0100 Subject: [PATCH 16/31] Added replace instruction in go.mod --- go.mod | 2 ++ 1 file changed, 2 insertions(+) diff --git a/go.mod b/go.mod index d3200a8e..a20c7e99 100644 --- a/go.mod +++ b/go.mod @@ -1,3 +1,5 @@ +replace github.com/Bios-Marcel/cordless => github.com/0xSteeW/cordless v0.0.0-20201117104521-a2cc7de4b6dd + module github.com/Bios-Marcel/cordless go 1.12 From 422d82512cbba1418d10672c405ab6452076bf59 Mon Sep 17 00:00:00 2001 From: Daniel Perez Date: Tue, 17 Nov 2020 12:13:33 +0100 Subject: [PATCH 17/31] Removed upstream fork from go.mod --- go.mod | 2 -- 1 file changed, 2 deletions(-) diff --git a/go.mod b/go.mod index a20c7e99..d3200a8e 100644 --- a/go.mod +++ b/go.mod @@ -1,5 +1,3 @@ -replace github.com/Bios-Marcel/cordless => github.com/0xSteeW/cordless v0.0.0-20201117104521-a2cc7de4b6dd - module github.com/Bios-Marcel/cordless go 1.12 From 87a8946a01110dd063c361bdb63f917643a3d1fe Mon Sep 17 00:00:00 2001 From: Daniel Perez Date: Tue, 17 Nov 2020 18:16:28 +0100 Subject: [PATCH 18/31] Fixed escape binding --- shortcuts/shortcuts.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/shortcuts/shortcuts.go b/shortcuts/shortcuts.go index 4df324f1..6c9719ca 100644 --- a/shortcuts/shortcuts.go +++ b/shortcuts/shortcuts.go @@ -330,7 +330,7 @@ var ( VimNormalMode = addShortcut("vim_normal_mode", "Return to vim normal mode", globalScope, nil, // FIXME escape key not working in my machine. Using hyphen instead temporarily. - addVimEvent(tcell.NewEventKey(tcell.KeyEscape, rune(tcell.KeyEscape), tcell.ModNone),tcell.NewEventKey(tcell.KeyEscape, rune(tcell.KeyEscape), tcell.ModNone),tcell.NewEventKey(tcell.KeyEscape, rune(tcell.KeyEscape), tcell.ModNone)), + addVimEvent(tcell.NewEventKey(tcell.KeyEscape, 0, tcell.ModNone),tcell.NewEventKey(tcell.KeyEscape, 0, tcell.ModNone),tcell.NewEventKey(tcell.KeyEscape, 0, tcell.ModNone)), ) VimSimKeyUp = addShortcut("vim_sim_up", "Simulate an arrow key press in vim mode.", @@ -351,6 +351,9 @@ var ( scopes []*Scope Shortcuts []*Shortcut + // VimKeyStore is needed to fix normal mode and visual mode accidentally typing inside the text box. + VimKeyStore map[string]string + // Key Mode ) // Vim event holds possible modifiers for keys. They can be nil. In that case, they will default From b55c3435f541fcf383006e53d2054ca17305ff2a Mon Sep 17 00:00:00 2001 From: Daniel Perez Date: Tue, 17 Nov 2020 18:50:08 +0100 Subject: [PATCH 19/31] Fixed shortcuts dialog inconsistency --- tview/application.go | 2 -- ui/window.go | 8 ++++++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/tview/application.go b/tview/application.go index 873d736f..03710572 100644 --- a/tview/application.go +++ b/tview/application.go @@ -535,8 +535,6 @@ func (a *Application) SetRoot(root Primitive, fullscreen bool) *Application { } a.Unlock() - a.SetFocus(root) - return a } diff --git a/ui/window.go b/ui/window.go index d96aa14a..53389e8e 100644 --- a/ui/window.go +++ b/ui/window.go @@ -2138,7 +2138,9 @@ func (window *Window) handleGlobalShortcuts(event *tcell.EventKey) *tcell.EventK //window#Shutdown unnecessary, as we shut the whole process down. window.app.Stop() return nil - } else if shortcuts.VimInsertMode.Equals(event) { + } + + if shortcuts.VimInsertMode.Equals(event) { config.Current.VimMode.Insert() window.vimStatus.Content = fmt.Sprintf("Vim: %s",config.Current.VimMode.CurrentModeString()) return nil @@ -2146,7 +2148,7 @@ func (window *Window) handleGlobalShortcuts(event *tcell.EventKey) *tcell.EventK config.Current.VimMode.Visual() window.vimStatus.Content = fmt.Sprintf("Vim: %s",config.Current.VimMode.CurrentModeString()) return nil - } else if shortcuts.VimNormalMode.Equals(event) { + } else if shortcuts.VimNormalMode.Equals(event) && window.app.GetRoot() == window.rootContainer { config.Current.VimMode.Normal() window.vimStatus.Content = fmt.Sprintf("Vim: %s",config.Current.VimMode.CurrentModeString()) return nil @@ -2195,6 +2197,8 @@ func (window *Window) handleChatWindowShortcuts(event *tcell.EventKey) *tcell.Ev } else if shortcuts.EventsEqual(event, shortcutsDialogShortcut) { shortcutdialog.ShowShortcutsDialog(window.app, func() { window.app.SetRoot(window.rootContainer, true) + // FIXME + window.app.SetFocus(window.chatView.GetPrimitive()) }) } else if shortcuts.ToggleCommandView.Equals(event) { window.SetCommandModeEnabled(!window.commandMode) From b38cbd974b6973bba4fcec19cf46a05fc7263df8 Mon Sep 17 00:00:00 2001 From: Daniel Perez Date: Tue, 17 Nov 2020 19:21:40 +0100 Subject: [PATCH 20/31] Fixed weird behaviour in text input --- ui/editor.go | 15 ++++----------- ui/window.go | 1 - 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/ui/editor.go b/ui/editor.go index 920b7d40..48eedc70 100644 --- a/ui/editor.go +++ b/ui/editor.go @@ -4,6 +4,7 @@ import ( "unicode" "github.com/Bios-Marcel/cordless/tview" + "github.com/Bios-Marcel/cordless/util/vim" "github.com/atotto/clipboard" tcell "github.com/gdamore/tcell/v2" @@ -418,17 +419,6 @@ func NewEditor() *Editor { if shortcuts.MoveCursorLeft.Equals(event) { editor.MoveCursorLeft() - // Vim mode shortcuts - } else if shortcuts.VimInsertMode.Equals(event) { - config.Current.VimMode.Insert() - return nil - } else if shortcuts.VimVisualMode.Equals(event) { - config.Current.VimMode.Visual() - return nil - } else if shortcuts.VimNormalMode.Equals(event) { - config.Current.VimMode.Normal() - - } else if shortcuts.ExpandSelectionToLeft.Equals(event) { editor.SelectionToLeft() } else if shortcuts.MoveCursorRight.Equals(event) { @@ -479,6 +469,9 @@ func NewEditor() *Editor { } else if shortcuts.InputNewLine.Equals(event) { editor.InsertCharacter('\n') } else if event.Rune() != 0 { + if config.Current.VimMode.CurrentMode != vim.Disabled && config.Current.VimMode.CurrentMode != vim.InsertMode { + return nil + } editor.InsertCharacter(event.Rune()) } diff --git a/ui/window.go b/ui/window.go index 53389e8e..d98abf21 100644 --- a/ui/window.go +++ b/ui/window.go @@ -2197,7 +2197,6 @@ func (window *Window) handleChatWindowShortcuts(event *tcell.EventKey) *tcell.Ev } else if shortcuts.EventsEqual(event, shortcutsDialogShortcut) { shortcutdialog.ShowShortcutsDialog(window.app, func() { window.app.SetRoot(window.rootContainer, true) - // FIXME window.app.SetFocus(window.chatView.GetPrimitive()) }) } else if shortcuts.ToggleCommandView.Equals(event) { From 6de4e41f827cd8f7319ee7582c6a018804208733 Mon Sep 17 00:00:00 2001 From: Daniel Perez Date: Wed, 18 Nov 2020 16:51:58 +0100 Subject: [PATCH 21/31] Changed expand selection shortcuts, conflicted with movement --- shortcuts/shortcuts.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shortcuts/shortcuts.go b/shortcuts/shortcuts.go index 6c9719ca..02585d70 100644 --- a/shortcuts/shortcuts.go +++ b/shortcuts/shortcuts.go @@ -103,12 +103,12 @@ var ( // START OF INPUT ExpandSelectionToLeft = addShortcut("expand_selection_word_to_left", "Expand selection word to left", multilineTextInput, tcell.NewEventKey(tcell.KeyLeft, 0, tcell.ModShift), - addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'h', tcell.ModNone)), + addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'H', tcell.ModNone)), ) ExpandSelectionToRight = addShortcut("expand_selection_word_to_right", "Expand selection word to right", multilineTextInput, tcell.NewEventKey(tcell.KeyRight, 0, tcell.ModShift), - addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'l', tcell.ModNone)), + addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'L', tcell.ModNone)), ) SelectAll = addShortcut("select_all", "Select all", From eea5b6b428afb75685d42181e843540921dd7d66 Mon Sep 17 00:00:00 2001 From: Daniel Perez Date: Wed, 18 Nov 2020 17:28:14 +0100 Subject: [PATCH 22/31] Vim can now be toggled in command mode --- app/app.go | 2 +- commands/commandimpls/vim.go | 26 +++++++++++++-------- ui/window.go | 44 +++++++++++++++++++----------------- 3 files changed, 41 insertions(+), 31 deletions(-) diff --git a/app/app.go b/app/app.go index ab991f88..4f4d3f63 100644 --- a/app/app.go +++ b/app/app.go @@ -128,7 +128,7 @@ func SetupApplicationWithAccount(app *tview.Application, account string) { window.RegisterCommand(serverCreateCmd) window.RegisterCommand(commandimpls.NewServerCommand(serverJoinCmd, serverLeaveCmd, serverCreateCmd)) window.RegisterCommand(commandimpls.NewNickSetCmd(discord, window)) - window.RegisterCommand(commandimpls.NewVimCmd()) + window.RegisterCommand(commandimpls.NewVimCmd(config.Current)) tfaEnableCmd := commandimpls.NewTFAEnableCommand(window, discord) tfaDisableCmd := commandimpls.NewTFADisableCommand(discord) tfaBackupGetCmd := commandimpls.NewTFABackupGetCmd(discord, window) diff --git a/commands/commandimpls/vim.go b/commands/commandimpls/vim.go index b585d66a..bcecc269 100644 --- a/commands/commandimpls/vim.go +++ b/commands/commandimpls/vim.go @@ -32,10 +32,11 @@ const ( ) type VimHelp struct { + Config *config.Config } -func NewVimCmd() *VimHelp { - return new(VimHelp) +func NewVimCmd(c *config.Config) *VimHelp { + return &VimHelp{Config: c} } // PrintHelp prints a static help page for this command @@ -44,14 +45,21 @@ func (v VimHelp) PrintHelp(writer io.Writer) { } func (v VimHelp) Execute(writer io.Writer, parameters []string) { - if config.Current.VimMode.CurrentMode == vim.Disabled { - config.Current.VimMode.Normal() - fmt.Fprintf(writer, "Vim mode enabled") - } else { - config.Current.VimMode.SetMode(vim.Disabled) - fmt.Fprintf(writer, "Vim mode disabled") + if len(parameters) < 1 { + fmt.Fprintf(writer, "You did not specify any parameter for this command.") + return + } + switch parameters[0] { + case "on","enable": + v.Config.VimMode.CurrentMode = vim.NormalMode + fmt.Fprintf(writer, "Vim mode has been enabled.") + case "off","disable": + v.Config.VimMode.CurrentMode = vim.NormalMode + v.Config.VimMode.CurrentMode = vim.Disabled + fmt.Fprintf(writer, "Vim mode has been disabled.") + default: + fmt.Fprintf(writer, "Parameter %s not recognized.", parameters[0]) } - config.PersistConfig() } // Name returns the primary name for this command. This name will also be diff --git a/ui/window.go b/ui/window.go index d98abf21..6012e035 100644 --- a/ui/window.go +++ b/ui/window.go @@ -2140,28 +2140,30 @@ func (window *Window) handleGlobalShortcuts(event *tcell.EventKey) *tcell.EventK return nil } - if shortcuts.VimInsertMode.Equals(event) { - config.Current.VimMode.Insert() - window.vimStatus.Content = fmt.Sprintf("Vim: %s",config.Current.VimMode.CurrentModeString()) - return nil - } else if shortcuts.VimVisualMode.Equals(event) { - config.Current.VimMode.Visual() - window.vimStatus.Content = fmt.Sprintf("Vim: %s",config.Current.VimMode.CurrentModeString()) - return nil - } else if shortcuts.VimNormalMode.Equals(event) && window.app.GetRoot() == window.rootContainer { - config.Current.VimMode.Normal() - window.vimStatus.Content = fmt.Sprintf("Vim: %s",config.Current.VimMode.CurrentModeString()) - return nil - } + if config.Current.VimMode.CurrentMode != vim.Disabled { + if shortcuts.VimInsertMode.Equals(event) { + config.Current.VimMode.Insert() + window.vimStatus.Content = fmt.Sprintf("Vim: %s",config.Current.VimMode.CurrentModeString()) + return nil + } else if shortcuts.VimVisualMode.Equals(event) { + config.Current.VimMode.Visual() + window.vimStatus.Content = fmt.Sprintf("Vim: %s",config.Current.VimMode.CurrentModeString()) + return nil + } else if shortcuts.VimNormalMode.Equals(event) && window.app.GetRoot() == window.rootContainer { + config.Current.VimMode.Normal() + window.vimStatus.Content = fmt.Sprintf("Vim: %s",config.Current.VimMode.CurrentModeString()) + return nil + } - if shortcuts.VimSimKeyDown.Equals(event) && config.Current.VimMode.CurrentMode == vim.VisualMode { - return tcell.NewEventKey(tcell.KeyDown, rune(tcell.KeyDown), tcell.ModNone) - } else if shortcuts.VimSimKeyUp.Equals(event) && config.Current.VimMode.CurrentMode == vim.VisualMode { - return tcell.NewEventKey(tcell.KeyUp, rune(tcell.KeyUp), tcell.ModNone) - } else if shortcuts.VimSimKeyLeft.Equals(event) && config.Current.VimMode.CurrentMode == vim.VisualMode { - return tcell.NewEventKey(tcell.KeyLeft, rune(tcell.KeyLeft), tcell.ModNone) - } else if shortcuts.VimSimKeyRight.Equals(event) && config.Current.VimMode.CurrentMode == vim.VisualMode { - return tcell.NewEventKey(tcell.KeyRight, rune(tcell.KeyRight), tcell.ModNone) + if shortcuts.VimSimKeyDown.Equals(event) && config.Current.VimMode.CurrentMode == vim.VisualMode { + return tcell.NewEventKey(tcell.KeyDown, rune(tcell.KeyDown), tcell.ModNone) + } else if shortcuts.VimSimKeyUp.Equals(event) && config.Current.VimMode.CurrentMode == vim.VisualMode { + return tcell.NewEventKey(tcell.KeyUp, rune(tcell.KeyUp), tcell.ModNone) + } else if shortcuts.VimSimKeyLeft.Equals(event) && config.Current.VimMode.CurrentMode == vim.VisualMode { + return tcell.NewEventKey(tcell.KeyLeft, rune(tcell.KeyLeft), tcell.ModNone) + } else if shortcuts.VimSimKeyRight.Equals(event) && config.Current.VimMode.CurrentMode == vim.VisualMode { + return tcell.NewEventKey(tcell.KeyRight, rune(tcell.KeyRight), tcell.ModNone) + } } window.app.QueueUpdateDraw(func() { From 1cc4e2084c9969d442a7832621d7febb9275931d Mon Sep 17 00:00:00 2001 From: Daniel Perez Date: Wed, 18 Nov 2020 17:29:28 +0100 Subject: [PATCH 23/31] Added vim command synopsis toggle line --- commands/commandimpls/vim.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/commands/commandimpls/vim.go b/commands/commandimpls/vim.go index bcecc269..fe0e7a05 100644 --- a/commands/commandimpls/vim.go +++ b/commands/commandimpls/vim.go @@ -28,7 +28,9 @@ const ( [::b]DESCRIPTION - This is a minor mode for vim. See all the shorcuts with Ctrl K, and edit them inside shortcuts/shortcuts.go` + This is a minor mode for vim. See all the shorcuts with Ctrl K, and edit them inside shortcuts/shortcuts.go + Toggle vim with vim on/off/enable/disable +` ) type VimHelp struct { From 9e8bd4c685f2d4cb2abca34a1e4bdc903a27f3d2 Mon Sep 17 00:00:00 2001 From: Daniel Perez Date: Thu, 19 Nov 2020 11:26:23 +0100 Subject: [PATCH 24/31] Moved VimMode to app instead of config --- app/app.go | 4 +- commands/commandimpls/vim.go | 17 +++--- config/config.go | 5 +- main.go | 2 +- shortcuts/shortcuts.go | 13 +++-- tview/application.go | 6 ++- ui/commandview.go | 4 +- ui/editor.go | 7 ++- ui/shortcutdialog/dialog.go | 6 +-- ui/shortcutdialog/table.go | 102 +++++++++++++++++++---------------- ui/window.go | 34 ++++++------ util/vim/vim.go | 8 +++ 12 files changed, 117 insertions(+), 91 deletions(-) diff --git a/app/app.go b/app/app.go index 4f4d3f63..9dd61b33 100644 --- a/app/app.go +++ b/app/app.go @@ -42,7 +42,7 @@ func SetupApplicationWithAccount(app *tview.Application, account string) { configuration.Token = configuration.GetAccountToken(account) } - shortcutsLoadError := shortcuts.Load() + shortcutsLoadError := shortcuts.Load(app.VimMode) if shortcutsLoadError != nil { panic(shortcutsLoadError) } @@ -128,7 +128,7 @@ func SetupApplicationWithAccount(app *tview.Application, account string) { window.RegisterCommand(serverCreateCmd) window.RegisterCommand(commandimpls.NewServerCommand(serverJoinCmd, serverLeaveCmd, serverCreateCmd)) window.RegisterCommand(commandimpls.NewNickSetCmd(discord, window)) - window.RegisterCommand(commandimpls.NewVimCmd(config.Current)) + window.RegisterCommand(commandimpls.NewVimCmd(app.VimMode)) tfaEnableCmd := commandimpls.NewTFAEnableCommand(window, discord) tfaDisableCmd := commandimpls.NewTFADisableCommand(discord) tfaBackupGetCmd := commandimpls.NewTFABackupGetCmd(discord, window) diff --git a/commands/commandimpls/vim.go b/commands/commandimpls/vim.go index fe0e7a05..e7625b37 100644 --- a/commands/commandimpls/vim.go +++ b/commands/commandimpls/vim.go @@ -4,7 +4,6 @@ import ( "fmt" "io" - "github.com/Bios-Marcel/cordless/config" "github.com/Bios-Marcel/cordless/util/vim" ) @@ -34,11 +33,11 @@ const ( ) type VimHelp struct { - Config *config.Config + vimMode *vim.Vim } -func NewVimCmd(c *config.Config) *VimHelp { - return &VimHelp{Config: c} +func NewVimCmd(vimMode *vim.Vim) *VimHelp { + return &VimHelp{vimMode: vimMode} } // PrintHelp prints a static help page for this command @@ -53,12 +52,12 @@ func (v VimHelp) Execute(writer io.Writer, parameters []string) { } switch parameters[0] { case "on","enable": - v.Config.VimMode.CurrentMode = vim.NormalMode - fmt.Fprintf(writer, "Vim mode has been enabled.") + v.vimMode.CurrentMode = vim.NormalMode + fmt.Fprintf(writer, "Vim mode has been enabled.\n") case "off","disable": - v.Config.VimMode.CurrentMode = vim.NormalMode - v.Config.VimMode.CurrentMode = vim.Disabled - fmt.Fprintf(writer, "Vim mode has been disabled.") + v.vimMode.CurrentMode = vim.NormalMode + v.vimMode.CurrentMode = vim.Disabled + fmt.Fprintf(writer, "Vim mode has been disabled.\n") default: fmt.Fprintf(writer, "Parameter %s not recognized.", parameters[0]) } diff --git a/config/config.go b/config/config.go index b949d3ae..544719f3 100644 --- a/config/config.go +++ b/config/config.go @@ -9,7 +9,6 @@ import ( "strings" "github.com/Bios-Marcel/cordless/util/files" - "github.com/Bios-Marcel/cordless/util/vim" ) const ( @@ -157,7 +156,7 @@ type Config struct { // true, then all opened files are saved in this folder for example. FileDownloadSaveLocation string - VimMode *vim.Vim + VimEnabled bool } // Account has a name and a token. The name is just for the users recognition. @@ -214,7 +213,7 @@ func createDefaultConfig() *Config { FileOpenHandlers: make(map[string]string), FileOpenSaveFilesPermanently: false, FileDownloadSaveLocation: "~/Downloads", - VimMode: &vim.Vim{CurrentMode: vim.Disabled}, + VimEnabled: false, } } diff --git a/main.go b/main.go index 488a14dd..c88e8ec5 100644 --- a/main.go +++ b/main.go @@ -63,7 +63,7 @@ func main() { fmt.Printf("You are running cordless version %s\nKeep in mind that this version might not be correct for manually built versions, as those can contain additional commits.\n", version.Version) } else { //App that will be reused throughout the process runtime. - tviewApp := tview.NewApplication() + tviewApp := tview.NewApplication(config.Current.VimEnabled) if accountToUse != nil && *accountToUse != "" { app.SetupApplicationWithAccount(tviewApp, *accountToUse) diff --git a/shortcuts/shortcuts.go b/shortcuts/shortcuts.go index 02585d70..76084ac4 100644 --- a/shortcuts/shortcuts.go +++ b/shortcuts/shortcuts.go @@ -426,6 +426,10 @@ type Shortcut struct { //This shortcuts default, in order to be able to reset it. defaultEvent *tcell.EventKey + // Every shortcut receives a pointer to vimMode, therefore not + // wasting memory + VimStatus *vim.Vim + // VimModifier is the shortcut that will be used inside vim mode. VimModifier *VimEvent } @@ -433,19 +437,19 @@ type Shortcut struct { // Equals compares the given EventKey with the Shortcuts Event. // If any vim mode is enabled, it will replace the default event. func (shortcut *Shortcut) Equals(event *tcell.EventKey) bool { - if config.Current.VimMode.CurrentMode == vim.NormalMode { + if shortcut.VimStatus.CurrentMode == vim.NormalMode { selectedEvent := shortcut.VimModifier.NormalEvent if selectedEvent == nil { selectedEvent = shortcut.Event } return EventsEqual(selectedEvent, event) - } else if config.Current.VimMode.CurrentMode == vim.InsertMode { + } else if shortcut.VimStatus.CurrentMode == vim.InsertMode { selectedEvent := shortcut.VimModifier.InsertEvent if selectedEvent == nil { selectedEvent = shortcut.Event } return EventsEqual(selectedEvent, event) - } else if config.Current.VimMode.CurrentMode == vim.VisualMode { + } else if shortcut.VimStatus.CurrentMode == vim.VisualMode { selectedEvent := shortcut.VimModifier.VisualEvent if selectedEvent == nil { selectedEvent = shortcut.Event @@ -560,7 +564,7 @@ func getShortcutsPath() (string, error) { // Load loads the shortcuts and copies the events to the correct shortcuts // that reside inside of the memory. -func Load() error { +func Load(vimMode *vim.Vim) error { shortcutsPath, pathError := getShortcutsPath() if pathError != nil { return pathError @@ -596,6 +600,7 @@ OUTER_LOOP: if otherShortcut.Identifier == shortcut.Identifier && otherShortcut.Scope.Identifier == shortcut.Scope.Identifier { otherShortcut.Event = shortcut.Event + otherShortcut.VimStatus = vimMode continue OUTER_LOOP } } diff --git a/tview/application.go b/tview/application.go index 03710572..c32e07bf 100644 --- a/tview/application.go +++ b/tview/application.go @@ -3,6 +3,7 @@ package tview import ( "sync" + "github.com/Bios-Marcel/cordless/util/vim" tcell "github.com/gdamore/tcell/v2" ) @@ -66,15 +67,18 @@ type Application struct { // (screen.Init() and draw() will be called implicitly). A value of nil will // stop the application. screenReplacement chan tcell.Screen + + VimMode *vim.Vim } // NewApplication creates and returns a new application. -func NewApplication() *Application { +func NewApplication(vimEnabled bool) *Application { return &Application{ events: make(chan tcell.Event, queueSize), updates: make(chan func(), queueSize), screenReplacement: make(chan tcell.Screen, 1), MouseEnabled: true, + VimMode: vim.NewVim(vimEnabled), } } diff --git a/ui/commandview.go b/ui/commandview.go index 8269bb83..219737f3 100644 --- a/ui/commandview.go +++ b/ui/commandview.go @@ -27,7 +27,7 @@ type CommandView struct { // NewCommandView creates a new struct containing the components necessary // for a command view. It also contains the state for those components. -func NewCommandView(onExecuteCommand func(command string)) *CommandView { +func NewCommandView(vimMode *int,onExecuteCommand func(command string)) *CommandView { commandOutput := tview.NewTextView() commandOutput.SetDynamicColors(true). SetWordWrap(true). @@ -36,7 +36,7 @@ func NewCommandView(onExecuteCommand func(command string)) *CommandView { SetBorder(true). SetIndicateOverflow(true) - commandInput := NewEditor() + commandInput := NewEditor(vimMode) commandInput.internalTextView. SetWrap(false). SetWordWrap(false) diff --git a/ui/editor.go b/ui/editor.go index 48eedc70..288c2f39 100644 --- a/ui/editor.go +++ b/ui/editor.go @@ -28,6 +28,8 @@ type Editor struct { heightRequestHandler func(requestHeight int) requestedHeight int autocompleteFrom *femto.Loc + + vimMode *int } func (editor *Editor) applyBuffer() { @@ -388,12 +390,13 @@ func (editor *Editor) InsertCharacter(character rune) { } // NewEditor instantiates a ready to use text editor. -func NewEditor() *Editor { +func NewEditor(vimMode *int) *Editor { editor := Editor{ internalTextView: tview.NewTextView(), requestedHeight: 3, buffer: femto.NewBufferFromString("", ""), tempBuffer: femto.NewBufferFromString("", ""), + vimMode: vimMode, } editor.internalTextView.SetWrap(true) @@ -469,7 +472,7 @@ func NewEditor() *Editor { } else if shortcuts.InputNewLine.Equals(event) { editor.InsertCharacter('\n') } else if event.Rune() != 0 { - if config.Current.VimMode.CurrentMode != vim.Disabled && config.Current.VimMode.CurrentMode != vim.InsertMode { + if *editor.vimMode != vim.Disabled && *editor.vimMode != vim.InsertMode { return nil } editor.InsertCharacter(event.Rune()) diff --git a/ui/shortcutdialog/dialog.go b/ui/shortcutdialog/dialog.go index 4f9162fb..e7cbf533 100644 --- a/ui/shortcutdialog/dialog.go +++ b/ui/shortcutdialog/dialog.go @@ -15,7 +15,7 @@ func ShowShortcutsDialog(app *tview.Application, onClose func()) { var exitButton *tview.Button var resetButton *tview.Button - table = NewShortcutTable() + table = NewShortcutTable(&app.VimMode.CurrentMode) table.SetShortcuts(shortcuts.Shortcuts) exitButton = tview.NewButton("Go back") @@ -94,11 +94,11 @@ func ShowShortcutsDialog(app *tview.Application, onClose func()) { } func RunShortcutsDialogStandalone() { - loadError := shortcuts.Load() + loadError := shortcuts.Load(nil) if loadError != nil { log.Fatalf("Error loading shortcuts: %s\n", loadError) } - app := tview.NewApplication() + app := tview.NewApplication(false) app.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey { if shortcuts.ExitApplication.Equals(event) { app.Stop() diff --git a/ui/shortcutdialog/table.go b/ui/shortcutdialog/table.go index efee811e..e6833ca3 100644 --- a/ui/shortcutdialog/table.go +++ b/ui/shortcutdialog/table.go @@ -6,6 +6,7 @@ import ( "github.com/Bios-Marcel/cordless/shortcuts" "github.com/Bios-Marcel/cordless/tview" + "github.com/Bios-Marcel/cordless/util/vim" tcell "github.com/gdamore/tcell/v2" ) @@ -27,14 +28,17 @@ type ShortcutTable struct { selection int focusNext func() focusPrevious func() + + vimMode *int } // NewShortcutTable creates a new shortcut table that doesn't contain any data. -func NewShortcutTable() *ShortcutTable { +func NewShortcutTable(vimEnabled *int) *ShortcutTable { table := tview.NewTable() shortcutsTable := &ShortcutTable{ table: table, selection: -1, + vimMode: vimEnabled, } table.SetSelectable(true, false) @@ -46,9 +50,11 @@ func NewShortcutTable() *ShortcutTable { table.SetCell(0, actionCellIndex, createHeaderCell("Action")) table.SetCell(0, scopeCellIndex, createHeaderCell("Scope")) table.SetCell(0, shortcutCellIndex, createHeaderCell("Shortcut")) - table.SetCell(0, vimNormalCellIndex, createHeaderCell("Vim: N")) - table.SetCell(0, vimInsertCellIndex, createHeaderCell("Vim: I")) - table.SetCell(0, vimVisualCellIndex, createHeaderCell("Vim: V")) + if *vimEnabled != vim.Disabled { + table.SetCell(0, vimNormalCellIndex, createHeaderCell("Vim: N")) + table.SetCell(0, vimInsertCellIndex, createHeaderCell("Vim: I")) + table.SetCell(0, vimVisualCellIndex, createHeaderCell("Vim: V")) + } table.SetInputCapture(shortcutsTable.handleInput) @@ -97,54 +103,56 @@ func (shortcutTable *ShortcutTable) SetShortcuts(shortcuts []*shortcuts.Shortcut SetMaxWidth(1) shortcutTable.table.SetCell(row, shortcutCellIndex, eventCell) - normalKey := "" - insertKey := "" - visualKey := "" + if *shortcutTable.vimMode != vim.Disabled { + normalKey := "" + insertKey := "" + visualKey := "" + + // HACK + // Empty tcell EventKey corresponds to Ctrl-Space + if shortcut.VimModifier.NormalEvent == nil { + normalKey = EventToString(shortcut.Event) + } else if shortcut.VimModifier.NormalEvent.Rune() == rune(tcell.KeyCtrlSpace){ + normalKey = "" + } else { + normalKey = EventToString(shortcut.VimModifier.NormalEvent) + } - // HACK - // Empty tcell EventKey corresponds to Ctrl-Space - if shortcut.VimModifier.NormalEvent == nil { - normalKey = EventToString(shortcut.Event) - } else if shortcut.VimModifier.NormalEvent.Rune() == rune(tcell.KeyCtrlSpace){ - normalKey = "" - } else { - normalKey = EventToString(shortcut.VimModifier.NormalEvent) - } + if shortcut.VimModifier.InsertEvent == nil { + insertKey = EventToString(shortcut.Event) + } else if shortcut.VimModifier.InsertEvent.Rune() == rune(tcell.KeyCtrlSpace){ + insertKey = "" + } else { + insertKey = EventToString(shortcut.VimModifier.InsertEvent) + } - if shortcut.VimModifier.InsertEvent == nil { - insertKey = EventToString(shortcut.Event) - } else if shortcut.VimModifier.InsertEvent.Rune() == rune(tcell.KeyCtrlSpace){ - insertKey = "" - } else { - insertKey = EventToString(shortcut.VimModifier.InsertEvent) - } + if shortcut.VimModifier.VisualEvent == nil { + visualKey = EventToString(shortcut.Event) + } else if shortcut.VimModifier.VisualEvent.Rune() == rune(tcell.KeyCtrlSpace){ + visualKey = "" + } else { + visualKey = EventToString(shortcut.VimModifier.VisualEvent) + } - if shortcut.VimModifier.VisualEvent == nil { - visualKey = EventToString(shortcut.Event) - } else if shortcut.VimModifier.VisualEvent.Rune() == rune(tcell.KeyCtrlSpace){ - visualKey = "" - } else { - visualKey = EventToString(shortcut.VimModifier.VisualEvent) + vimNormalCell := tview.NewTableCell(fmt.Sprintf("%s", + normalKey)). + SetExpansion(1). + SetMaxWidth(1) + shortcutTable.table.SetCell(row, vimNormalCellIndex, vimNormalCell) + + vimInsertCell := tview.NewTableCell(fmt.Sprintf("%s", + insertKey)). + SetExpansion(1). + SetMaxWidth(1) + shortcutTable.table.SetCell(row, vimInsertCellIndex, vimInsertCell) + + vimVisualCell := tview.NewTableCell(fmt.Sprintf("%s", + visualKey)). + SetExpansion(1). + SetMaxWidth(1) + shortcutTable.table.SetCell(row, vimVisualCellIndex, vimVisualCell) } - vimNormalCell := tview.NewTableCell(fmt.Sprintf("%s", - normalKey)). - SetExpansion(1). - SetMaxWidth(1) - shortcutTable.table.SetCell(row, vimNormalCellIndex, vimNormalCell) - - vimInsertCell := tview.NewTableCell(fmt.Sprintf("%s", - insertKey)). - SetExpansion(1). - SetMaxWidth(1) - shortcutTable.table.SetCell(row, vimInsertCellIndex, vimInsertCell) - - vimVisualCell := tview.NewTableCell(fmt.Sprintf("%s", - visualKey)). - SetExpansion(1). - SetMaxWidth(1) - shortcutTable.table.SetCell(row, vimVisualCellIndex, vimVisualCell) - row++ } } diff --git a/ui/window.go b/ui/window.go index 6012e035..e331bea8 100644 --- a/ui/window.go +++ b/ui/window.go @@ -124,7 +124,7 @@ func NewWindow(app *tview.Application, session *discordgo.Session, readyEvent *d }() } - window.commandView = NewCommandView(window.ExecuteCommand) + window.commandView = NewCommandView(&window.app.VimMode.CurrentMode,window.ExecuteCommand) logging.SetAdditionalOutput(window.commandView) for _, engine := range window.extensionEngines { @@ -403,7 +403,7 @@ func NewWindow(app *tview.Application, session *discordgo.Session, readyEvent *d }) window.messageContainer = window.chatView.GetPrimitive() - window.messageInput = NewEditor() + window.messageInput = NewEditor(&window.app.VimMode.CurrentMode) window.messageInput.internalTextView.SetIndicateOverflow(true) window.messageInput.SetOnHeightChangeRequest(func(height int) { _, _, _, chatViewHeight := window.chatView.internalTextView.GetRect() @@ -747,7 +747,7 @@ func NewWindow(app *tview.Application, session *discordgo.Session, readyEvent *d window.userList = NewUserTree(window.session.State) // Disable search on type when in Vim mode. TODO add / shourtcut to search. - if config.Current.VimMode.CurrentMode != vim.Disabled { + if window.app.VimMode.CurrentMode != vim.Disabled { guildList.SetSearchOnTypeEnabled(false) channelTree.SetSearchOnTypeEnabled(false) window.userList.internalTreeView.SetSearchOnTypeEnabled(false) @@ -874,10 +874,10 @@ func NewWindow(app *tview.Application, session *discordgo.Session, readyEvent *d bottomBar := components.NewBottomBar() bottomBar.AddItem(fmt.Sprintf("Logged in as: '%s'", tviewutil.Escape(session.State.User.Username))) bottomBar.AddItem(fmt.Sprintf("View / Change shortcuts: %s", shortcutdialog.EventToString(shortcutsDialogShortcut))) - // bottomBar.AddItem(fmt.Sprintf("Vim: %s", config.Current.VimMode.EnabledString())) + // bottomBar.AddItem(fmt.Sprintf("Vim: %s", window.app.VimMode.EnabledString())) window.vimStatus = bottomBar.AddDynamicItem() // Default content - window.vimStatus.Content = fmt.Sprintf("Vim: %s", config.Current.VimMode.CurrentModeString()) + window.vimStatus.Content = fmt.Sprintf("Vim: %s", window.app.VimMode.CurrentModeString()) window.rootContainer.AddItem(bottomBar, 1, 0, false) } @@ -2140,28 +2140,28 @@ func (window *Window) handleGlobalShortcuts(event *tcell.EventKey) *tcell.EventK return nil } - if config.Current.VimMode.CurrentMode != vim.Disabled { + if window.app.VimMode.CurrentMode != vim.Disabled { if shortcuts.VimInsertMode.Equals(event) { - config.Current.VimMode.Insert() - window.vimStatus.Content = fmt.Sprintf("Vim: %s",config.Current.VimMode.CurrentModeString()) + window.app.VimMode.Insert() + window.vimStatus.Content = fmt.Sprintf("Vim: %s",window.app.VimMode.CurrentModeString()) return nil } else if shortcuts.VimVisualMode.Equals(event) { - config.Current.VimMode.Visual() - window.vimStatus.Content = fmt.Sprintf("Vim: %s",config.Current.VimMode.CurrentModeString()) + window.app.VimMode.Visual() + window.vimStatus.Content = fmt.Sprintf("Vim: %s",window.app.VimMode.CurrentModeString()) return nil } else if shortcuts.VimNormalMode.Equals(event) && window.app.GetRoot() == window.rootContainer { - config.Current.VimMode.Normal() - window.vimStatus.Content = fmt.Sprintf("Vim: %s",config.Current.VimMode.CurrentModeString()) + window.app.VimMode.Normal() + window.vimStatus.Content = fmt.Sprintf("Vim: %s",window.app.VimMode.CurrentModeString()) return nil } - if shortcuts.VimSimKeyDown.Equals(event) && config.Current.VimMode.CurrentMode == vim.VisualMode { + if shortcuts.VimSimKeyDown.Equals(event) && window.app.VimMode.CurrentMode == vim.VisualMode { return tcell.NewEventKey(tcell.KeyDown, rune(tcell.KeyDown), tcell.ModNone) - } else if shortcuts.VimSimKeyUp.Equals(event) && config.Current.VimMode.CurrentMode == vim.VisualMode { + } else if shortcuts.VimSimKeyUp.Equals(event) && window.app.VimMode.CurrentMode == vim.VisualMode { return tcell.NewEventKey(tcell.KeyUp, rune(tcell.KeyUp), tcell.ModNone) - } else if shortcuts.VimSimKeyLeft.Equals(event) && config.Current.VimMode.CurrentMode == vim.VisualMode { + } else if shortcuts.VimSimKeyLeft.Equals(event) && window.app.VimMode.CurrentMode == vim.VisualMode { return tcell.NewEventKey(tcell.KeyLeft, rune(tcell.KeyLeft), tcell.ModNone) - } else if shortcuts.VimSimKeyRight.Equals(event) && config.Current.VimMode.CurrentMode == vim.VisualMode { + } else if shortcuts.VimSimKeyRight.Equals(event) && window.app.VimMode.CurrentMode == vim.VisualMode { return tcell.NewEventKey(tcell.KeyRight, rune(tcell.KeyRight), tcell.ModNone) } } @@ -2197,7 +2197,7 @@ func (window *Window) handleChatWindowShortcuts(event *tcell.EventKey) *tcell.Ev } else if shortcuts.FocusMessageContainer.Equals(event) { window.app.SetFocus(window.chatView.internalTextView) } else if shortcuts.EventsEqual(event, shortcutsDialogShortcut) { - shortcutdialog.ShowShortcutsDialog(window.app, func() { + shortcutdialog.ShowShortcutsDialog(window.app,func() { window.app.SetRoot(window.rootContainer, true) window.app.SetFocus(window.chatView.GetPrimitive()) }) diff --git a/util/vim/vim.go b/util/vim/vim.go index be4bbc17..c7948954 100644 --- a/util/vim/vim.go +++ b/util/vim/vim.go @@ -21,6 +21,14 @@ type Vim struct { CurrentMode int } +func NewVim(enabled bool) *Vim { + if enabled { + return &Vim{CurrentMode: NormalMode} + } else { + return &Vim{CurrentMode: Disabled} + } +} + // SetMode sets new vim mode. If provided mode falls out // the defined range 0-2 it will fall back to normal mode. func (v *Vim) SetMode(mode int) { From 076d73b2cb802fd03af5d53cef1dfaf1265b025e Mon Sep 17 00:00:00 2001 From: Daniel Perez Date: Sat, 21 Nov 2020 15:12:50 +0100 Subject: [PATCH 25/31] "Reverted merge This reverts commit b2bd17584568ad852fc56b011d4ab27e6d8a53cf, reversing changes made to 9e8bd4c685f2d4cb2abca34a1e4bdc903a27f3d2. --- appveyor.yml | 3 +- tview/application.go | 38 -------------------- tview/box.go | 14 -------- tview/primitive.go | 3 -- ui/commandview.go | 4 +-- ui/editor.go | 82 +++++--------------------------------------- ui/window.go | 4 +-- 7 files changed, 14 insertions(+), 134 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 6464606a..2e83a045 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -2,7 +2,6 @@ clone_folder: c:\gopath\src\github.com\Bios-Marcel\cordless environment: GOPATH: c:\gopath - GO111MODULE: on build: off stack: go 1.13 @@ -16,4 +15,4 @@ build_script: test_script: - go vet ./... - - go test ./... + - go test ./... \ No newline at end of file diff --git a/tview/application.go b/tview/application.go index d9490acb..c32e07bf 100644 --- a/tview/application.go +++ b/tview/application.go @@ -69,8 +69,6 @@ type Application struct { screenReplacement chan tcell.Screen VimMode *vim.Vim - // Defines whether a bracketed paste is currently ongoing. - pasteActive bool } // NewApplication creates and returns a new application. @@ -122,7 +120,6 @@ func (a *Application) SetScreen(screen tcell.Screen) *Application { if a.MouseEnabled { a.screen.EnableMouse() } - screen.EnablePaste() a.Unlock() return a } @@ -156,7 +153,6 @@ func (a *Application) Run() error { if a.MouseEnabled { a.screen.EnableMouse() } - a.screen.EnablePaste() } // We catch panics to clean up because they mess up the terminal. @@ -223,7 +219,6 @@ func (a *Application) Run() error { // Start event loop. var keyEventHandleHierarchy []Primitive - var pastedRunes []rune EventLoop: for { //resize slice to zero without having to allocate a new array. @@ -241,14 +236,6 @@ EventLoop: a.RLock() p := a.focus inputCapture := a.inputCapture - if a.pasteActive { - if event.Rune() != 0 { - pastedRunes = append(pastedRunes, event.Rune()) - a.RUnlock() - continue - } - } - a.RUnlock() // Intercept keys. @@ -294,25 +281,6 @@ EventLoop: } screen.Clear() a.draw() - case *tcell.EventPaste: - a.RLock() - p := a.focus - - if event.Start() { - - a.pasteActive = true - a.RUnlock() - } else if event.End() { - a.pasteActive = false - a.RUnlock() - if p != nil { - p.OnPaste(pastedRunes) - a.draw() - pastedRunes = pastedRunes[0:0] - } - } else { - a.RUnlock() - } case *tcell.EventMouse: if event.Buttons() == tcell.ButtonNone { continue @@ -403,11 +371,6 @@ func getSelfIfCoordinatesMatch(primitive Primitive, x, y int) *Primitive { return nil } -// IsPasting indicates whether a bracketed paste is ongoing. -func (a *Application) IsPasting() bool { - return a.pasteActive -} - // Stop stops the application, causing Run() to return. func (a *Application) Stop() { a.Lock() @@ -452,7 +415,6 @@ func (a *Application) Suspend(f func()) bool { if a.MouseEnabled { screen.EnableMouse() } - screen.EnablePaste() a.screenReplacement <- screen // One key event will get lost, see https://github.com/gdamore/tcell/issues/194 diff --git a/tview/box.go b/tview/box.go index dfa96af7..eb21fec1 100644 --- a/tview/box.go +++ b/tview/box.go @@ -84,8 +84,6 @@ type Box struct { nextFocusableComponents map[FocusDirection][]Primitive parent Primitive - - onPaste func([]rune) } // NewBox returns a Box without a border. @@ -615,15 +613,3 @@ func (b *Box) drawOverflow(screen tcell.Screen, showTop, showBottom bool) { } } } - -// SetOnPaste defines the function that's called in OnPaste. -func (b *Box) SetOnPaste(onPaste func([]rune)) { - b.onPaste = onPaste -} - -// OnPaste is called when a bracketed paste is finished. -func (b *Box) OnPaste(runes []rune) { - if b.onPaste != nil { - b.onPaste(runes) - } -} diff --git a/tview/primitive.go b/tview/primitive.go index 5ab3fb9b..1a9ab646 100644 --- a/tview/primitive.go +++ b/tview/primitive.go @@ -48,9 +48,6 @@ type Primitive interface { // Box.WrapInputHandler() so you inherit that functionality. InputHandler() InputHandlerFunc - // OnPaste is called when a bracketed paste is finished. - OnPaste([]rune) - // Focus is called by the application when the primitive receives focus. // Implementers may call delegate() to pass the focus on to another primitive. Focus(delegate func(p Primitive)) diff --git a/ui/commandview.go b/ui/commandview.go index 0f3f8720..219737f3 100644 --- a/ui/commandview.go +++ b/ui/commandview.go @@ -27,7 +27,7 @@ type CommandView struct { // NewCommandView creates a new struct containing the components necessary // for a command view. It also contains the state for those components. -func NewCommandView(app *tview.Application, onExecuteCommand func(command string)) *CommandView { +func NewCommandView(vimMode *int,onExecuteCommand func(command string)) *CommandView { commandOutput := tview.NewTextView() commandOutput.SetDynamicColors(true). SetWordWrap(true). @@ -36,7 +36,7 @@ func NewCommandView(app *tview.Application, onExecuteCommand func(command string SetBorder(true). SetIndicateOverflow(true) - commandInput := NewEditor(app) + commandInput := NewEditor(vimMode) commandInput.internalTextView. SetWrap(false). SetWordWrap(false) diff --git a/ui/editor.go b/ui/editor.go index bd3ac6ef..288c2f39 100644 --- a/ui/editor.go +++ b/ui/editor.go @@ -29,9 +29,7 @@ type Editor struct { requestedHeight int autocompleteFrom *femto.Loc - // App is the tview Application this editor is used in. The reference is - // required to query the current bracketed paste state. - App *tview.Application + vimMode *int } func (editor *Editor) applyBuffer() { @@ -379,17 +377,6 @@ func (editor *Editor) Paste(event *tcell.EventKey) { } } -func (editor *Editor) insertCharacterWithoutApply(character rune) { - selectionEnd := editor.buffer.Cursor.CurSelection[1] - selectionStart := editor.buffer.Cursor.CurSelection[0] - if editor.buffer.Cursor.HasSelection() { - editor.buffer.Replace(selectionStart, selectionEnd, string(character)) - } else { - editor.buffer.Insert(editor.buffer.Cursor.Loc, string(character)) - } - editor.buffer.Cursor.ResetSelection() -} - func (editor *Editor) InsertCharacter(character rune) { selectionEnd := editor.buffer.Cursor.CurSelection[1] selectionStart := editor.buffer.Cursor.CurSelection[0] @@ -403,13 +390,13 @@ func (editor *Editor) InsertCharacter(character rune) { } // NewEditor instantiates a ready to use text editor. -func NewEditor(app *tview.Application) *Editor { +func NewEditor(vimMode *int) *Editor { editor := Editor{ internalTextView: tview.NewTextView(), requestedHeight: 3, buffer: femto.NewBufferFromString("", ""), tempBuffer: femto.NewBufferFromString("", ""), - App: app, + vimMode: vimMode, } editor.internalTextView.SetWrap(true) @@ -423,28 +410,6 @@ func NewEditor(app *tview.Application) *Editor { editor.buffer.Cursor.SetSelectionStart(editor.buffer.Start()) editor.buffer.Cursor.SetSelectionEnd(editor.buffer.End()) - if editor.App != nil { - editor.internalTextView.SetOnPaste(func(pastedRunes []rune) { - var wasLastCharacterSlashR bool - for _, r := range pastedRunes { - //Workaround! Sometimes no \n is received, but only \r. Why? Unsure. - if r == '\r' { - wasLastCharacterSlashR = true - editor.insertCharacterWithoutApply('\n') - } else { - if wasLastCharacterSlashR { - wasLastCharacterSlashR = false - } - if r != '\n' { - editor.insertCharacterWithoutApply(r) - } - } - } - editor.applyBuffer() - editor.TriggerHeightRequestIfNecessary() - editor.internalTextView.ScrollToHighlight() - }) - } editor.internalTextView.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey { inputCapture := editor.inputCapture if inputCapture != nil { @@ -506,14 +471,11 @@ func NewEditor(app *tview.Application) *Editor { return nil } else if shortcuts.InputNewLine.Equals(event) { editor.InsertCharacter('\n') - } else { - if editor.App.VimMode.CurrentMode != vim.Disabled && editor.App.VimMode.CurrentMode != vim.InsertMode { + } else if event.Rune() != 0 { + if *editor.vimMode != vim.Disabled && *editor.vimMode != vim.InsertMode { return nil } - mappedRune := mapInputToRune(event) - if mappedRune != 0 { - editor.InsertCharacter(mappedRune) - } + editor.InsertCharacter(event.Rune()) } editor.TriggerHeightRequestIfNecessary() @@ -523,34 +485,6 @@ func NewEditor(app *tview.Application) *Editor { return &editor } -// mapInputToRune makes sure no invalid characters get inserted into the -// editor. All exceptions that aren't specifically declared as -// Key type 'tcell.KeyRune' have to be defined here. A prominent example -// is the newline character. This was initially added to avoid inserting -// the characters produces by Ctrl+Backspace, Alt+Backspace, Ctrl+W and so -// on and so forth. These are all control characters which we don't always -// react to, since the shortcuts are configurably from within the app. -// A return value of 0 is to be treated as 'no rune'. -func mapInputToRune(event *tcell.EventKey) rune { - //If something is specifically defined as a rune, we won't question whether - //it's valid input, as it's generally not deemed a control character. - if event.Key() == tcell.KeyRune { - return event.Rune() - } - - //While '\n' is treated as newline, we'll ignore '\r', as it's useless. - if event.Rune() == '\n' { - return '\n' - } - - //Handles Tab + Ctrl+H - if event.Rune() == '\t' { - return '\t' - } - - return 0 -} - func (editor *Editor) GetTextLeftOfSelection() string { var to femto.Loc if editor.buffer.Cursor.HasSelection() { @@ -584,7 +518,9 @@ func (editor *Editor) TriggerHeightRequestIfNecessary() { return } - newRequestedHeight := editor.countRows(editor.GetText()) + rowAmount := editor.countRows(editor.GetText()) + + newRequestedHeight := rowAmount if editor.internalTextView.IsBorderTop() { newRequestedHeight++ } diff --git a/ui/window.go b/ui/window.go index bac3f5ec..e5bd6b24 100644 --- a/ui/window.go +++ b/ui/window.go @@ -124,7 +124,7 @@ func NewWindow(app *tview.Application, session *discordgo.Session, readyEvent *d }() } - window.commandView = NewCommandView(window.app, window.ExecuteCommand) + window.commandView = NewCommandView(&window.app.VimMode.CurrentMode,window.ExecuteCommand) logging.SetAdditionalOutput(window.commandView) for _, engine := range window.extensionEngines { @@ -401,7 +401,7 @@ func NewWindow(app *tview.Application, session *discordgo.Session, readyEvent *d }) window.messageContainer = window.chatView.GetPrimitive() - window.messageInput = NewEditor(window.app) + window.messageInput = NewEditor(&window.app.VimMode.CurrentMode) window.messageInput.internalTextView.SetIndicateOverflow(true) window.messageInput.SetOnHeightChangeRequest(func(height int) { _, _, _, chatViewHeight := window.chatView.internalTextView.GetRect() From 8774ec7d981e9be2b81edb1bf6d56ca9c3c66e9b Mon Sep 17 00:00:00 2001 From: Daniel Perez Date: Sat, 21 Nov 2020 15:34:07 +0100 Subject: [PATCH 26/31] Fixed windows build --- shortcuts/shortcuts.go | 4 +++- shortcuts/shortcuts_win.go | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/shortcuts/shortcuts.go b/shortcuts/shortcuts.go index 76084ac4..35c1553b 100644 --- a/shortcuts/shortcuts.go +++ b/shortcuts/shortcuts.go @@ -352,7 +352,6 @@ var ( scopes []*Scope Shortcuts []*Shortcut // VimKeyStore is needed to fix normal mode and visual mode accidentally typing inside the text box. - VimKeyStore map[string]string // Key Mode ) @@ -437,6 +436,9 @@ type Shortcut struct { // Equals compares the given EventKey with the Shortcuts Event. // If any vim mode is enabled, it will replace the default event. func (shortcut *Shortcut) Equals(event *tcell.EventKey) bool { + if shortcut.VimStatus == nil { + return EventsEqual(shortcut.Event, event) + } if shortcut.VimStatus.CurrentMode == vim.NormalMode { selectedEvent := shortcut.VimModifier.NormalEvent if selectedEvent == nil { diff --git a/shortcuts/shortcuts_win.go b/shortcuts/shortcuts_win.go index e06bfcff..e65b777a 100644 --- a/shortcuts/shortcuts_win.go +++ b/shortcuts/shortcuts_win.go @@ -5,5 +5,5 @@ package shortcuts import tcell "github.com/gdamore/tcell/v2" func addDeleteLeftShortcut() *Shortcut { - return addShortcut("delete_left", "Delete left", multilineTextInput, tcell.NewEventKey(tcell.KeyBackspace, rune(tcell.KeyBackspace), tcell.ModNone),addVimKey(NullVimKey,nil,NullVimKey)) + return addShortcut("delete_left", "Delete left", multilineTextInput, tcell.NewEventKey(tcell.KeyBackspace, rune(tcell.KeyBackspace), tcell.ModNone),nil) } From 1e22b409c0ffff1901a23c782bdacd018c931b28 Mon Sep 17 00:00:00 2001 From: Daniel Perez Date: Sat, 21 Nov 2020 15:35:03 +0100 Subject: [PATCH 27/31] Fixed windows build --- shortcuts/shortcuts.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/shortcuts/shortcuts.go b/shortcuts/shortcuts.go index 35c1553b..343e83a9 100644 --- a/shortcuts/shortcuts.go +++ b/shortcuts/shortcuts.go @@ -436,7 +436,7 @@ type Shortcut struct { // Equals compares the given EventKey with the Shortcuts Event. // If any vim mode is enabled, it will replace the default event. func (shortcut *Shortcut) Equals(event *tcell.EventKey) bool { - if shortcut.VimStatus == nil { + if shortcut.VimModifier == nil { return EventsEqual(shortcut.Event, event) } if shortcut.VimStatus.CurrentMode == vim.NormalMode { From e7e4512548e2de0f1c187bcecc2bc764eb32cb37 Mon Sep 17 00:00:00 2001 From: Daniel Perez Date: Sat, 21 Nov 2020 20:59:12 +0100 Subject: [PATCH 28/31] Fixed SIGSEGV --- app/app.go | 1 + shortcuts/shortcuts.go | 11 +++++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/app/app.go b/app/app.go index 9dd61b33..93a29801 100644 --- a/app/app.go +++ b/app/app.go @@ -43,6 +43,7 @@ func SetupApplicationWithAccount(app *tview.Application, account string) { } shortcutsLoadError := shortcuts.Load(app.VimMode) + shortcuts.InjectVim(app.VimMode) if shortcutsLoadError != nil { panic(shortcutsLoadError) } diff --git a/shortcuts/shortcuts.go b/shortcuts/shortcuts.go index 343e83a9..433ba10f 100644 --- a/shortcuts/shortcuts.go +++ b/shortcuts/shortcuts.go @@ -351,8 +351,6 @@ var ( scopes []*Scope Shortcuts []*Shortcut - // VimKeyStore is needed to fix normal mode and visual mode accidentally typing inside the text box. - // Key Mode ) // Vim event holds possible modifiers for keys. They can be nil. In that case, they will default @@ -439,6 +437,9 @@ func (shortcut *Shortcut) Equals(event *tcell.EventKey) bool { if shortcut.VimModifier == nil { return EventsEqual(shortcut.Event, event) } + if shortcut.VimStatus == nil { + return EventsEqual(shortcut.Event, event) + } if shortcut.VimStatus.CurrentMode == vim.NormalMode { selectedEvent := shortcut.VimModifier.NormalEvent if selectedEvent == nil { @@ -611,6 +612,12 @@ OUTER_LOOP: return nil } +func InjectVim(v *vim.Vim) { + for i := range Shortcuts { + Shortcuts[i].VimStatus = v + } +} + // Persist saves the currently shortcuts that are currently being held in // memory. func Persist() error { From dfdc8c6642672d7eacf5e3355fb374c343bf9fbf Mon Sep 17 00:00:00 2001 From: Daniel Perez Date: Sat, 21 Nov 2020 21:19:29 +0100 Subject: [PATCH 29/31] Attempt to fix appveyor compilation --- tools/keyevents/main.go | 3 ++- tools/layout/main.go | 3 ++- tview/demos/box/main.go | 3 ++- tview/demos/button/main.go | 7 +++++-- tview/demos/checkbox/main.go | 7 +++++-- tview/demos/dropdown/main.go | 7 +++++-- tview/demos/flex/main.go | 3 ++- tview/demos/form/main.go | 3 ++- tview/demos/frame/main.go | 5 +++-- tview/demos/grid/main.go | 3 ++- tview/demos/inputfield-paste/main.go | 5 +++-- tview/demos/inputfield/main.go | 5 +++-- tview/demos/list/main.go | 3 ++- tview/demos/modal/main.go | 3 ++- tview/demos/overflowindicators/main.go | 6 ++++-- tview/demos/pages/main.go | 3 ++- tview/demos/presentation/main.go | 5 +++-- tview/demos/primitive/main.go | 3 ++- tview/demos/table/main.go | 5 +++-- tview/demos/textview/main.go | 5 +++-- tview/demos/treeview/main.go | 5 +++-- tview/demos/unicode/main.go | 3 ++- ui/shortcutdialog/dialog.go | 3 ++- 23 files changed, 64 insertions(+), 34 deletions(-) diff --git a/tools/keyevents/main.go b/tools/keyevents/main.go index bfb658d1..f59a174d 100644 --- a/tools/keyevents/main.go +++ b/tools/keyevents/main.go @@ -3,6 +3,7 @@ package main import ( "fmt" + "github.com/Bios-Marcel/cordless/config" "github.com/Bios-Marcel/cordless/tview" tcell "github.com/gdamore/tcell/v2" ) @@ -14,5 +15,5 @@ func main() { return event }) - tview.NewApplication().SetRoot(input, true).Run() + tview.NewApplication(config.Current.VimEnabled).SetRoot(input, true).Run() } diff --git a/tools/layout/main.go b/tools/layout/main.go index 7658b316..7397f283 100644 --- a/tools/layout/main.go +++ b/tools/layout/main.go @@ -1,12 +1,13 @@ package main import ( + "github.com/Bios-Marcel/cordless/config" "github.com/Bios-Marcel/cordless/tview" tcell "github.com/gdamore/tcell/v2" ) func main() { - app := tview.NewApplication() + app := tview.NewApplication(config.Current.VimEnabled) err := app.Run() if err != nil { panic(err) diff --git a/tview/demos/box/main.go b/tview/demos/box/main.go index d19f8bfe..05929405 100644 --- a/tview/demos/box/main.go +++ b/tview/demos/box/main.go @@ -2,6 +2,7 @@ package main import ( + "github.com/Bios-Marcel/cordless/config" "github.com/Bios-Marcel/cordless/tview" ) @@ -9,7 +10,7 @@ func main() { box := tview.NewBox(). SetBorder(true). SetTitle("A [red]c[yellow]o[green]l[darkcyan]o[blue]r[darkmagenta]f[red]u[yellow]l[white] [black:red]c[:yellow]o[:green]l[:darkcyan]o[:blue]r[:darkmagenta]f[:red]u[:yellow]l[white:] [::bu]title") - if err := tview.NewApplication().SetRoot(box, true).Run(); err != nil { + if err := tview.NewApplication(config.Current.VimEnabled).SetRoot(box, true).Run(); err != nil { panic(err) } } diff --git a/tview/demos/button/main.go b/tview/demos/button/main.go index e35f1ef8..b0a53eb8 100644 --- a/tview/demos/button/main.go +++ b/tview/demos/button/main.go @@ -1,10 +1,13 @@ // Demo code for the Button primitive. package main -import "github.com/Bios-Marcel/cordless/tview" +import ( + "github.com/Bios-Marcel/cordless/config" + "github.com/Bios-Marcel/cordless/tview" +) func main() { - app := tview.NewApplication() + app := tview.NewApplication(config.Current.VimEnabled) button := tview.NewButton("Hit Enter to close").SetSelectedFunc(func() { app.Stop() }) diff --git a/tview/demos/checkbox/main.go b/tview/demos/checkbox/main.go index 764fe75b..13f39573 100644 --- a/tview/demos/checkbox/main.go +++ b/tview/demos/checkbox/main.go @@ -1,10 +1,13 @@ // Demo code for the Checkbox primitive. package main -import "github.com/Bios-Marcel/cordless/tview" +import ( + "github.com/Bios-Marcel/cordless/config" + "github.com/Bios-Marcel/cordless/tview" +) func main() { - app := tview.NewApplication() + app := tview.NewApplication(config.Current.VimEnabled) checkbox := tview.NewCheckbox().SetLabel("Hit Enter to check box: ") if err := app.SetRoot(checkbox, true).Run(); err != nil { panic(err) diff --git a/tview/demos/dropdown/main.go b/tview/demos/dropdown/main.go index e20be4ae..60fcd9f8 100644 --- a/tview/demos/dropdown/main.go +++ b/tview/demos/dropdown/main.go @@ -1,10 +1,13 @@ // Demo code for the DropDown primitive. package main -import "github.com/Bios-Marcel/cordless/tview" +import ( + "github.com/Bios-Marcel/cordless/config" + "github.com/Bios-Marcel/cordless/tview" +) func main() { - app := tview.NewApplication() + app := tview.NewApplication(config.Current.VimEnabled) dropdown := tview.NewDropDown(). SetLabel("Select an option (hit Enter): "). SetOptions([]string{"First", "Second", "Third", "Fourth", "Fifth"}, nil) diff --git a/tview/demos/flex/main.go b/tview/demos/flex/main.go index 0df05b17..b607863a 100644 --- a/tview/demos/flex/main.go +++ b/tview/demos/flex/main.go @@ -2,11 +2,12 @@ package main import ( + "github.com/Bios-Marcel/cordless/config" "github.com/Bios-Marcel/cordless/tview" ) func main() { - app := tview.NewApplication() + app := tview.NewApplication(config.Current.VimEnabled) flex := tview.NewFlex(). AddItem(tview.NewBox().SetBorder(true).SetTitle("Left (1/2 x width of Top)"), 0, 1, false). AddItem(tview.NewFlex().SetDirection(tview.FlexRow). diff --git a/tview/demos/form/main.go b/tview/demos/form/main.go index b589e603..d74caf12 100644 --- a/tview/demos/form/main.go +++ b/tview/demos/form/main.go @@ -2,11 +2,12 @@ package main import ( + "github.com/Bios-Marcel/cordless/config" "github.com/Bios-Marcel/cordless/tview" ) func main() { - app := tview.NewApplication() + app := tview.NewApplication(config.Current.VimEnabled) form := tview.NewForm(). AddDropDown("Title", []string{"Mr.", "Ms.", "Mrs.", "Dr.", "Prof."}, 0, nil). AddInputField("First name", "", 20, nil, nil). diff --git a/tview/demos/frame/main.go b/tview/demos/frame/main.go index f6037436..9d2dbf60 100644 --- a/tview/demos/frame/main.go +++ b/tview/demos/frame/main.go @@ -2,12 +2,13 @@ package main import ( - tcell "github.com/gdamore/tcell/v2" + "github.com/Bios-Marcel/cordless/config" "github.com/Bios-Marcel/cordless/tview" + tcell "github.com/gdamore/tcell/v2" ) func main() { - app := tview.NewApplication() + app := tview.NewApplication(config.Current.VimEnabled) frame := tview.NewFrame(tview.NewBox().SetBackgroundColor(tcell.ColorBlue)). SetBorders(2, 2, 2, 2, 4, 4). AddText("Header left", true, tview.AlignLeft, tcell.ColorWhite). diff --git a/tview/demos/grid/main.go b/tview/demos/grid/main.go index c6438acc..b1b06106 100644 --- a/tview/demos/grid/main.go +++ b/tview/demos/grid/main.go @@ -2,6 +2,7 @@ package main import ( + "github.com/Bios-Marcel/cordless/config" "github.com/Bios-Marcel/cordless/tview" ) @@ -32,7 +33,7 @@ func main() { AddItem(main, 1, 1, 1, 1, 0, 100, false). AddItem(sideBar, 1, 2, 1, 1, 0, 100, false) - if err := tview.NewApplication().SetRoot(grid, true).Run(); err != nil { + if err := tview.NewApplication(config.Current.VimEnabled).SetRoot(grid, true).Run(); err != nil { panic(err) } } diff --git a/tview/demos/inputfield-paste/main.go b/tview/demos/inputfield-paste/main.go index e9116769..abc426e6 100644 --- a/tview/demos/inputfield-paste/main.go +++ b/tview/demos/inputfield-paste/main.go @@ -1,6 +1,7 @@ package main import ( + "github.com/Bios-Marcel/cordless/config" "github.com/Bios-Marcel/cordless/tview" tcell "github.com/gdamore/tcell/v2" ) @@ -15,6 +16,6 @@ func main() { return event }) - app := tview.NewApplication().SetRoot(field,true) + app := tview.NewApplication(config.Current.VimEnabled).SetRoot(field,true) app.Run() -} \ No newline at end of file +} diff --git a/tview/demos/inputfield/main.go b/tview/demos/inputfield/main.go index 3eecd04e..17e10aa8 100644 --- a/tview/demos/inputfield/main.go +++ b/tview/demos/inputfield/main.go @@ -2,12 +2,13 @@ package main import ( - tcell "github.com/gdamore/tcell/v2" + "github.com/Bios-Marcel/cordless/config" "github.com/Bios-Marcel/cordless/tview" + tcell "github.com/gdamore/tcell/v2" ) func main() { - app := tview.NewApplication() + app := tview.NewApplication(config.Current.VimEnabled) inputField := tview.NewInputField(). SetLabel("Enter a number: "). SetPlaceholder("E.g. 1234"). diff --git a/tview/demos/list/main.go b/tview/demos/list/main.go index 5e4ba348..851e6a61 100644 --- a/tview/demos/list/main.go +++ b/tview/demos/list/main.go @@ -2,11 +2,12 @@ package main import ( + "github.com/Bios-Marcel/cordless/config" "github.com/Bios-Marcel/cordless/tview" ) func main() { - app := tview.NewApplication() + app := tview.NewApplication(config.Current.VimEnabled) list := tview.NewList(). AddItem("List item 1", "Some explanatory text", 'a', nil). AddItem("List item 2", "Some explanatory text", 'b', nil). diff --git a/tview/demos/modal/main.go b/tview/demos/modal/main.go index 0eb61a30..2c752bae 100644 --- a/tview/demos/modal/main.go +++ b/tview/demos/modal/main.go @@ -6,11 +6,12 @@ import ( tcell "github.com/gdamore/tcell/v2" + "github.com/Bios-Marcel/cordless/config" "github.com/Bios-Marcel/cordless/tview" ) func main() { - app := tview.NewApplication() + app := tview.NewApplication(config.Current.VimEnabled) // Returns a new primitive which puts the provided primitive in the center and // sets its size to the given width and height. diff --git a/tview/demos/overflowindicators/main.go b/tview/demos/overflowindicators/main.go index e38d503d..0695ebd7 100644 --- a/tview/demos/overflowindicators/main.go +++ b/tview/demos/overflowindicators/main.go @@ -1,12 +1,14 @@ package main import ( - "github.com/Bios-Marcel/cordless/tview" "strings" + + "github.com/Bios-Marcel/cordless/config" + "github.com/Bios-Marcel/cordless/tview" ) func main() { - app := tview.NewApplication() + app := tview.NewApplication(config.Current.VimEnabled) textView := tview.NewTextView(). SetWordWrap(true). SetChangedFunc(func() { diff --git a/tview/demos/pages/main.go b/tview/demos/pages/main.go index 87373eff..ee6469b1 100644 --- a/tview/demos/pages/main.go +++ b/tview/demos/pages/main.go @@ -4,13 +4,14 @@ package main import ( "fmt" + "github.com/Bios-Marcel/cordless/config" "github.com/Bios-Marcel/cordless/tview" ) const pageCount = 5 func main() { - app := tview.NewApplication() + app := tview.NewApplication(config.Current.VimEnabled) pages := tview.NewPages() for page := 0; page < pageCount; page++ { func(page int) { diff --git a/tview/demos/presentation/main.go b/tview/demos/presentation/main.go index a23c5715..46143690 100644 --- a/tview/demos/presentation/main.go +++ b/tview/demos/presentation/main.go @@ -16,8 +16,9 @@ import ( "fmt" "strconv" - tcell "github.com/gdamore/tcell/v2" + "github.com/Bios-Marcel/cordless/config" "github.com/Bios-Marcel/cordless/tview" + tcell "github.com/gdamore/tcell/v2" ) // Slide is a function which returns the slide's main primitive and its title. @@ -26,7 +27,7 @@ import ( type Slide func(nextSlide func()) (title string, content tview.Primitive) // The application. -var app = tview.NewApplication() +var app = tview.NewApplication(config.Current.VimEnabled) // Starting point for the presentation. func main() { diff --git a/tview/demos/primitive/main.go b/tview/demos/primitive/main.go index 6c6da877..a306dd70 100644 --- a/tview/demos/primitive/main.go +++ b/tview/demos/primitive/main.go @@ -4,6 +4,7 @@ package main import ( "fmt" + "github.com/Bios-Marcel/cordless/config" "github.com/Bios-Marcel/cordless/tview" tcell "github.com/gdamore/tcell/v2" ) @@ -74,7 +75,7 @@ func main() { radioButtons.SetBorder(true). SetTitle("Radio Button Demo"). SetRect(0, 0, 30, 5) - if err := tview.NewApplication().SetRoot(radioButtons, false).Run(); err != nil { + if err := tview.NewApplication(config.Current.VimEnabled).SetRoot(radioButtons, false).Run(); err != nil { panic(err) } } diff --git a/tview/demos/table/main.go b/tview/demos/table/main.go index 3910eeb4..e5b6cf57 100644 --- a/tview/demos/table/main.go +++ b/tview/demos/table/main.go @@ -4,12 +4,13 @@ package main import ( "strings" - tcell "github.com/gdamore/tcell/v2" + "github.com/Bios-Marcel/cordless/config" "github.com/Bios-Marcel/cordless/tview" + tcell "github.com/gdamore/tcell/v2" ) func main() { - app := tview.NewApplication() + app := tview.NewApplication(config.Current.VimEnabled) table := tview.NewTable(). SetBorders(true) lorem := strings.Split("Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.", " ") diff --git a/tview/demos/textview/main.go b/tview/demos/textview/main.go index 226323b2..55b557f4 100644 --- a/tview/demos/textview/main.go +++ b/tview/demos/textview/main.go @@ -7,8 +7,9 @@ import ( "strings" "time" - tcell "github.com/gdamore/tcell/v2" + "github.com/Bios-Marcel/cordless/config" "github.com/Bios-Marcel/cordless/tview" + tcell "github.com/gdamore/tcell/v2" ) const corporate = `Leverage agile frameworks to provide a robust synopsis for high level overviews. Iterative approaches to corporate strategy foster collaborative thinking to further the overall value proposition. Organically grow the holistic world view of disruptive innovation via workplace diversity and empowerment. @@ -20,7 +21,7 @@ Capitalize on low hanging fruit to identify a ballpark value added activity to b [yellow]Press Enter, then Tab/Backtab for word selections` func main() { - app := tview.NewApplication() + app := tview.NewApplication(config.Current.VimEnabled) textView := tview.NewTextView(). SetDynamicColors(true). SetRegions(true). diff --git a/tview/demos/treeview/main.go b/tview/demos/treeview/main.go index 14995aa8..dc165b94 100644 --- a/tview/demos/treeview/main.go +++ b/tview/demos/treeview/main.go @@ -5,8 +5,9 @@ import ( "io/ioutil" "path/filepath" - tcell "github.com/gdamore/tcell/v2" + "github.com/Bios-Marcel/cordless/config" "github.com/Bios-Marcel/cordless/tview" + tcell "github.com/gdamore/tcell/v2" ) // Show a navigable tree view of the current directory. @@ -56,7 +57,7 @@ func main() { } }) - if err := tview.NewApplication().SetRoot(tree, true).Run(); err != nil { + if err := tview.NewApplication(config.Current.VimEnabled).SetRoot(tree, true).Run(); err != nil { panic(err) } } diff --git a/tview/demos/unicode/main.go b/tview/demos/unicode/main.go index 9d912e5e..d5ba5a35 100644 --- a/tview/demos/unicode/main.go +++ b/tview/demos/unicode/main.go @@ -4,11 +4,12 @@ package main import ( "fmt" + "github.com/Bios-Marcel/cordless/config" "github.com/Bios-Marcel/cordless/tview" ) func main() { - app := tview.NewApplication() + app := tview.NewApplication(config.Current.VimEnabled) pages := tview.NewPages() form := tview.NewForm() diff --git a/ui/shortcutdialog/dialog.go b/ui/shortcutdialog/dialog.go index e7cbf533..5c7dee76 100644 --- a/ui/shortcutdialog/dialog.go +++ b/ui/shortcutdialog/dialog.go @@ -3,6 +3,7 @@ package shortcutdialog import ( "log" + "github.com/Bios-Marcel/cordless/config" "github.com/Bios-Marcel/cordless/shortcuts" "github.com/Bios-Marcel/cordless/tview" "github.com/Bios-Marcel/cordless/ui/components" @@ -98,7 +99,7 @@ func RunShortcutsDialogStandalone() { if loadError != nil { log.Fatalf("Error loading shortcuts: %s\n", loadError) } - app := tview.NewApplication(false) + app := tview.NewApplication(config.Current.VimEnabled) app.SetInputCapture(func(event *tcell.EventKey) *tcell.EventKey { if shortcuts.ExitApplication.Equals(event) { app.Stop() From 30b8b965ab3aa1ec2de135467fab9226cda87f4f Mon Sep 17 00:00:00 2001 From: Daniel Perez Date: Sun, 22 Nov 2020 16:41:20 +0100 Subject: [PATCH 30/31] Fixed go.mod and go.sum --- go.mod | 3 --- go.sum | 68 ++++++++++++++++++++++++++++------------------------------ 2 files changed, 33 insertions(+), 38 deletions(-) diff --git a/go.mod b/go.mod index d3200a8e..67f0a5ac 100644 --- a/go.mod +++ b/go.mod @@ -9,7 +9,6 @@ require ( github.com/Bios-Marcel/shortnotforlong v1.1.1 github.com/alecthomas/chroma v0.7.3 github.com/atotto/clipboard v0.1.2 - github.com/bunyk/gokeybr v0.0.0-20201019133936-f9e4ed3fdc5d // indirect github.com/gdamore/tcell/v2 v2.0.0 github.com/gen2brain/beeep v0.0.0-20200526185328-e9c15c258e28 github.com/google/go-github/v29 v29.0.3 @@ -21,8 +20,6 @@ require ( github.com/robertkrimen/otto v0.0.0-20200922221731-ef014fd054ac github.com/sergi/go-diff v1.1.0 github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966 - golang.org/x/tools v0.0.0-20201112171726-b38955972a18 // indirect - golang.org/x/tools/gopls v0.5.2 // indirect gopkg.in/sourcemap.v1 v1.0.5 // indirect rsc.io/qr v0.2.0 ) diff --git a/go.sum b/go.sum index 78931bda..e9181dda 100644 --- a/go.sum +++ b/go.sum @@ -1,78 +1,76 @@ -github.com/Bios-Marcel/discordemojimap v1.0.1 h1:b3UYPO7+h1+ciStkwU/KQCerOmpUNPHsBf4a7EjMdys= github.com/Bios-Marcel/discordemojimap v1.0.1/go.mod h1:AoHIpUwf3EVCAAUmk+keXjb9khyZcFnW84/rhJd4IkU= -github.com/Bios-Marcel/discordgo v0.21.2-0.20201025194456-7046b5509389 h1:Ha9AEp9HwOZElVwWWiA/aYU4g6dOYwJIhnxYf8XsNSo= github.com/Bios-Marcel/discordgo v0.21.2-0.20201025194456-7046b5509389/go.mod h1:tHeTdL2sSGuZcRHa+lp+SteLEy/XdVQisWlsMXa33L4= -github.com/Bios-Marcel/goclipimg v0.0.0-20191117180634-d0f7b06fbe82 h1:gspJ6CW9bhboosSISmuX2iq03pUsYHzlJN0s+z4fz4E= github.com/Bios-Marcel/goclipimg v0.0.0-20191117180634-d0f7b06fbe82/go.mod h1:hiFR6fH5+uc/f2yK2syh/UfzaPfGo6F2HJSoiI4ufWU= -github.com/Bios-Marcel/shortnotforlong v1.1.1 h1:cCJIp6MODd4rwH5Y+fAMAaIuFxS1FPKfwDbRzsCU9nM= github.com/Bios-Marcel/shortnotforlong v1.1.1/go.mod h1:g6bFiwq0pq7pqENRgHiCZu7uMzeYPIXwANlaBQ47LBw= -github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38 h1:smF2tmSOzy2Mm+0dGI2AIUHY+w0BUc+4tn40djz7+6U= github.com/alecthomas/assert v0.0.0-20170929043011-405dbfeb8e38/go.mod h1:r7bzyVFMNntcxPZXK3/+KdruV1H5KSlyVY0gc+NgInI= -github.com/alecthomas/chroma v0.7.3 h1:NfdAERMy+esYQs8OXk0I868/qDxxCEo7FMz1WIqMAeI= github.com/alecthomas/chroma v0.7.3/go.mod h1:sko8vR34/90zvl5QdcUdvzL3J8NKjAUx9va9jPuFNoM= -github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721 h1:JHZL0hZKJ1VENNfmXvHbgYlbUOvpzYzvy2aZU5gXVeo= github.com/alecthomas/colour v0.0.0-20160524082231-60882d9e2721/go.mod h1:QO9JBoKquHd+jz9nshCh40fOfO+JzsoXy8qTHF68zU0= github.com/alecthomas/kong v0.2.4/go.mod h1:kQOmtJgV+Lb4aj+I2LEn40cbtawdWJ9Y8QLq+lElKxE= -github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897 h1:p9Sln00KOTlrYkxI1zYWl1QLnEqAqEARBEYa8FQnQcY= github.com/alecthomas/repr v0.0.0-20180818092828-117648cd9897/go.mod h1:xTS7Pm1pD1mvyM075QCDSRqH6qRLXylzS24ZTpRiSzQ= -github.com/atotto/clipboard v0.1.2 h1:YZCtFu5Ie8qX2VmVTBnrqLSiU9XOWwqNRmdT3gIQzbY= github.com/atotto/clipboard v0.1.2/go.mod h1:ZY9tmq7sm5xIbd9bOK4onWV4S6X0u6GY7Vn0Yu86PYI= -github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964 h1:y5HC9v93H5EPKqaS1UYVg1uYah5Xf51mBfIoWehClUQ= github.com/danwakefield/fnmatch v0.0.0-20160403171240-cbb64ac3d964/go.mod h1:Xd9hchkHSWYkEqJwUGisez3G1QY8Ryz0sdWrLPMGjLk= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dlclark/regexp2 v1.2.0 h1:8sAhBGEM0dRWogWqWyQeIJnxjWO6oIjl8FKqREDsGfk= github.com/dlclark/regexp2 v1.2.0/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= -github.com/gdamore/encoding v1.0.0 h1:+7OoQ1Bc6eTm5niUzBa0Ctsh6JbMW6Ra+YNuAtDBdko= github.com/gdamore/encoding v1.0.0/go.mod h1:alR0ol34c49FCSBLjhosxzcPHQbf2trDkoo5dl+VrEg= -github.com/gdamore/tcell/v2 v2.0.0 h1:GRWG8aLfWAlekj9Q6W29bVvkHENc6hp79XOqG4AWDOs= github.com/gdamore/tcell/v2 v2.0.0/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA= -github.com/gen2brain/beeep v0.0.0-20200526185328-e9c15c258e28 h1:M2Zt3G2w6Q57GZndOYk42p7RvMeO8izO8yKTfIxGqxA= github.com/gen2brain/beeep v0.0.0-20200526185328-e9c15c258e28/go.mod h1:ElSskYZe3oM8kThaHGJ+kiN2yyUMVXMZ7WxF9QqLDS8= -github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4 h1:qZNfIGkIANxGv/OqtnntR4DfOY2+BgwR60cAcu/i3SE= github.com/go-toast/toast v0.0.0-20190211030409-01e6764cf0a4/go.mod h1:kW3HQ4UdaAyrUCSSDR4xUzBKW6O2iA4uHhk7AtyYp10= -github.com/godbus/dbus/v5 v5.0.3 h1:ZqHaoEF7TBzh4jzPmqVhE/5A1z9of6orkAe5uHoAeME= github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= -github.com/google/go-github/v29 v29.0.3 h1:IktKCTwU//aFHnpA+2SLIi7Oo9uhAzgsdZNbcAqhgdc= github.com/google/go-github/v29 v29.0.3/go.mod h1:CHKiKKPHJ0REzfwc14QMklvtHwCveD0PxlMjLlzAM5E= -github.com/google/go-querystring v1.0.0 h1:Xkwi/a1rcvNg1PPYe5vI8GbeBY/jrVuDX5ASuANWTrk= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= -github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c h1:16eHWuMGvCjSfgRJKqIzapE78onvvTbdi1rMkU00lZw= github.com/gopherjs/gopherjs v0.0.0-20180825215210-0210a2f0f73c/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= -github.com/gopherjs/gopherwasm v1.1.0 h1:fA2uLoctU5+T3OhOn2vYP0DVT6pxc7xhTlBB1paATqQ= github.com/gopherjs/gopherwasm v1.1.0/go.mod h1:SkZ8z7CWBz5VXbhJel8TxCmAcsQqzgWGR/8nMhyhZSI= -github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc= github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= -github.com/lucasb-eyer/go-colorful v1.0.3 h1:QIbQXiugsb+q10B+MI+7DI1oQLdmnep86tWFlaaUAac= github.com/lucasb-eyer/go-colorful v1.0.3/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-isatty v0.0.8 h1:HLtExJ+uU2HOZ+wI0Tt5DtUDrx8yhUqDcp7fYERX4CE= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= -github.com/mattn/go-runewidth v0.0.7 h1:Ei8KR0497xHyKJPAv59M1dkC+rOZCMBJ+t3fZ+twI54= github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-runewidth v0.0.9 h1:Lm995f3rfxdpd6TSmuVCHVb/QhupuXlYr8sCI/QdE+0= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mdp/qrterminal v1.0.1 h1:07+fzVDlPuBlXS8tB0ktTAyf+Lp1j2+2zK3fBOL5b7c= github.com/mdp/qrterminal v1.0.1/go.mod h1:Z33WhxQe9B6CdW37HaVqcRKzP+kByF3q/qLxOGe12xQ= -github.com/mdp/qrterminal/v3 v3.0.0 h1:ywQqLRBXWTktytQNDKFjhAvoGkLVN3J2tAFZ0kMd9xQ= github.com/mdp/qrterminal/v3 v3.0.0/go.mod h1:NJpfAs7OAm77Dy8EkWrtE4aq+cE6McoLXlBqXQEwvE0= -github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d h1:VhgPp6v9qf9Agr/56bj7Y/xa04UccTW04VP0Qed4vnQ= github.com/nu7hatch/gouuid v0.0.0-20131221200532-179d4d0c4d8d/go.mod h1:YUTz3bUH2ZwIWBy3CJBeOBEugqcmXREj14T+iG/4k4U= -github.com/pkg/errors v0.8.1 h1:iURUrRGxPUNPdy5/HRSm+Yj6okJ6UtLINN0Q9M4+h3I= github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= -github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= +github.com/robertkrimen/otto v0.0.0-20200922221731-ef014fd054ac/go.mod h1:xvqspoSXJTIpemEonrMDFq6XzwHYYgToXWj5eRX1OtY= +github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= +github.com/sergi/go-diff v1.1.0/go.mod h1:STckp+ISIX8hZLjrqAeVduY0gWCT9IjLuqbuNXdaHfM= +github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966/go.mod h1:sUM3LWHvSMaG192sy56D9F7CNvL7jUJVXoqM1QKLnog= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/tadvi/systray v0.0.0-20190226123456-11a2b8fa57af/go.mod h1:4F09kP5F+am0jAwlQLddpoMDM+iewkxxt6nxUQ5nq5o= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200223170610-d5e6a3e2c0ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200413165638-669c56c373c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/sourcemap.v1 v1.0.5/go.mod h1:2RlvNNSMglmRrcvhfuzp4hQHwOtjxlbjX7UPY/GXb78= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +rsc.io/qr v0.2.0/go.mod h1:IF+uZjkb9fqyeF/4tlBoynqmQxUoPfWEKh921coOuXs= +0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/rivo/uniseg v0.1.0 h1:+2KBaVoUmb9XzDsrx/Ct0W/EYOSFf/nWTauy++DprtY= github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= From 68d08325a2ae2667baf60126ce37c5b6fff61b7c Mon Sep 17 00:00:00 2001 From: Daniel Perez Date: Sun, 22 Nov 2020 17:15:06 +0100 Subject: [PATCH 31/31] Fixed format and qol --- commands/commandimpls/vim.go | 8 +- config/config.go | 4 +- discordutil/guilds.go | 1 - femto/lineArray.go | 1 - shortcuts/shortcuts.go | 136 ++++++++++++------------- shortcuts/shortcuts_nix.go | 2 +- shortcuts/shortcuts_win.go | 2 +- tview/application.go | 4 +- tview/demos/inputfield-paste/main.go | 2 +- tview/demos/presentation/colors.go | 2 +- tview/demos/presentation/cover.go | 2 +- tview/demos/presentation/end.go | 2 +- tview/demos/presentation/flex.go | 2 +- tview/demos/presentation/grid.go | 2 +- tview/demos/presentation/helloworld.go | 2 +- tview/demos/presentation/inputfield.go | 2 +- tview/demos/presentation/table.go | 2 +- tview/demos/presentation/textview.go | 2 +- tview/demos/presentation/treeview.go | 2 +- ui/commandview.go | 2 +- ui/editor.go | 4 +- ui/shortcutdialog/table.go | 18 ++-- ui/window.go | 30 ++---- util/vim/vim.go | 31 +++--- 24 files changed, 125 insertions(+), 140 deletions(-) diff --git a/commands/commandimpls/vim.go b/commands/commandimpls/vim.go index e7625b37..eaa5b138 100644 --- a/commands/commandimpls/vim.go +++ b/commands/commandimpls/vim.go @@ -33,7 +33,7 @@ const ( ) type VimHelp struct { - vimMode *vim.Vim + vimMode *vim.Vim } func NewVimCmd(vimMode *vim.Vim) *VimHelp { @@ -47,14 +47,14 @@ func (v VimHelp) PrintHelp(writer io.Writer) { func (v VimHelp) Execute(writer io.Writer, parameters []string) { if len(parameters) < 1 { - fmt.Fprintf(writer, "You did not specify any parameter for this command.") + fmt.Fprintf(writer, "Usage: vim on/off") return } switch parameters[0] { - case "on","enable": + case "on", "enable": v.vimMode.CurrentMode = vim.NormalMode fmt.Fprintf(writer, "Vim mode has been enabled.\n") - case "off","disable": + case "off", "disable": v.vimMode.CurrentMode = vim.NormalMode v.vimMode.CurrentMode = vim.Disabled fmt.Fprintf(writer, "Vim mode has been disabled.\n") diff --git a/config/config.go b/config/config.go index 544719f3..2dd73266 100644 --- a/config/config.go +++ b/config/config.go @@ -156,6 +156,8 @@ type Config struct { // true, then all opened files are saved in this folder for example. FileDownloadSaveLocation string + // This will set the global vim keybindings when enabled, effectively + // taking over the normal bindings. It is changed in the config file. VimEnabled bool } @@ -213,7 +215,7 @@ func createDefaultConfig() *Config { FileOpenHandlers: make(map[string]string), FileOpenSaveFilesPermanently: false, FileDownloadSaveLocation: "~/Downloads", - VimEnabled: false, + VimEnabled: false, } } diff --git a/discordutil/guilds.go b/discordutil/guilds.go index 401d9c4c..b9cc6d31 100644 --- a/discordutil/guilds.go +++ b/discordutil/guilds.go @@ -66,7 +66,6 @@ func FindEmojiInGuild(session *discordgo.Session, guild *discordgo.Guild, omitGW continue } - if strings.EqualFold(emoji.Name, emojiSequence) && (omitGWCheck || strings.HasPrefix(emoji.Name, "GW")) { if len(emoji.Roles) != 0 { selfMember, cacheError := session.State.Member(guild.ID, session.State.User.ID) diff --git a/femto/lineArray.go b/femto/lineArray.go index 8e01020b..b2c101ef 100644 --- a/femto/lineArray.go +++ b/femto/lineArray.go @@ -234,4 +234,3 @@ func (la *LineArray) Substr(start, end Loc) string { str += string(la.lines[end.Y].data[:endX]) return str } - diff --git a/shortcuts/shortcuts.go b/shortcuts/shortcuts.go index 433ba10f..023438c1 100644 --- a/shortcuts/shortcuts.go +++ b/shortcuts/shortcuts.go @@ -30,49 +30,49 @@ var ( // A NullVimEvent will ignore that mapping inside the selected mode. QuoteSelectedMessage = addShortcut("quote_selected_message", "Quote selected message", chatview, tcell.NewEventKey(tcell.KeyRune, 'q', tcell.ModNone), - addVimEvent(NullVimEvent,nil,NullVimEvent), + addVimEvent(NullVimEvent, nil, NullVimEvent), // Normal Insert Visual ) EditSelectedMessage = addShortcut("edit_selected_message", "Edit selected message", chatview, tcell.NewEventKey(tcell.KeyRune, 'e', tcell.ModNone), - addVimEvent(NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'i', tcell.ModNone),NullVimEvent), + addVimEvent(NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'i', tcell.ModNone), NullVimEvent), ) DownloadMessageFiles = addShortcut("download_message_files", "Download all files in selected message", chatview, tcell.NewEventKey(tcell.KeyRune, 'd', tcell.ModNone), // FIXME solve delete messages keybinding conflict in visual mode - addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent), + addVimEvent(NullVimEvent, NullVimEvent, NullVimEvent), ) ReplySelectedMessage = addShortcut("reply_selected_message", "Reply to author selected message", chatview, tcell.NewEventKey(tcell.KeyRune, 'r', tcell.ModNone), - addVimEvent(NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'a', tcell.ModNone),NullVimEvent), + addVimEvent(NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'a', tcell.ModNone), NullVimEvent), ) NewDirectMessage = addShortcut("new_direct_message", "Create a new direct message channel with this user", chatview, tcell.NewEventKey(tcell.KeyRune, 'p', tcell.ModNone), - addVimEvent(NullVimEvent,tcell.NewEventKey(tcell.KeyEnter,rune(tcell.KeyEnter),tcell.ModNone),NullVimEvent), + addVimEvent(NullVimEvent, tcell.NewEventKey(tcell.KeyEnter, rune(tcell.KeyEnter), tcell.ModNone), NullVimEvent), ) CopySelectedMessageLink = addShortcut("copy_selected_message_link", "Copy link to selected message", chatview, tcell.NewEventKey(tcell.KeyRune, 'l', tcell.ModNone), - addVimEvent(NullVimEvent,nil,NullVimEvent), + addVimEvent(NullVimEvent, nil, NullVimEvent), ) CopySelectedMessage = addShortcut("copy_selected_message", "Copy content of selected message", chatview, tcell.NewEventKey(tcell.KeyRune, 'c', tcell.ModNone), - addVimEvent(NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'y', tcell.ModNone),NullVimEvent), + addVimEvent(NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'y', tcell.ModNone), NullVimEvent), ) ToggleSelectedMessageSpoilers = addShortcut("toggle_selected_message_spoilers", "Toggle spoilers in selected message", chatview, tcell.NewEventKey(tcell.KeyRune, 's', tcell.ModNone), - addVimEvent(NullVimEvent,nil,NullVimEvent), + addVimEvent(NullVimEvent, nil, NullVimEvent), ) DeleteSelectedMessage = addShortcut("delete_selected_message", "Delete the selected message", chatview, tcell.NewEventKey(tcell.KeyDelete, 0, tcell.ModNone), - addVimEvent(NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'd', tcell.ModNone),NullVimEvent), + addVimEvent(NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'd', tcell.ModNone), NullVimEvent), ) ViewSelectedMessageImages = addShortcut("view_selected_message_images", "View selected message's attached files", @@ -82,33 +82,33 @@ var ( ChatViewSelectionUp = addShortcut("selection_up", "Move selection up by one", chatview, tcell.NewEventKey(tcell.KeyUp, 0, tcell.ModNone), - addVimEvent(NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'k', tcell.ModNone),NullVimEvent), + addVimEvent(NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'k', tcell.ModNone), NullVimEvent), ) ChatViewSelectionDown = addShortcut("selection_down", "Move selection down by one", chatview, tcell.NewEventKey(tcell.KeyDown, 0, tcell.ModNone), - addVimEvent(NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'j', tcell.ModNone),NullVimEvent), + addVimEvent(NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'j', tcell.ModNone), NullVimEvent), ) ChatViewSelectionTop = addShortcut("selection_top", "Move selection to the upmost message", chatview, tcell.NewEventKey(tcell.KeyHome, 0, tcell.ModNone), - addVimEvent(NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'g', tcell.ModNone),NullVimEvent), + addVimEvent(NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'g', tcell.ModNone), NullVimEvent), ) ChatViewSelectionBottom = addShortcut("selection_bottom", "Move selection to the downmost message", chatview, tcell.NewEventKey(tcell.KeyEnd, 0, tcell.ModNone), - addVimEvent(NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'G', tcell.ModNone),NullVimEvent), + addVimEvent(NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'G', tcell.ModNone), NullVimEvent), ) // START OF INPUT ExpandSelectionToLeft = addShortcut("expand_selection_word_to_left", "Expand selection word to left", multilineTextInput, tcell.NewEventKey(tcell.KeyLeft, 0, tcell.ModShift), - addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'H', tcell.ModNone)), + addVimEvent(NullVimEvent, NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'H', tcell.ModNone)), ) ExpandSelectionToRight = addShortcut("expand_selection_word_to_right", "Expand selection word to right", multilineTextInput, tcell.NewEventKey(tcell.KeyRight, 0, tcell.ModShift), - addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'L', tcell.ModNone)), + addVimEvent(NullVimEvent, NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'L', tcell.ModNone)), ) SelectAll = addShortcut("select_all", "Select all", @@ -118,236 +118,230 @@ var ( SelectWordLeft = addShortcut("select_word_to_left", "Select word to left", multilineTextInput, tcell.NewEventKey(tcell.KeyLeft, 0, tcell.ModCtrl|tcell.ModShift), - addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'b', tcell.ModNone)), + addVimEvent(NullVimEvent, NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'b', tcell.ModNone)), ) SelectWordRight = addShortcut("select_word_to_right", "Select word to right", multilineTextInput, tcell.NewEventKey(tcell.KeyRight, 0, tcell.ModCtrl|tcell.ModShift), - addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'w', tcell.ModNone)), + addVimEvent(NullVimEvent, NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'w', tcell.ModNone)), ) // TODO create a way to store keys making multi key commands like yw, di or y$ SelectToStartOfLine = addShortcut("select_to_start_of_line", "Select to start of line", multilineTextInput, tcell.NewEventKey(tcell.KeyHome, 0, tcell.ModShift), - addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, '0', tcell.ModNone)), + addVimEvent(NullVimEvent, NullVimEvent, tcell.NewEventKey(tcell.KeyRune, '0', tcell.ModNone)), ) SelectToEndOfLine = addShortcut("select_to_end_of_line", "Select to end of line", multilineTextInput, tcell.NewEventKey(tcell.KeyEnd, 0, tcell.ModShift), - addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, '$', tcell.ModNone)), + addVimEvent(NullVimEvent, NullVimEvent, tcell.NewEventKey(tcell.KeyRune, '$', tcell.ModNone)), ) SelectToStartOfText = addShortcut("select_to_start_of_text", "Select to start of text", multilineTextInput, tcell.NewEventKey(tcell.KeyHome, 0, tcell.ModCtrl|tcell.ModShift), - addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'g', tcell.ModNone)), + addVimEvent(NullVimEvent, NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'g', tcell.ModNone)), ) SelectToEndOfText = addShortcut("select_to_end_of_text", "Select to end of text", multilineTextInput, tcell.NewEventKey(tcell.KeyEnd, 0, tcell.ModCtrl|tcell.ModShift), - addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'G', tcell.ModNone)), + addVimEvent(NullVimEvent, NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'G', tcell.ModNone)), ) MoveCursorLeft = addShortcut("move_cursor_to_left", "Move cursor to left", multilineTextInput, tcell.NewEventKey(tcell.KeyLeft, 0, tcell.ModNone), - addVimEvent(NullVimEvent,nil,NullVimEvent), + addVimEvent(NullVimEvent, nil, NullVimEvent), ) MoveCursorRight = addShortcut("move_cursor_to_right", "Move cursor to right", multilineTextInput, tcell.NewEventKey(tcell.KeyRight, 0, tcell.ModNone), - addVimEvent(NullVimEvent,nil,NullVimEvent), + addVimEvent(NullVimEvent, nil, NullVimEvent), ) MoveCursorWordLeft = addShortcut("move_cursor_to_word_left", "Move cursor to word left", multilineTextInput, tcell.NewEventKey(tcell.KeyLeft, 0, tcell.ModCtrl), - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'b', tcell.ModNone),NullVimEvent,NullVimEvent), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'b', tcell.ModNone), NullVimEvent, NullVimEvent), ) MoveCursorWordRight = addShortcut("move_cursor_to_word_right", "Move cursor to word right", multilineTextInput, tcell.NewEventKey(tcell.KeyRight, 0, tcell.ModCtrl), - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'w', tcell.ModNone),NullVimEvent,NullVimEvent), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'w', tcell.ModNone), NullVimEvent, NullVimEvent), ) MoveCursorStartOfLine = addShortcut("move_cursor_to_start_of_line", "Move cursor to start of line", multilineTextInput, tcell.NewEventKey(tcell.KeyHome, 0, tcell.ModNone), - addVimEvent(tcell.NewEventKey(tcell.KeyRune, '0', tcell.ModNone),NullVimEvent,NullVimEvent), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, '0', tcell.ModNone), NullVimEvent, NullVimEvent), ) MoveCursorEndOfLine = addShortcut("move_cursor_to_end_of_line", "Move cursor to end of line", multilineTextInput, tcell.NewEventKey(tcell.KeyEnd, 0, tcell.ModNone), - addVimEvent(tcell.NewEventKey(tcell.KeyRune, '$', tcell.ModNone),NullVimEvent,NullVimEvent), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, '$', tcell.ModNone), NullVimEvent, NullVimEvent), ) MoveCursorStartOfText = addShortcut("move_cursor_to_start_of_text", "Move cursor to start of text", multilineTextInput, tcell.NewEventKey(tcell.KeyHome, 0, tcell.ModCtrl), - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'g', tcell.ModNone),NullVimEvent,NullVimEvent), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'g', tcell.ModNone), NullVimEvent, NullVimEvent), ) MoveCursorEndOfText = addShortcut("move_cursor_to_end_of_text", "Move cursor to end of text", multilineTextInput, tcell.NewEventKey(tcell.KeyEnd, 0, tcell.ModCtrl), - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'G', tcell.ModNone),NullVimEvent,NullVimEvent), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'G', tcell.ModNone), NullVimEvent, NullVimEvent), ) - - - DeleteLeft = addDeleteLeftShortcut() - - - + DeleteLeft = addDeleteLeftShortcut() DeleteRight = addShortcut("delete_right", "Delete right", - multilineTextInput, tcell.NewEventKey(tcell.KeyDelete, 0, tcell.ModNone),addVimEvent(NullVimEvent,nil,NullVimEvent)) + multilineTextInput, tcell.NewEventKey(tcell.KeyDelete, 0, tcell.ModNone), addVimEvent(NullVimEvent, nil, NullVimEvent)) DeleteWordLeft = addShortcut("delete_word_left", "Delete word left", - multilineTextInput, tcell.NewEventKey(tcell.KeyCtrlW, rune(tcell.KeyCtrlW), tcell.ModCtrl),addVimEvent(NullVimEvent,nil,NullVimEvent)) + multilineTextInput, tcell.NewEventKey(tcell.KeyCtrlW, rune(tcell.KeyCtrlW), tcell.ModCtrl), addVimEvent(NullVimEvent, nil, NullVimEvent)) InputNewLine = addShortcut("add_new_line_character", "Add new line character", - multilineTextInput, tcell.NewEventKey(tcell.KeyEnter, rune(tcell.KeyEnter), tcell.ModAlt),addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'o', tcell.ModNone),NullVimEvent,NullVimEvent)) - + multilineTextInput, tcell.NewEventKey(tcell.KeyEnter, rune(tcell.KeyEnter), tcell.ModAlt), addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'o', tcell.ModNone), NullVimEvent, NullVimEvent)) CopySelection = addShortcut("copy_selection", "Copy selected text", multilineTextInput, tcell.NewEventKey(tcell.KeyRune, 'C', tcell.ModAlt), - addVimEvent(NullVimEvent,NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'y', tcell.ModNone)), + addVimEvent(NullVimEvent, NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'y', tcell.ModNone)), ) //Don't fix the typo, it'll break stuff ;) ---- (glups) PasteAtSelection = addShortcut("paste_at_selectiom", "Paste clipboard content", multilineTextInput, tcell.NewEventKey(tcell.KeyCtrlV, rune(tcell.KeyCtrlV), tcell.ModCtrl), - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'p',tcell.ModNone),NullVimEvent,NullVimEvent), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'p', tcell.ModNone), NullVimEvent, NullVimEvent), ) SendMessage = addShortcut("send_message", "Sends the typed message", multilineTextInput, tcell.NewEventKey(tcell.KeyEnter, rune(tcell.KeyEnter), tcell.ModNone), - addVimEvent(NullVimEvent,nil,NullVimEvent), + addVimEvent(NullVimEvent, nil, NullVimEvent), ) AddNewLineInCodeBlock = addShortcut("add_new_line_in_code_block", "Adds a new line inside a code block", multilineTextInput, tcell.NewEventKey(tcell.KeyEnter, rune(tcell.KeyEnter), tcell.ModNone), - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'o', tcell.ModNone),NullVimEvent,NullVimEvent), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'o', tcell.ModNone), NullVimEvent, NullVimEvent), ) ExitApplication = addShortcut("exit_application", "Exit application", globalScope, tcell.NewEventKey(tcell.KeyCtrlC, rune(tcell.KeyCtrlC), tcell.ModCtrl), - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'q', tcell.ModNone),NullVimEvent,NullVimEvent), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'q', tcell.ModNone), NullVimEvent, NullVimEvent), ) FocusUp = addShortcut("focus_up", "Focus the next widget above", globalScope, tcell.NewEventKey(tcell.KeyUp, 0, tcell.ModAlt), - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'k', tcell.ModNone),NullVimEvent,NullVimEvent), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'k', tcell.ModNone), NullVimEvent, NullVimEvent), ) FocusDown = addShortcut("focus_down", "Focus the next widget below", globalScope, tcell.NewEventKey(tcell.KeyDown, 0, tcell.ModAlt), - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'j', tcell.ModNone),NullVimEvent,NullVimEvent), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'j', tcell.ModNone), NullVimEvent, NullVimEvent), ) FocusLeft = addShortcut("focus_left", "Focus the next widget to the left", globalScope, tcell.NewEventKey(tcell.KeyLeft, 0, tcell.ModAlt), - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'h', tcell.ModNone),NullVimEvent,NullVimEvent), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'h', tcell.ModNone), NullVimEvent, NullVimEvent), ) FocusRight = addShortcut("focus_right", "Focus the next widget to the right", globalScope, tcell.NewEventKey(tcell.KeyRight, 0, tcell.ModAlt), - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'l', tcell.ModNone),NullVimEvent,NullVimEvent), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'l', tcell.ModNone), NullVimEvent, NullVimEvent), ) FocusChannelContainer = addShortcut("focus_channel_container", "Focus channel container", globalScope, tcell.NewEventKey(tcell.KeyRune, 'c', tcell.ModAlt), - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'c', tcell.ModNone),NullVimEvent,NullVimEvent), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'c', tcell.ModNone), NullVimEvent, NullVimEvent), ) FocusUserContainer = addShortcut("focus_user_container", "Focus user container", globalScope, tcell.NewEventKey(tcell.KeyRune, 'u', tcell.ModAlt), - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'u', tcell.ModNone),NullVimEvent,NullVimEvent), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'u', tcell.ModNone), NullVimEvent, NullVimEvent), ) FocusGuildContainer = addShortcut("focus_guild_container", "Focus guild container", globalScope, tcell.NewEventKey(tcell.KeyRune, 's', tcell.ModAlt), - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 's', tcell.ModNone),NullVimEvent,NullVimEvent), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 's', tcell.ModNone), NullVimEvent, NullVimEvent), ) FocusPrivateChatPage = addShortcut("focus_private_chat_page", "Focus private chat page", globalScope, tcell.NewEventKey(tcell.KeyRune, 'p', tcell.ModAlt), - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'P', tcell.ModNone),NullVimEvent,NullVimEvent), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'P', tcell.ModNone), NullVimEvent, NullVimEvent), ) SwitchToPreviousChannel = addShortcut("switch_to_previous_channel", "Switch to previous channel", globalScope, tcell.NewEventKey(tcell.KeyRune, 'l', tcell.ModAlt), // FIXME unbound - addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent), + addVimEvent(NullVimEvent, NullVimEvent, NullVimEvent), ) FocusMessageInput = addShortcut("focus_message_input", "Focus message input", globalScope, tcell.NewEventKey(tcell.KeyRune, 'm', tcell.ModAlt), // Toggle insert mode - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'I', tcell.ModNone),NullVimEvent,NullVimEvent), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'I', tcell.ModNone), NullVimEvent, NullVimEvent), ) FocusMessageContainer = addShortcut("focus_message_container", "Focus message container", globalScope, tcell.NewEventKey(tcell.KeyRune, 't', tcell.ModAlt), - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 't', tcell.ModNone),NullVimEvent,NullVimEvent), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 't', tcell.ModNone), NullVimEvent, NullVimEvent), ) FocusCommandInput = addShortcut("focus_command_input", "Focus command input", // FIXME unbound - globalScope, nil, addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent)) + globalScope, nil, addVimEvent(NullVimEvent, NullVimEvent, NullVimEvent)) FocusCommandOutput = addShortcut("focus_command_output", "Focus command output", // FIXME unbound - globalScope, nil, addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent)) + globalScope, nil, addVimEvent(NullVimEvent, NullVimEvent, NullVimEvent)) ToggleUserContainer = addShortcut("toggle_user_container", "Toggle user container", globalScope, tcell.NewEventKey(tcell.KeyRune, 'U', tcell.ModAlt), - addVimEvent(nil,NullVimEvent,NullVimEvent), + addVimEvent(nil, NullVimEvent, NullVimEvent), ) ToggleCommandView = addShortcut("toggle_command_view", "Toggle command view", globalScope, tcell.NewEventKey(tcell.KeyRune, '.', tcell.ModAlt), - addVimEvent(tcell.NewEventKey(tcell.KeyRune, ':', tcell.ModNone),NullVimEvent,NullVimEvent), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, ':', tcell.ModNone), NullVimEvent, NullVimEvent), ) ToggleBareChat = addShortcut("toggle_bare_chat", "Toggle bare chat", globalScope, tcell.NewEventKey(tcell.KeyCtrlB, rune(tcell.KeyCtrlB), tcell.ModCtrl), // FIXME unknown binding - addVimEvent(NullVimEvent,NullVimEvent,NullVimEvent), + addVimEvent(NullVimEvent, NullVimEvent, NullVimEvent), ) GuildListMarkRead = addShortcut("guild_mark_read", "Mark server as read", guildlist, tcell.NewEventKey(tcell.KeyCtrlR, rune(tcell.KeyCtrlR), tcell.ModCtrl), - addVimEvent(NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'm', tcell.ModNone), tcell.NewEventKey(tcell.KeyRune, 'm', tcell.ModNone)), + addVimEvent(NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'm', tcell.ModNone), tcell.NewEventKey(tcell.KeyRune, 'm', tcell.ModNone)), ) ChannelTreeMarkRead = addShortcut("channel_mark_read", "Mark channel as read", channeltree, tcell.NewEventKey(tcell.KeyCtrlR, rune(tcell.KeyCtrlR), tcell.ModCtrl), - addVimEvent(NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'm', tcell.ModNone), tcell.NewEventKey(tcell.KeyRune, 'm', tcell.ModNone)), + addVimEvent(NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'm', tcell.ModNone), tcell.NewEventKey(tcell.KeyRune, 'm', tcell.ModNone)), ) VimInsertMode = addShortcut("vim_insert_mode", "Change to Vim insert mode", globalScope, nil, - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'i', tcell.ModNone),NullVimEvent,NullVimEvent), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'i', tcell.ModNone), NullVimEvent, NullVimEvent), ) VimVisualMode = addShortcut("vim_visual_mode", "Change to Vim visual mode", globalScope, nil, - addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'v', tcell.ModNone),NullVimEvent,NullVimEvent), + addVimEvent(tcell.NewEventKey(tcell.KeyRune, 'v', tcell.ModNone), NullVimEvent, NullVimEvent), ) VimNormalMode = addShortcut("vim_normal_mode", "Return to vim normal mode", globalScope, nil, // FIXME escape key not working in my machine. Using hyphen instead temporarily. - addVimEvent(tcell.NewEventKey(tcell.KeyEscape, 0, tcell.ModNone),tcell.NewEventKey(tcell.KeyEscape, 0, tcell.ModNone),tcell.NewEventKey(tcell.KeyEscape, 0, tcell.ModNone)), + addVimEvent(tcell.NewEventKey(tcell.KeyEscape, 0, tcell.ModNone), tcell.NewEventKey(tcell.KeyEscape, 0, tcell.ModNone), tcell.NewEventKey(tcell.KeyEscape, 0, tcell.ModNone)), ) VimSimKeyUp = addShortcut("vim_sim_up", "Simulate an arrow key press in vim mode.", globalScope, nil, - addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'k', tcell.ModNone))) + addVimEvent(NullVimEvent, NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'k', tcell.ModNone))) VimSimKeyDown = addShortcut("vim_sim_down", "Simulate an arrow key press in vim mode.", globalScope, nil, - addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'j', tcell.ModNone))) + addVimEvent(NullVimEvent, NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'j', tcell.ModNone))) VimSimKeyLeft = addShortcut("vim_sim_left", "Simulate an arrow key press in vim mode.", globalScope, nil, - addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'h', tcell.ModNone))) + addVimEvent(NullVimEvent, NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'h', tcell.ModNone))) VimSimKeyRight = addShortcut("vim_sim_right", "Simulate an arrow key press in vim mode.", globalScope, nil, - addVimEvent(NullVimEvent,NullVimEvent,tcell.NewEventKey(tcell.KeyRune, 'l', tcell.ModNone))) + addVimEvent(NullVimEvent, NullVimEvent, tcell.NewEventKey(tcell.KeyRune, 'l', tcell.ModNone))) scopes []*Scope Shortcuts []*Shortcut @@ -365,7 +359,7 @@ type VimEvent struct { // NullVimEvent is the null event for the current vim mode. Any events that have this will be ignored. var NullVimEvent *tcell.EventKey = new(tcell.EventKey) -func addVimEvent(events... *tcell.EventKey) *VimEvent { +func addVimEvent(events ...*tcell.EventKey) *VimEvent { vimE := VimEvent{NormalEvent: events[0], InsertEvent: events[1], VisualEvent: events[2]} return &vimE } @@ -425,7 +419,7 @@ type Shortcut struct { // Every shortcut receives a pointer to vimMode, therefore not // wasting memory - VimStatus *vim.Vim + VimStatus *vim.Vim // VimModifier is the shortcut that will be used inside vim mode. VimModifier *VimEvent diff --git a/shortcuts/shortcuts_nix.go b/shortcuts/shortcuts_nix.go index 1a8630d5..c0fa73a7 100644 --- a/shortcuts/shortcuts_nix.go +++ b/shortcuts/shortcuts_nix.go @@ -6,5 +6,5 @@ import tcell "github.com/gdamore/tcell/v2" func addDeleteLeftShortcut() *Shortcut { // FIXME don't know what to do with this vim binding - return addShortcut("delete_left", "Delete left", multilineTextInput, tcell.NewEventKey(tcell.KeyBackspace2, rune(tcell.KeyBackspace2), tcell.ModNone),addVimEvent(NullVimEvent,nil,NullVimEvent)) + return addShortcut("delete_left", "Delete left", multilineTextInput, tcell.NewEventKey(tcell.KeyBackspace2, rune(tcell.KeyBackspace2), tcell.ModNone), addVimEvent(NullVimEvent, nil, NullVimEvent)) } diff --git a/shortcuts/shortcuts_win.go b/shortcuts/shortcuts_win.go index e65b777a..f4b6e888 100644 --- a/shortcuts/shortcuts_win.go +++ b/shortcuts/shortcuts_win.go @@ -5,5 +5,5 @@ package shortcuts import tcell "github.com/gdamore/tcell/v2" func addDeleteLeftShortcut() *Shortcut { - return addShortcut("delete_left", "Delete left", multilineTextInput, tcell.NewEventKey(tcell.KeyBackspace, rune(tcell.KeyBackspace), tcell.ModNone),nil) + return addShortcut("delete_left", "Delete left", multilineTextInput, tcell.NewEventKey(tcell.KeyBackspace, rune(tcell.KeyBackspace), tcell.ModNone), nil) } diff --git a/tview/application.go b/tview/application.go index c32e07bf..70fdbaaf 100644 --- a/tview/application.go +++ b/tview/application.go @@ -68,7 +68,7 @@ type Application struct { // stop the application. screenReplacement chan tcell.Screen - VimMode *vim.Vim + VimMode *vim.Vim } // NewApplication creates and returns a new application. @@ -78,7 +78,7 @@ func NewApplication(vimEnabled bool) *Application { updates: make(chan func(), queueSize), screenReplacement: make(chan tcell.Screen, 1), MouseEnabled: true, - VimMode: vim.NewVim(vimEnabled), + VimMode: vim.NewVim(vimEnabled), } } diff --git a/tview/demos/inputfield-paste/main.go b/tview/demos/inputfield-paste/main.go index abc426e6..7c61fab3 100644 --- a/tview/demos/inputfield-paste/main.go +++ b/tview/demos/inputfield-paste/main.go @@ -16,6 +16,6 @@ func main() { return event }) - app := tview.NewApplication(config.Current.VimEnabled).SetRoot(field,true) + app := tview.NewApplication(config.Current.VimEnabled).SetRoot(field, true) app.Run() } diff --git a/tview/demos/presentation/colors.go b/tview/demos/presentation/colors.go index 2aa70058..901225dd 100644 --- a/tview/demos/presentation/colors.go +++ b/tview/demos/presentation/colors.go @@ -3,8 +3,8 @@ package main import ( "strings" - tcell "github.com/gdamore/tcell/v2" "github.com/Bios-Marcel/cordless/tview" + tcell "github.com/gdamore/tcell/v2" ) const colorsText = `You can use color tags almost everywhere to partially change the color of a string. Simply put a color name or hex string in square brackets to change the following characters' color. H[green]er[white]e i[yellow]s a[darkcyan]n ex[red]amp[white]le. The [black:red]tags [black:green]look [black:yellow]like [::u]this: [blue:yellow:u[] [#00ff00[]` diff --git a/tview/demos/presentation/cover.go b/tview/demos/presentation/cover.go index e8a59e74..1ab5f3ac 100644 --- a/tview/demos/presentation/cover.go +++ b/tview/demos/presentation/cover.go @@ -4,8 +4,8 @@ import ( "fmt" "strings" - tcell "github.com/gdamore/tcell/v2" "github.com/Bios-Marcel/cordless/tview" + tcell "github.com/gdamore/tcell/v2" ) const logo = ` diff --git a/tview/demos/presentation/end.go b/tview/demos/presentation/end.go index 7fb9b605..85551659 100644 --- a/tview/demos/presentation/end.go +++ b/tview/demos/presentation/end.go @@ -3,8 +3,8 @@ package main import ( "fmt" - tcell "github.com/gdamore/tcell/v2" "github.com/Bios-Marcel/cordless/tview" + tcell "github.com/gdamore/tcell/v2" ) // End shows the final slide. diff --git a/tview/demos/presentation/flex.go b/tview/demos/presentation/flex.go index 2118d616..8879c107 100644 --- a/tview/demos/presentation/flex.go +++ b/tview/demos/presentation/flex.go @@ -1,8 +1,8 @@ package main import ( - tcell "github.com/gdamore/tcell/v2" "github.com/Bios-Marcel/cordless/tview" + tcell "github.com/gdamore/tcell/v2" ) // Flex demonstrates flexbox layout. diff --git a/tview/demos/presentation/grid.go b/tview/demos/presentation/grid.go index 9c155326..4f64c58d 100644 --- a/tview/demos/presentation/grid.go +++ b/tview/demos/presentation/grid.go @@ -1,8 +1,8 @@ package main import ( - tcell "github.com/gdamore/tcell/v2" "github.com/Bios-Marcel/cordless/tview" + tcell "github.com/gdamore/tcell/v2" ) // Grid demonstrates the grid layout. diff --git a/tview/demos/presentation/helloworld.go b/tview/demos/presentation/helloworld.go index 764cada4..a661ed58 100644 --- a/tview/demos/presentation/helloworld.go +++ b/tview/demos/presentation/helloworld.go @@ -1,8 +1,8 @@ package main import ( - tcell "github.com/gdamore/tcell/v2" "github.com/Bios-Marcel/cordless/tview" + tcell "github.com/gdamore/tcell/v2" ) const helloWorld = `[green]package[white] main diff --git a/tview/demos/presentation/inputfield.go b/tview/demos/presentation/inputfield.go index ee25caa0..3adf2e16 100644 --- a/tview/demos/presentation/inputfield.go +++ b/tview/demos/presentation/inputfield.go @@ -1,8 +1,8 @@ package main import ( - tcell "github.com/gdamore/tcell/v2" "github.com/Bios-Marcel/cordless/tview" + tcell "github.com/gdamore/tcell/v2" ) const inputField = `[green]package[white] main diff --git a/tview/demos/presentation/table.go b/tview/demos/presentation/table.go index 5c0ab572..4d97248a 100644 --- a/tview/demos/presentation/table.go +++ b/tview/demos/presentation/table.go @@ -4,8 +4,8 @@ import ( "fmt" "strings" - tcell "github.com/gdamore/tcell/v2" "github.com/Bios-Marcel/cordless/tview" + tcell "github.com/gdamore/tcell/v2" ) const tableData = `OrderDate|Region|Rep|Item|Units|UnitCost|Total diff --git a/tview/demos/presentation/textview.go b/tview/demos/presentation/textview.go index 507eb2f2..0e6c6a78 100644 --- a/tview/demos/presentation/textview.go +++ b/tview/demos/presentation/textview.go @@ -5,8 +5,8 @@ import ( "strconv" "time" - tcell "github.com/gdamore/tcell/v2" "github.com/Bios-Marcel/cordless/tview" + tcell "github.com/gdamore/tcell/v2" ) const textView1 = `[green]func[white] [yellow]main[white]() { diff --git a/tview/demos/presentation/treeview.go b/tview/demos/presentation/treeview.go index 145b5904..7de10f45 100644 --- a/tview/demos/presentation/treeview.go +++ b/tview/demos/presentation/treeview.go @@ -3,8 +3,8 @@ package main import ( "strings" - tcell "github.com/gdamore/tcell/v2" "github.com/Bios-Marcel/cordless/tview" + tcell "github.com/gdamore/tcell/v2" ) const treeAllCode = `[green]package[white] main diff --git a/ui/commandview.go b/ui/commandview.go index 219737f3..aba0a378 100644 --- a/ui/commandview.go +++ b/ui/commandview.go @@ -27,7 +27,7 @@ type CommandView struct { // NewCommandView creates a new struct containing the components necessary // for a command view. It also contains the state for those components. -func NewCommandView(vimMode *int,onExecuteCommand func(command string)) *CommandView { +func NewCommandView(vimMode *int, onExecuteCommand func(command string)) *CommandView { commandOutput := tview.NewTextView() commandOutput.SetDynamicColors(true). SetWordWrap(true). diff --git a/ui/editor.go b/ui/editor.go index 288c2f39..f9750b1a 100644 --- a/ui/editor.go +++ b/ui/editor.go @@ -29,7 +29,7 @@ type Editor struct { requestedHeight int autocompleteFrom *femto.Loc - vimMode *int + vimMode *int } func (editor *Editor) applyBuffer() { @@ -396,7 +396,7 @@ func NewEditor(vimMode *int) *Editor { requestedHeight: 3, buffer: femto.NewBufferFromString("", ""), tempBuffer: femto.NewBufferFromString("", ""), - vimMode: vimMode, + vimMode: vimMode, } editor.internalTextView.SetWrap(true) diff --git a/ui/shortcutdialog/table.go b/ui/shortcutdialog/table.go index e6833ca3..f1034d10 100644 --- a/ui/shortcutdialog/table.go +++ b/ui/shortcutdialog/table.go @@ -24,12 +24,12 @@ const ( type ShortcutTable struct { table *tview.Table shortcuts []*shortcuts.Shortcut - vimBindings []*shortcuts.VimEvent + vimBindings []*shortcuts.VimEvent selection int focusNext func() focusPrevious func() - vimMode *int + vimMode *int } // NewShortcutTable creates a new shortcut table that doesn't contain any data. @@ -38,7 +38,7 @@ func NewShortcutTable(vimEnabled *int) *ShortcutTable { shortcutsTable := &ShortcutTable{ table: table, selection: -1, - vimMode: vimEnabled, + vimMode: vimEnabled, } table.SetSelectable(true, false) @@ -104,15 +104,15 @@ func (shortcutTable *ShortcutTable) SetShortcuts(shortcuts []*shortcuts.Shortcut shortcutTable.table.SetCell(row, shortcutCellIndex, eventCell) if *shortcutTable.vimMode != vim.Disabled { - normalKey := "" - insertKey := "" - visualKey := "" + var normalKey string + var insertKey string + var visualKey string // HACK // Empty tcell EventKey corresponds to Ctrl-Space if shortcut.VimModifier.NormalEvent == nil { normalKey = EventToString(shortcut.Event) - } else if shortcut.VimModifier.NormalEvent.Rune() == rune(tcell.KeyCtrlSpace){ + } else if shortcut.VimModifier.NormalEvent.Rune() == rune(tcell.KeyCtrlSpace) { normalKey = "" } else { normalKey = EventToString(shortcut.VimModifier.NormalEvent) @@ -120,7 +120,7 @@ func (shortcutTable *ShortcutTable) SetShortcuts(shortcuts []*shortcuts.Shortcut if shortcut.VimModifier.InsertEvent == nil { insertKey = EventToString(shortcut.Event) - } else if shortcut.VimModifier.InsertEvent.Rune() == rune(tcell.KeyCtrlSpace){ + } else if shortcut.VimModifier.InsertEvent.Rune() == rune(tcell.KeyCtrlSpace) { insertKey = "" } else { insertKey = EventToString(shortcut.VimModifier.InsertEvent) @@ -128,7 +128,7 @@ func (shortcutTable *ShortcutTable) SetShortcuts(shortcuts []*shortcuts.Shortcut if shortcut.VimModifier.VisualEvent == nil { visualKey = EventToString(shortcut.Event) - } else if shortcut.VimModifier.VisualEvent.Rune() == rune(tcell.KeyCtrlSpace){ + } else if shortcut.VimModifier.VisualEvent.Rune() == rune(tcell.KeyCtrlSpace) { visualKey = "" } else { visualKey = EventToString(shortcut.VimModifier.VisualEvent) diff --git a/ui/window.go b/ui/window.go index e5bd6b24..9d3d319e 100644 --- a/ui/window.go +++ b/ui/window.go @@ -43,7 +43,6 @@ import ( "github.com/Bios-Marcel/cordless/ui/shortcutdialog" "github.com/Bios-Marcel/cordless/ui/tviewutil" "github.com/Bios-Marcel/cordless/util/maths" - //"github.com/Bios-Marcel/cordless/util/vim" ) var ( @@ -124,7 +123,7 @@ func NewWindow(app *tview.Application, session *discordgo.Session, readyEvent *d }() } - window.commandView = NewCommandView(&window.app.VimMode.CurrentMode,window.ExecuteCommand) + window.commandView = NewCommandView(&window.app.VimMode.CurrentMode, window.ExecuteCommand) logging.SetAdditionalOutput(window.commandView) for _, engine := range window.extensionEngines { @@ -749,7 +748,6 @@ func NewWindow(app *tview.Application, session *discordgo.Session, readyEvent *d window.userList = NewUserTree(window.session.State) - // Disable search on type when in Vim mode. TODO add / shourtcut to search. if window.app.VimMode.CurrentMode != vim.Disabled { guildList.SetSearchOnTypeEnabled(false) channelTree.SetSearchOnTypeEnabled(false) @@ -877,9 +875,7 @@ func NewWindow(app *tview.Application, session *discordgo.Session, readyEvent *d bottomBar := components.NewBottomBar() bottomBar.AddItem(fmt.Sprintf("Logged in as: '%s'", tviewutil.Escape(session.State.User.Username))) bottomBar.AddItem(fmt.Sprintf("View / Change shortcuts: %s", shortcutdialog.EventToString(shortcutsDialogShortcut))) - // bottomBar.AddItem(fmt.Sprintf("Vim: %s", window.app.VimMode.EnabledString())) window.vimStatus = bottomBar.AddDynamicItem() - // Default content window.vimStatus.Content = fmt.Sprintf("Vim: %s", window.app.VimMode.CurrentModeString()) window.rootContainer.AddItem(bottomBar, 1, 0, false) } @@ -974,14 +970,8 @@ important changes of the last two versions officially released. - Features [::b]2020-11-16 - Features - - Added Vim mode - - Enable vim mode in your config file, setting VimMode to 0. - - Navigate menus with h j k l in normal mode, enter focus with either - - insert mode or visual mode. - - Navigate inside lists with vim keys. - - Use some of your known bindings inside chat view, or selection mode. - - More vim features will be added in next updates, and bugs will try to be - - fixed :) + - Vim mode + - Vim-like movement and bindings [::b]2020-10-24 - Features - DM people via "p" in the chatview or use the dm-open command @@ -2143,16 +2133,16 @@ func (window *Window) handleGlobalShortcuts(event *tcell.EventKey) *tcell.EventK if window.app.VimMode.CurrentMode != vim.Disabled { if shortcuts.VimInsertMode.Equals(event) { - window.app.VimMode.Insert() - window.vimStatus.Content = fmt.Sprintf("Vim: %s",window.app.VimMode.CurrentModeString()) + window.app.VimMode.SetInsert() + window.vimStatus.Content = fmt.Sprintf("Vim: %s", window.app.VimMode.CurrentModeString()) return nil } else if shortcuts.VimVisualMode.Equals(event) { - window.app.VimMode.Visual() - window.vimStatus.Content = fmt.Sprintf("Vim: %s",window.app.VimMode.CurrentModeString()) + window.app.VimMode.SetVisual() + window.vimStatus.Content = fmt.Sprintf("Vim: %s", window.app.VimMode.CurrentModeString()) return nil } else if shortcuts.VimNormalMode.Equals(event) && window.app.GetRoot() == window.rootContainer { - window.app.VimMode.Normal() - window.vimStatus.Content = fmt.Sprintf("Vim: %s",window.app.VimMode.CurrentModeString()) + window.app.VimMode.SetNormal() + window.vimStatus.Content = fmt.Sprintf("Vim: %s", window.app.VimMode.CurrentModeString()) return nil } @@ -2198,7 +2188,7 @@ func (window *Window) handleChatWindowShortcuts(event *tcell.EventKey) *tcell.Ev } else if shortcuts.FocusMessageContainer.Equals(event) { window.app.SetFocus(window.chatView.internalTextView) } else if shortcuts.EventsEqual(event, shortcutsDialogShortcut) { - shortcutdialog.ShowShortcutsDialog(window.app,func() { + shortcutdialog.ShowShortcutsDialog(window.app, func() { window.app.SetRoot(window.rootContainer, true) window.app.SetFocus(window.chatView.GetPrimitive()) }) diff --git a/util/vim/vim.go b/util/vim/vim.go index c7948954..e9c2e359 100644 --- a/util/vim/vim.go +++ b/util/vim/vim.go @@ -1,17 +1,18 @@ package vim +type VimMode int + const ( + // Disabled : Default mode. Vim disabled. + Disabled int = iota // NormalMode : every key is interpreted as focus movement, // let it be from containers or text lines. - NormalMode int = iota // 0 - // InsertMode : every key is sent to the program as normal, - // such as input boxes. - InsertMode // 1 - // TODO - VisualMode // 2 - - // Default: disabled - Disabled = -1 + NormalMode + // InsertMode : keys inside text box are all sent to the input handler. + // It also allows between-message movement inside chatview. + InsertMode + // Global movement with hjkl. Text selection in text box. + VisualMode ) // Vim stores information about vim-mode, such as @@ -42,18 +43,18 @@ func (v *Vim) SetMode(mode int) { // Quick mode switch -// Normal quickly switches to normal mode. -func (v *Vim) Normal() { +// SetNormal quickly switches to normal mode. +func (v *Vim) SetNormal() { v.CurrentMode = NormalMode } -// Insert quickly switches to insert mode. -func (v *Vim) Insert() { +// SetInsert quickly switches to insert mode. +func (v *Vim) SetInsert() { v.CurrentMode = InsertMode } -// Visual quickly switches to visual mode. -func (v *Vim) Visual() { +// SetVisual quickly switches to visual mode. +func (v *Vim) SetVisual() { v.CurrentMode = VisualMode }