mirror of
https://github.com/zyedidia/micro.git
synced 2024-10-06 00:22:12 +03:00
Compare commits
29 Commits
93c4aa52db
...
1fcc4b5edf
Author | SHA1 | Date | |
---|---|---|---|
|
1fcc4b5edf | ||
|
6722cc81de | ||
|
90525a6a1d | ||
|
6e46ae3090 | ||
|
4d2ddc7940 | ||
|
4f4a13a9a1 | ||
|
9eaeb193d4 | ||
|
ca6012086b | ||
|
1539da7fdc | ||
|
a3211dce57 | ||
|
5f83661fee | ||
|
2e44db1ee9 | ||
|
bf6584739f | ||
|
68d6f43c63 | ||
|
6f724bc424 | ||
|
25f71eec2d | ||
|
33a1bb120f | ||
|
04143c7a89 | ||
|
e6825f0e08 | ||
|
fdacb28962 | ||
|
9f7bdb109b | ||
|
c1bbd7b041 | ||
|
a317aefd6d | ||
|
830768b715 | ||
|
2860efbe3a | ||
|
52ed4315ff | ||
|
8bc67569f9 | ||
|
df8d5285bf | ||
|
19c69f9eaa |
2
.github/workflows/nightly.yaml
vendored
2
.github/workflows/nightly.yaml
vendored
@ -7,7 +7,7 @@ jobs:
|
|||||||
nightly:
|
nightly:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
go-version: [1.19.x]
|
go-version: [1.23.x]
|
||||||
os: [ubuntu-latest]
|
os: [ubuntu-latest]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
|
2
.github/workflows/release.yaml
vendored
2
.github/workflows/release.yaml
vendored
@ -8,7 +8,7 @@ jobs:
|
|||||||
release:
|
release:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
go-version: [1.19.x]
|
go-version: [1.23.x]
|
||||||
os: [ubuntu-latest]
|
os: [ubuntu-latest]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
|
2
.github/workflows/test.yaml
vendored
2
.github/workflows/test.yaml
vendored
@ -4,7 +4,7 @@ jobs:
|
|||||||
test:
|
test:
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
go-version: [1.19.x]
|
go-version: [1.17.x, 1.23.x]
|
||||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
|
10
Makefile
10
Makefile
@ -10,21 +10,19 @@ ADDITIONAL_GO_LINKER_FLAGS = $(shell GOOS=$(shell go env GOHOSTOS) \
|
|||||||
go run tools/info-plist.go "$(shell go env GOOS)" "$(VERSION)")
|
go run tools/info-plist.go "$(shell go env GOOS)" "$(VERSION)")
|
||||||
GOBIN ?= $(shell go env GOPATH)/bin
|
GOBIN ?= $(shell go env GOPATH)/bin
|
||||||
GOVARS = -X github.com/zyedidia/micro/v2/internal/util.Version=$(VERSION) -X github.com/zyedidia/micro/v2/internal/util.CommitHash=$(HASH) -X 'github.com/zyedidia/micro/v2/internal/util.CompileDate=$(DATE)'
|
GOVARS = -X github.com/zyedidia/micro/v2/internal/util.Version=$(VERSION) -X github.com/zyedidia/micro/v2/internal/util.CommitHash=$(HASH) -X 'github.com/zyedidia/micro/v2/internal/util.CompileDate=$(DATE)'
|
||||||
|
CGO_ENABLED := $(if $(CGO_ENABLED),$(CGO_ENABLED),0)
|
||||||
DEBUGVAR = -X github.com/zyedidia/micro/v2/internal/util.Debug=ON
|
DEBUGVAR = -X github.com/zyedidia/micro/v2/internal/util.Debug=ON
|
||||||
VSCODE_TESTS_BASE_URL = 'https://raw.githubusercontent.com/microsoft/vscode/e6a45f4242ebddb7aa9a229f85555e8a3bd987e2/src/vs/editor/test/common/model/'
|
VSCODE_TESTS_BASE_URL = 'https://raw.githubusercontent.com/microsoft/vscode/e6a45f4242ebddb7aa9a229f85555e8a3bd987e2/src/vs/editor/test/common/model/'
|
||||||
|
|
||||||
build: generate build-quick
|
build: generate build-quick
|
||||||
|
|
||||||
build-quick:
|
build-quick:
|
||||||
CGO_ENABLED=0 go build -trimpath -ldflags "-s -w $(GOVARS) $(ADDITIONAL_GO_LINKER_FLAGS)" ./cmd/micro
|
CGO_ENABLED=$(CGO_ENABLED) go build -trimpath -ldflags "-s -w $(GOVARS) $(ADDITIONAL_GO_LINKER_FLAGS)" ./cmd/micro
|
||||||
|
|
||||||
build-dynamic: generate
|
|
||||||
CGO_ENABLED=1 go build -trimpath -ldflags "-s -w $(GOVARS) $(ADDITIONAL_GO_LINKER_FLAGS)" ./cmd/micro
|
|
||||||
|
|
||||||
build-dbg:
|
build-dbg:
|
||||||
CGO_ENABLED=0 go build -trimpath -ldflags "$(ADDITIONAL_GO_LINKER_FLAGS) $(DEBUGVAR)" ./cmd/micro
|
CGO_ENABLED=$(CGO_ENABLED) go build -trimpath -ldflags "$(ADDITIONAL_GO_LINKER_FLAGS) $(DEBUGVAR)" ./cmd/micro
|
||||||
|
|
||||||
build-tags: fetch-tags generate build-quick
|
build-tags: fetch-tags build
|
||||||
|
|
||||||
build-all: build
|
build-all: build
|
||||||
|
|
||||||
|
13
README.md
13
README.md
@ -162,7 +162,7 @@ Without these tools installed, micro will use an internal clipboard for copy and
|
|||||||
|
|
||||||
If your operating system does not have a binary release, but does run Go, you can build from source.
|
If your operating system does not have a binary release, but does run Go, you can build from source.
|
||||||
|
|
||||||
Make sure that you have Go version 1.16 or greater and Go modules are enabled.
|
Make sure that you have Go version 1.17 or greater and Go modules are enabled.
|
||||||
|
|
||||||
```
|
```
|
||||||
git clone https://github.com/zyedidia/micro
|
git clone https://github.com/zyedidia/micro
|
||||||
@ -180,16 +180,17 @@ You can install directly with `go get` (`go get github.com/zyedidia/micro/cmd/mi
|
|||||||
recommended because it doesn't build micro with version information (necessary for the plugin manager),
|
recommended because it doesn't build micro with version information (necessary for the plugin manager),
|
||||||
and doesn't disable debug mode.
|
and doesn't disable debug mode.
|
||||||
|
|
||||||
### Fully static binary
|
### Fully static or dynamically linked binary
|
||||||
|
|
||||||
By default, the micro binary will dynamically link with core system libraries (this is generally
|
By default, the micro binary is linked statically to increase the portability of the prebuilt binaries.
|
||||||
recommended for security and portability). However, there is a fully static prebuilt binary that
|
This behavior can simply be overriden by providing `CGO_ENABLED=1` to the build target.
|
||||||
is provided for amd64 as `linux-static.tar.gz`, and to build a fully static binary from source, run
|
|
||||||
|
|
||||||
```
|
```
|
||||||
CGO_ENABLED=0 make build
|
CGO_ENABLED=1 make build
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Afterwards the micro binary will dynamically link with the present core system libraries.
|
||||||
|
|
||||||
### macOS terminal
|
### macOS terminal
|
||||||
|
|
||||||
If you are using macOS, you should consider using [iTerm2](http://iterm2.com/) instead of the default terminal (Terminal.app). The iTerm2 terminal has much better mouse support as well as better handling of key events. For best keybinding behavior, choose `xterm defaults` under `Preferences->Profiles->Keys->Presets...`, and select `Esc+` for `Left Option Key` in the same menu. The newest versions also support true color.
|
If you are using macOS, you should consider using [iTerm2](http://iterm2.com/) instead of the default terminal (Terminal.app). The iTerm2 terminal has much better mouse support as well as better handling of key events. For best keybinding behavior, choose `xterm defaults` under `Preferences->Profiles->Keys->Presets...`, and select `Esc+` for `Left Option Key` in the same menu. The newest versions also support true color.
|
||||||
|
@ -2,7 +2,6 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"io/ioutil"
|
|
||||||
"log"
|
"log"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
@ -26,7 +25,7 @@ func init() {
|
|||||||
func startup(args []string) (tcell.SimulationScreen, error) {
|
func startup(args []string) (tcell.SimulationScreen, error) {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
tempDir, err = ioutil.TempDir("", "micro_test")
|
tempDir, err = os.MkdirTemp("", "micro_test")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -164,20 +163,22 @@ func findBuffer(file string) *buffer.Buffer {
|
|||||||
return buf
|
return buf
|
||||||
}
|
}
|
||||||
|
|
||||||
func createTestFile(name string, content string) (string, error) {
|
func createTestFile(t *testing.T, content string) string {
|
||||||
testf, err := ioutil.TempFile("", name)
|
f, err := os.CreateTemp(t.TempDir(), "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
defer func() {
|
||||||
|
if err := f.Close(); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
|
if _, err := f.WriteString(content); err != nil {
|
||||||
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := testf.Write([]byte(content)); err != nil {
|
return f.Name()
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
if err := testf.Close(); err != nil {
|
|
||||||
return "", err
|
|
||||||
}
|
|
||||||
|
|
||||||
return testf.Name(), nil
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMain(m *testing.M) {
|
func TestMain(m *testing.M) {
|
||||||
@ -194,18 +195,12 @@ func TestMain(m *testing.M) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestSimpleEdit(t *testing.T) {
|
func TestSimpleEdit(t *testing.T) {
|
||||||
file, err := createTestFile("micro_simple_edit_test", "base content")
|
file := createTestFile(t, "base content")
|
||||||
if err != nil {
|
|
||||||
t.Error(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
defer os.Remove(file)
|
|
||||||
|
|
||||||
openFile(file)
|
openFile(file)
|
||||||
|
|
||||||
if findBuffer(file) == nil {
|
if findBuffer(file) == nil {
|
||||||
t.Errorf("Could not find buffer %s", file)
|
t.Fatalf("Could not find buffer %s", file)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
injectKey(tcell.KeyEnter, rune(tcell.KeyEnter), tcell.ModNone)
|
injectKey(tcell.KeyEnter, rune(tcell.KeyEnter), tcell.ModNone)
|
||||||
@ -223,28 +218,21 @@ func TestSimpleEdit(t *testing.T) {
|
|||||||
|
|
||||||
injectKey(tcell.KeyCtrlS, rune(tcell.KeyCtrlS), tcell.ModCtrl)
|
injectKey(tcell.KeyCtrlS, rune(tcell.KeyCtrlS), tcell.ModCtrl)
|
||||||
|
|
||||||
data, err := ioutil.ReadFile(file)
|
data, err := os.ReadFile(file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Fatal(err)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.Equal(t, "firstfoobar\nbase content\n", string(data))
|
assert.Equal(t, "firstfoobar\nbase content\n", string(data))
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestMouse(t *testing.T) {
|
func TestMouse(t *testing.T) {
|
||||||
file, err := createTestFile("micro_mouse_test", "base content")
|
file := createTestFile(t, "base content")
|
||||||
if err != nil {
|
|
||||||
t.Error(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
defer os.Remove(file)
|
|
||||||
|
|
||||||
openFile(file)
|
openFile(file)
|
||||||
|
|
||||||
if findBuffer(file) == nil {
|
if findBuffer(file) == nil {
|
||||||
t.Errorf("Could not find buffer %s", file)
|
t.Fatalf("Could not find buffer %s", file)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// buffer:
|
// buffer:
|
||||||
@ -275,10 +263,9 @@ func TestMouse(t *testing.T) {
|
|||||||
// base content
|
// base content
|
||||||
injectKey(tcell.KeyCtrlS, rune(tcell.KeyCtrlS), tcell.ModCtrl)
|
injectKey(tcell.KeyCtrlS, rune(tcell.KeyCtrlS), tcell.ModCtrl)
|
||||||
|
|
||||||
data, err := ioutil.ReadFile(file)
|
data, err := os.ReadFile(file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Fatal(err)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.Equal(t, "firstline\nsecondline\nbase content\n", string(data))
|
assert.Equal(t, "firstline\nsecondline\nbase content\n", string(data))
|
||||||
@ -301,18 +288,12 @@ Ernleȝe test_string æðelen
|
|||||||
`
|
`
|
||||||
|
|
||||||
func TestSearchAndReplace(t *testing.T) {
|
func TestSearchAndReplace(t *testing.T) {
|
||||||
file, err := createTestFile("micro_search_replace_test", srTestStart)
|
file := createTestFile(t, srTestStart)
|
||||||
if err != nil {
|
|
||||||
t.Error(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
defer os.Remove(file)
|
|
||||||
|
|
||||||
openFile(file)
|
openFile(file)
|
||||||
|
|
||||||
if findBuffer(file) == nil {
|
if findBuffer(file) == nil {
|
||||||
t.Errorf("Could not find buffer %s", file)
|
t.Fatalf("Could not find buffer %s", file)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
injectKey(tcell.KeyCtrlE, rune(tcell.KeyCtrlE), tcell.ModCtrl)
|
injectKey(tcell.KeyCtrlE, rune(tcell.KeyCtrlE), tcell.ModCtrl)
|
||||||
@ -321,10 +302,9 @@ func TestSearchAndReplace(t *testing.T) {
|
|||||||
|
|
||||||
injectKey(tcell.KeyCtrlS, rune(tcell.KeyCtrlS), tcell.ModCtrl)
|
injectKey(tcell.KeyCtrlS, rune(tcell.KeyCtrlS), tcell.ModCtrl)
|
||||||
|
|
||||||
data, err := ioutil.ReadFile(file)
|
data, err := os.ReadFile(file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Fatal(err)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.Equal(t, srTest2, string(data))
|
assert.Equal(t, srTest2, string(data))
|
||||||
@ -337,10 +317,9 @@ func TestSearchAndReplace(t *testing.T) {
|
|||||||
|
|
||||||
injectKey(tcell.KeyCtrlS, rune(tcell.KeyCtrlS), tcell.ModCtrl)
|
injectKey(tcell.KeyCtrlS, rune(tcell.KeyCtrlS), tcell.ModCtrl)
|
||||||
|
|
||||||
data, err = ioutil.ReadFile(file)
|
data, err = os.ReadFile(file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Error(err)
|
t.Fatal(err)
|
||||||
return
|
|
||||||
}
|
}
|
||||||
|
|
||||||
assert.Equal(t, srTest3, string(data))
|
assert.Equal(t, srTest3, string(data))
|
||||||
|
16
go.mod
16
go.mod
@ -14,17 +14,29 @@ require (
|
|||||||
github.com/zyedidia/clipper v0.1.1
|
github.com/zyedidia/clipper v0.1.1
|
||||||
github.com/zyedidia/glob v0.0.0-20170209203856-dd4023a66dc3
|
github.com/zyedidia/glob v0.0.0-20170209203856-dd4023a66dc3
|
||||||
github.com/zyedidia/json5 v0.0.0-20200102012142-2da050b1a98d
|
github.com/zyedidia/json5 v0.0.0-20200102012142-2da050b1a98d
|
||||||
github.com/zyedidia/tcell/v2 v2.0.10 // indirect
|
github.com/zyedidia/tcell/v2 v2.0.10
|
||||||
github.com/zyedidia/terminal v0.0.0-20230315200948-4b3bcf6dddef
|
github.com/zyedidia/terminal v0.0.0-20230315200948-4b3bcf6dddef
|
||||||
golang.org/x/text v0.3.8
|
golang.org/x/text v0.3.8
|
||||||
gopkg.in/yaml.v2 v2.2.8
|
gopkg.in/yaml.v2 v2.2.8
|
||||||
layeh.com/gopher-luar v1.0.7
|
layeh.com/gopher-luar v1.0.7
|
||||||
)
|
)
|
||||||
|
|
||||||
|
require (
|
||||||
|
github.com/creack/pty v1.1.18 // indirect
|
||||||
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
|
github.com/gdamore/encoding v1.0.0 // indirect
|
||||||
|
github.com/lucasb-eyer/go-colorful v1.0.3 // indirect
|
||||||
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
|
github.com/rivo/uniseg v0.1.0 // indirect
|
||||||
|
github.com/xo/terminfo v0.0.0-20200218205459-454e5b68f9e8 // indirect
|
||||||
|
github.com/zyedidia/poller v1.0.1 // indirect
|
||||||
|
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
|
||||||
|
)
|
||||||
|
|
||||||
replace github.com/kballard/go-shellquote => github.com/zyedidia/go-shellquote v0.0.0-20200613203517-eccd813c0655
|
replace github.com/kballard/go-shellquote => github.com/zyedidia/go-shellquote v0.0.0-20200613203517-eccd813c0655
|
||||||
|
|
||||||
replace github.com/mattn/go-runewidth => github.com/zyedidia/go-runewidth v0.0.12
|
replace github.com/mattn/go-runewidth => github.com/zyedidia/go-runewidth v0.0.12
|
||||||
|
|
||||||
replace layeh.com/gopher-luar => github.com/layeh/gopher-luar v1.0.7
|
replace layeh.com/gopher-luar => github.com/layeh/gopher-luar v1.0.7
|
||||||
|
|
||||||
go 1.16
|
go 1.17
|
||||||
|
8
go.sum
8
go.sum
@ -54,14 +54,6 @@ github.com/zyedidia/json5 v0.0.0-20200102012142-2da050b1a98d h1:zmDMkh22zXOB7gz8
|
|||||||
github.com/zyedidia/json5 v0.0.0-20200102012142-2da050b1a98d/go.mod h1:NDJSTTYWivnza6zkRapeX2/LwhKPEMQ7bJxqgDVT78I=
|
github.com/zyedidia/json5 v0.0.0-20200102012142-2da050b1a98d/go.mod h1:NDJSTTYWivnza6zkRapeX2/LwhKPEMQ7bJxqgDVT78I=
|
||||||
github.com/zyedidia/poller v1.0.1 h1:Tt9S3AxAjXwWGNiC2TUdRJkQDZSzCBNVQ4xXiQ7440s=
|
github.com/zyedidia/poller v1.0.1 h1:Tt9S3AxAjXwWGNiC2TUdRJkQDZSzCBNVQ4xXiQ7440s=
|
||||||
github.com/zyedidia/poller v1.0.1/go.mod h1:vZXJOHGDcuK08GXhF6IAY0ZFd2WcgOR5DOTp84Uk5eE=
|
github.com/zyedidia/poller v1.0.1/go.mod h1:vZXJOHGDcuK08GXhF6IAY0ZFd2WcgOR5DOTp84Uk5eE=
|
||||||
github.com/zyedidia/tcell/v2 v2.0.9 h1:FxXRkE62N0GPHES7EMLtp2rteYqC9r1kVid8vJN1kOE=
|
|
||||||
github.com/zyedidia/tcell/v2 v2.0.9/go.mod h1:i4NNlquIQXFeNecrOgxDQQJdu+7LmTi3g62asvmwUws=
|
|
||||||
github.com/zyedidia/tcell/v2 v2.0.10-0.20221007181625-f562052bccb8 h1:53ULv4mmLyQDnqbjVxanckP57WSreWHwTmlLJrJEutY=
|
|
||||||
github.com/zyedidia/tcell/v2 v2.0.10-0.20221007181625-f562052bccb8/go.mod h1:i4NNlquIQXFeNecrOgxDQQJdu+7LmTi3g62asvmwUws=
|
|
||||||
github.com/zyedidia/tcell/v2 v2.0.10-0.20230320201625-54f6acdada4a h1:W4TWa++Wk6uRGxZoxr2nPX1TpIEl+Wxv0mTtocG4TYc=
|
|
||||||
github.com/zyedidia/tcell/v2 v2.0.10-0.20230320201625-54f6acdada4a/go.mod h1:i4NNlquIQXFeNecrOgxDQQJdu+7LmTi3g62asvmwUws=
|
|
||||||
github.com/zyedidia/tcell/v2 v2.0.10-0.20230831153116-061c5b2c7260 h1:SCAmAacT5BxZsmOFdFy5zwwi6nj1MjA60gydjKdTgXo=
|
|
||||||
github.com/zyedidia/tcell/v2 v2.0.10-0.20230831153116-061c5b2c7260/go.mod h1:i4NNlquIQXFeNecrOgxDQQJdu+7LmTi3g62asvmwUws=
|
|
||||||
github.com/zyedidia/tcell/v2 v2.0.10 h1:6fbbYAx/DYc9A//4jU1OeBrxtc9qJxYCZXCtGQbtTWU=
|
github.com/zyedidia/tcell/v2 v2.0.10 h1:6fbbYAx/DYc9A//4jU1OeBrxtc9qJxYCZXCtGQbtTWU=
|
||||||
github.com/zyedidia/tcell/v2 v2.0.10/go.mod h1:i4NNlquIQXFeNecrOgxDQQJdu+7LmTi3g62asvmwUws=
|
github.com/zyedidia/tcell/v2 v2.0.10/go.mod h1:i4NNlquIQXFeNecrOgxDQQJdu+7LmTi3g62asvmwUws=
|
||||||
github.com/zyedidia/terminal v0.0.0-20230315200948-4b3bcf6dddef h1:LeB4Qs0Tss4r/Qh8pfsTTqagDYHysfKJLYzAH3MVfu0=
|
github.com/zyedidia/terminal v0.0.0-20230315200948-4b3bcf6dddef h1:LeB4Qs0Tss4r/Qh8pfsTTqagDYHysfKJLYzAH3MVfu0=
|
||||||
|
@ -1238,101 +1238,179 @@ func (h *BufPane) Redo() bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (h *BufPane) selectLines() int {
|
||||||
|
if h.Cursor.HasSelection() {
|
||||||
|
start := h.Cursor.CurSelection[0]
|
||||||
|
end := h.Cursor.CurSelection[1]
|
||||||
|
if start.GreaterThan(end) {
|
||||||
|
start, end = end, start
|
||||||
|
}
|
||||||
|
if end.X == 0 {
|
||||||
|
end = end.Move(-1, h.Buf)
|
||||||
|
}
|
||||||
|
|
||||||
|
h.Cursor.Deselect(true)
|
||||||
|
h.Cursor.SetSelectionStart(buffer.Loc{0, start.Y})
|
||||||
|
h.Cursor.SetSelectionEnd(buffer.Loc{0, end.Y + 1})
|
||||||
|
} else {
|
||||||
|
h.Cursor.SelectLine()
|
||||||
|
}
|
||||||
|
return h.Cursor.CurSelection[1].Y - h.Cursor.CurSelection[0].Y
|
||||||
|
}
|
||||||
|
|
||||||
// Copy the selection to the system clipboard
|
// Copy the selection to the system clipboard
|
||||||
func (h *BufPane) Copy() bool {
|
func (h *BufPane) Copy() bool {
|
||||||
if h.Cursor.HasSelection() {
|
|
||||||
h.Cursor.CopySelection(clipboard.ClipboardReg)
|
|
||||||
h.freshClip = true
|
|
||||||
InfoBar.Message("Copied selection")
|
|
||||||
}
|
|
||||||
h.Relocate()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
// CopyLine copies the current line to the clipboard
|
|
||||||
func (h *BufPane) CopyLine() bool {
|
|
||||||
if h.Cursor.HasSelection() {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
origLoc := h.Cursor.Loc
|
|
||||||
h.Cursor.SelectLine()
|
|
||||||
h.Cursor.CopySelection(clipboard.ClipboardReg)
|
|
||||||
h.freshClip = true
|
|
||||||
InfoBar.Message("Copied line")
|
|
||||||
|
|
||||||
h.Cursor.Deselect(true)
|
|
||||||
h.Cursor.Loc = origLoc
|
|
||||||
h.Relocate()
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
// CutLine cuts the current line to the clipboard
|
|
||||||
func (h *BufPane) CutLine() bool {
|
|
||||||
h.Cursor.SelectLine()
|
|
||||||
if !h.Cursor.HasSelection() {
|
if !h.Cursor.HasSelection() {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
if h.freshClip {
|
h.Cursor.CopySelection(clipboard.ClipboardReg)
|
||||||
if h.Cursor.HasSelection() {
|
h.freshClip = false
|
||||||
if clip, err := clipboard.Read(clipboard.ClipboardReg); err != nil {
|
InfoBar.Message("Copied selection")
|
||||||
InfoBar.Error(err)
|
h.Relocate()
|
||||||
} else {
|
return true
|
||||||
clipboard.WriteMulti(clip+string(h.Cursor.GetSelection()), clipboard.ClipboardReg, h.Cursor.Num, h.Buf.NumCursors())
|
}
|
||||||
}
|
|
||||||
}
|
// CopyLine copies the current line to the clipboard. If there is a selection,
|
||||||
} else if time.Since(h.lastCutTime)/time.Second > 10*time.Second || !h.freshClip {
|
// CopyLine copies all the lines that are (fully or partially) in the selection.
|
||||||
h.Copy()
|
func (h *BufPane) CopyLine() bool {
|
||||||
|
origLoc := h.Cursor.Loc
|
||||||
|
origLastVisualX := h.Cursor.LastVisualX
|
||||||
|
origSelection := h.Cursor.CurSelection
|
||||||
|
|
||||||
|
nlines := h.selectLines()
|
||||||
|
if nlines == 0 {
|
||||||
|
return false
|
||||||
}
|
}
|
||||||
h.freshClip = true
|
h.Cursor.CopySelection(clipboard.ClipboardReg)
|
||||||
h.lastCutTime = time.Now()
|
h.freshClip = false
|
||||||
h.Cursor.DeleteSelection()
|
if nlines > 1 {
|
||||||
h.Cursor.ResetSelection()
|
InfoBar.Message(fmt.Sprintf("Copied %d lines", nlines))
|
||||||
InfoBar.Message("Cut line")
|
} else {
|
||||||
|
InfoBar.Message("Copied line")
|
||||||
|
}
|
||||||
|
|
||||||
|
h.Cursor.Loc = origLoc
|
||||||
|
h.Cursor.LastVisualX = origLastVisualX
|
||||||
|
h.Cursor.CurSelection = origSelection
|
||||||
h.Relocate()
|
h.Relocate()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cut the selection to the system clipboard
|
// Cut the selection to the system clipboard
|
||||||
func (h *BufPane) Cut() bool {
|
func (h *BufPane) Cut() bool {
|
||||||
if h.Cursor.HasSelection() {
|
if !h.Cursor.HasSelection() {
|
||||||
h.Cursor.CopySelection(clipboard.ClipboardReg)
|
return false
|
||||||
h.Cursor.DeleteSelection()
|
|
||||||
h.Cursor.ResetSelection()
|
|
||||||
h.freshClip = true
|
|
||||||
InfoBar.Message("Cut selection")
|
|
||||||
|
|
||||||
h.Relocate()
|
|
||||||
return true
|
|
||||||
}
|
}
|
||||||
return h.CutLine()
|
h.Cursor.CopySelection(clipboard.ClipboardReg)
|
||||||
}
|
h.Cursor.DeleteSelection()
|
||||||
|
h.Cursor.ResetSelection()
|
||||||
|
h.freshClip = false
|
||||||
|
InfoBar.Message("Cut selection")
|
||||||
|
|
||||||
// DuplicateLine duplicates the current line or selection
|
|
||||||
func (h *BufPane) DuplicateLine() bool {
|
|
||||||
var infoMessage = "Duplicated line"
|
|
||||||
if h.Cursor.HasSelection() {
|
|
||||||
infoMessage = "Duplicated selection"
|
|
||||||
h.Buf.Insert(h.Cursor.CurSelection[1], string(h.Cursor.GetSelection()))
|
|
||||||
} else {
|
|
||||||
h.Cursor.End()
|
|
||||||
h.Buf.Insert(h.Cursor.Loc, "\n"+string(h.Buf.LineBytes(h.Cursor.Y)))
|
|
||||||
// h.Cursor.Right()
|
|
||||||
}
|
|
||||||
|
|
||||||
InfoBar.Message(infoMessage)
|
|
||||||
h.Relocate()
|
h.Relocate()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// DeleteLine deletes the current line
|
// CutLine cuts the current line to the clipboard. If there is a selection,
|
||||||
func (h *BufPane) DeleteLine() bool {
|
// CutLine cuts all the lines that are (fully or partially) in the selection.
|
||||||
h.Cursor.SelectLine()
|
func (h *BufPane) CutLine() bool {
|
||||||
|
nlines := h.selectLines()
|
||||||
|
if nlines == 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
totalLines := nlines
|
||||||
|
if h.freshClip {
|
||||||
|
if clip, err := clipboard.Read(clipboard.ClipboardReg); err != nil {
|
||||||
|
InfoBar.Error(err)
|
||||||
|
return false
|
||||||
|
} else {
|
||||||
|
clipboard.WriteMulti(clip+string(h.Cursor.GetSelection()), clipboard.ClipboardReg, h.Cursor.Num, h.Buf.NumCursors())
|
||||||
|
totalLines = strings.Count(clip, "\n") + nlines
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
h.Cursor.CopySelection(clipboard.ClipboardReg)
|
||||||
|
}
|
||||||
|
h.freshClip = true
|
||||||
|
h.Cursor.DeleteSelection()
|
||||||
|
h.Cursor.ResetSelection()
|
||||||
|
h.Cursor.StoreVisualX()
|
||||||
|
if totalLines > 1 {
|
||||||
|
InfoBar.Message(fmt.Sprintf("Cut %d lines", totalLines))
|
||||||
|
} else {
|
||||||
|
InfoBar.Message("Cut line")
|
||||||
|
}
|
||||||
|
h.Relocate()
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// Duplicate the selection
|
||||||
|
func (h *BufPane) Duplicate() bool {
|
||||||
if !h.Cursor.HasSelection() {
|
if !h.Cursor.HasSelection() {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
h.Buf.Insert(h.Cursor.CurSelection[1], string(h.Cursor.GetSelection()))
|
||||||
|
InfoBar.Message("Duplicated selection")
|
||||||
|
h.Relocate()
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// DuplicateLine duplicates the current line. If there is a selection, DuplicateLine
|
||||||
|
// duplicates all the lines that are (fully or partially) in the selection.
|
||||||
|
func (h *BufPane) DuplicateLine() bool {
|
||||||
|
if h.Cursor.HasSelection() {
|
||||||
|
origLoc := h.Cursor.Loc
|
||||||
|
origLastVisualX := h.Cursor.LastVisualX
|
||||||
|
origSelection := h.Cursor.CurSelection
|
||||||
|
|
||||||
|
start := h.Cursor.CurSelection[0]
|
||||||
|
end := h.Cursor.CurSelection[1]
|
||||||
|
if start.GreaterThan(end) {
|
||||||
|
start, end = end, start
|
||||||
|
}
|
||||||
|
if end.X == 0 {
|
||||||
|
end = end.Move(-1, h.Buf)
|
||||||
|
}
|
||||||
|
|
||||||
|
h.Cursor.Deselect(true)
|
||||||
|
h.Cursor.Loc = end
|
||||||
|
h.Cursor.End()
|
||||||
|
for y := start.Y; y <= end.Y; y++ {
|
||||||
|
h.Buf.Insert(h.Cursor.Loc, "\n"+string(h.Buf.LineBytes(y)))
|
||||||
|
}
|
||||||
|
|
||||||
|
h.Cursor.Loc = origLoc
|
||||||
|
h.Cursor.LastVisualX = origLastVisualX
|
||||||
|
h.Cursor.CurSelection = origSelection
|
||||||
|
|
||||||
|
if start.Y < end.Y {
|
||||||
|
InfoBar.Message(fmt.Sprintf("Duplicated %d lines", end.Y-start.Y+1))
|
||||||
|
} else {
|
||||||
|
InfoBar.Message("Duplicated line")
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
h.Cursor.End()
|
||||||
|
h.Buf.Insert(h.Cursor.Loc, "\n"+string(h.Buf.LineBytes(h.Cursor.Y)))
|
||||||
|
InfoBar.Message("Duplicated line")
|
||||||
|
}
|
||||||
|
h.Relocate()
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// DeleteLine deletes the current line. If there is a selection, DeleteLine
|
||||||
|
// deletes all the lines that are (fully or partially) in the selection.
|
||||||
|
func (h *BufPane) DeleteLine() bool {
|
||||||
|
nlines := h.selectLines()
|
||||||
|
if nlines == 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
h.Cursor.DeleteSelection()
|
h.Cursor.DeleteSelection()
|
||||||
h.Cursor.ResetSelection()
|
h.Cursor.ResetSelection()
|
||||||
InfoBar.Message("Deleted line")
|
h.Cursor.StoreVisualX()
|
||||||
|
if nlines > 1 {
|
||||||
|
InfoBar.Message(fmt.Sprintf("Deleted %d lines", nlines))
|
||||||
|
} else {
|
||||||
|
InfoBar.Message("Deleted line")
|
||||||
|
}
|
||||||
h.Relocate()
|
h.Relocate()
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
@ -1793,27 +1871,38 @@ func (h *BufPane) AddTab() bool {
|
|||||||
|
|
||||||
// PreviousTab switches to the previous tab in the tab list
|
// PreviousTab switches to the previous tab in the tab list
|
||||||
func (h *BufPane) PreviousTab() bool {
|
func (h *BufPane) PreviousTab() bool {
|
||||||
tabsLen := len(Tabs.List)
|
if Tabs.Active() == 0 {
|
||||||
if tabsLen == 1 {
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
Tabs.SetActive(Tabs.Active() - 1)
|
||||||
a := Tabs.Active() + tabsLen
|
|
||||||
Tabs.SetActive((a - 1) % tabsLen)
|
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// NextTab switches to the next tab in the tab list
|
// NextTab switches to the next tab in the tab list
|
||||||
func (h *BufPane) NextTab() bool {
|
func (h *BufPane) NextTab() bool {
|
||||||
tabsLen := len(Tabs.List)
|
if Tabs.Active() == len(Tabs.List)-1 {
|
||||||
if tabsLen == 1 {
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
Tabs.SetActive(Tabs.Active() + 1)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
a := Tabs.Active()
|
// FirstTab switches to the first tab in the tab list
|
||||||
Tabs.SetActive((a + 1) % tabsLen)
|
func (h *BufPane) FirstTab() bool {
|
||||||
|
if Tabs.Active() == 0 {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
Tabs.SetActive(0)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// LastTab switches to the last tab in the tab list
|
||||||
|
func (h *BufPane) LastTab() bool {
|
||||||
|
lastTabIndex := len(Tabs.List) - 1
|
||||||
|
if Tabs.Active() == lastTabIndex {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
Tabs.SetActive(lastTabIndex)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1848,36 +1937,38 @@ func (h *BufPane) Unsplit() bool {
|
|||||||
|
|
||||||
// NextSplit changes the view to the next split
|
// NextSplit changes the view to the next split
|
||||||
func (h *BufPane) NextSplit() bool {
|
func (h *BufPane) NextSplit() bool {
|
||||||
if len(h.tab.Panes) == 1 {
|
if h.tab.active == len(h.tab.Panes)-1 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
h.tab.SetActive(h.tab.active + 1)
|
||||||
a := h.tab.active
|
|
||||||
if a < len(h.tab.Panes)-1 {
|
|
||||||
a++
|
|
||||||
} else {
|
|
||||||
a = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
h.tab.SetActive(a)
|
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// PreviousSplit changes the view to the previous split
|
// PreviousSplit changes the view to the previous split
|
||||||
func (h *BufPane) PreviousSplit() bool {
|
func (h *BufPane) PreviousSplit() bool {
|
||||||
if len(h.tab.Panes) == 1 {
|
if h.tab.active == 0 {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
h.tab.SetActive(h.tab.active - 1)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
a := h.tab.active
|
// FirstSplit changes the view to the first split
|
||||||
if a > 0 {
|
func (h *BufPane) FirstSplit() bool {
|
||||||
a--
|
if h.tab.active == 0 {
|
||||||
} else {
|
return false
|
||||||
a = len(h.tab.Panes) - 1
|
|
||||||
}
|
}
|
||||||
h.tab.SetActive(a)
|
h.tab.SetActive(0)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
// LastSplit changes the view to the last split
|
||||||
|
func (h *BufPane) LastSplit() bool {
|
||||||
|
lastPaneIdx := len(h.tab.Panes) - 1
|
||||||
|
if h.tab.active == lastPaneIdx {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
h.tab.SetActive(lastPaneIdx)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2076,14 +2167,16 @@ func (h *BufPane) MouseMultiCursor(e *tcell.EventMouse) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
// SkipMultiCursor moves the current multiple cursor to the next available position
|
func (h *BufPane) skipMultiCursor(forward bool) bool {
|
||||||
func (h *BufPane) SkipMultiCursor() bool {
|
|
||||||
lastC := h.Buf.GetCursor(h.Buf.NumCursors() - 1)
|
lastC := h.Buf.GetCursor(h.Buf.NumCursors() - 1)
|
||||||
if !lastC.HasSelection() {
|
if !lastC.HasSelection() {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
sel := lastC.GetSelection()
|
sel := lastC.GetSelection()
|
||||||
searchStart := lastC.CurSelection[1]
|
searchStart := lastC.CurSelection[1]
|
||||||
|
if !forward {
|
||||||
|
searchStart = lastC.CurSelection[0]
|
||||||
|
}
|
||||||
|
|
||||||
search := string(sel)
|
search := string(sel)
|
||||||
search = regexp.QuoteMeta(search)
|
search = regexp.QuoteMeta(search)
|
||||||
@ -2091,7 +2184,7 @@ func (h *BufPane) SkipMultiCursor() bool {
|
|||||||
search = "\\b" + search + "\\b"
|
search = "\\b" + search + "\\b"
|
||||||
}
|
}
|
||||||
|
|
||||||
match, found, err := h.Buf.FindNext(search, h.Buf.Start(), h.Buf.End(), searchStart, true, true)
|
match, found, err := h.Buf.FindNext(search, h.Buf.Start(), h.Buf.End(), searchStart, forward, true)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
InfoBar.Error(err)
|
InfoBar.Error(err)
|
||||||
}
|
}
|
||||||
@ -2111,6 +2204,16 @@ func (h *BufPane) SkipMultiCursor() bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// SkipMultiCursor moves the current multiple cursor to the next available position
|
||||||
|
func (h *BufPane) SkipMultiCursor() bool {
|
||||||
|
return h.skipMultiCursor(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
// SkipMultiCursorBack moves the current multiple cursor to the previous available position
|
||||||
|
func (h *BufPane) SkipMultiCursorBack() bool {
|
||||||
|
return h.skipMultiCursor(false)
|
||||||
|
}
|
||||||
|
|
||||||
// RemoveMultiCursor removes the latest multiple cursor
|
// RemoveMultiCursor removes the latest multiple cursor
|
||||||
func (h *BufPane) RemoveMultiCursor() bool {
|
func (h *BufPane) RemoveMultiCursor() bool {
|
||||||
if h.Buf.NumCursors() > 1 {
|
if h.Buf.NumCursors() > 1 {
|
||||||
|
@ -233,11 +233,8 @@ type BufPane struct {
|
|||||||
lastClickTime time.Time
|
lastClickTime time.Time
|
||||||
lastLoc buffer.Loc
|
lastLoc buffer.Loc
|
||||||
|
|
||||||
// lastCutTime stores when the last ctrl+k was issued.
|
// freshClip returns true if one or more lines have been cut to the clipboard
|
||||||
// It is used for clearing the clipboard to replace it with fresh cut lines.
|
// and have never been pasted yet.
|
||||||
lastCutTime time.Time
|
|
||||||
|
|
||||||
// freshClip returns true if the clipboard has never been pasted.
|
|
||||||
freshClip bool
|
freshClip bool
|
||||||
|
|
||||||
// Was the last mouse event actually a double click?
|
// Was the last mouse event actually a double click?
|
||||||
@ -663,9 +660,13 @@ func (h *BufPane) DoRuneInsert(r rune) {
|
|||||||
func (h *BufPane) VSplitIndex(buf *buffer.Buffer, right bool) *BufPane {
|
func (h *BufPane) VSplitIndex(buf *buffer.Buffer, right bool) *BufPane {
|
||||||
e := NewBufPaneFromBuf(buf, h.tab)
|
e := NewBufPaneFromBuf(buf, h.tab)
|
||||||
e.splitID = MainTab().GetNode(h.splitID).VSplit(right)
|
e.splitID = MainTab().GetNode(h.splitID).VSplit(right)
|
||||||
MainTab().Panes = append(MainTab().Panes, e)
|
currentPaneIdx := MainTab().GetPane(h.splitID)
|
||||||
|
if right {
|
||||||
|
currentPaneIdx++
|
||||||
|
}
|
||||||
|
MainTab().AddPane(e, currentPaneIdx)
|
||||||
MainTab().Resize()
|
MainTab().Resize()
|
||||||
MainTab().SetActive(len(MainTab().Panes) - 1)
|
MainTab().SetActive(currentPaneIdx)
|
||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -673,9 +674,13 @@ func (h *BufPane) VSplitIndex(buf *buffer.Buffer, right bool) *BufPane {
|
|||||||
func (h *BufPane) HSplitIndex(buf *buffer.Buffer, bottom bool) *BufPane {
|
func (h *BufPane) HSplitIndex(buf *buffer.Buffer, bottom bool) *BufPane {
|
||||||
e := NewBufPaneFromBuf(buf, h.tab)
|
e := NewBufPaneFromBuf(buf, h.tab)
|
||||||
e.splitID = MainTab().GetNode(h.splitID).HSplit(bottom)
|
e.splitID = MainTab().GetNode(h.splitID).HSplit(bottom)
|
||||||
MainTab().Panes = append(MainTab().Panes, e)
|
currentPaneIdx := MainTab().GetPane(h.splitID)
|
||||||
|
if bottom {
|
||||||
|
currentPaneIdx++
|
||||||
|
}
|
||||||
|
MainTab().AddPane(e, currentPaneIdx)
|
||||||
MainTab().Resize()
|
MainTab().Resize()
|
||||||
MainTab().SetActive(len(MainTab().Panes) - 1)
|
MainTab().SetActive(currentPaneIdx)
|
||||||
return e
|
return e
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -780,6 +785,7 @@ var BufKeyActions = map[string]BufKeyAction{
|
|||||||
"CopyLine": (*BufPane).CopyLine,
|
"CopyLine": (*BufPane).CopyLine,
|
||||||
"Cut": (*BufPane).Cut,
|
"Cut": (*BufPane).Cut,
|
||||||
"CutLine": (*BufPane).CutLine,
|
"CutLine": (*BufPane).CutLine,
|
||||||
|
"Duplicate": (*BufPane).Duplicate,
|
||||||
"DuplicateLine": (*BufPane).DuplicateLine,
|
"DuplicateLine": (*BufPane).DuplicateLine,
|
||||||
"DeleteLine": (*BufPane).DeleteLine,
|
"DeleteLine": (*BufPane).DeleteLine,
|
||||||
"MoveLinesUp": (*BufPane).MoveLinesUp,
|
"MoveLinesUp": (*BufPane).MoveLinesUp,
|
||||||
@ -824,8 +830,12 @@ var BufKeyActions = map[string]BufKeyAction{
|
|||||||
"AddTab": (*BufPane).AddTab,
|
"AddTab": (*BufPane).AddTab,
|
||||||
"PreviousTab": (*BufPane).PreviousTab,
|
"PreviousTab": (*BufPane).PreviousTab,
|
||||||
"NextTab": (*BufPane).NextTab,
|
"NextTab": (*BufPane).NextTab,
|
||||||
|
"FirstTab": (*BufPane).FirstTab,
|
||||||
|
"LastTab": (*BufPane).LastTab,
|
||||||
"NextSplit": (*BufPane).NextSplit,
|
"NextSplit": (*BufPane).NextSplit,
|
||||||
"PreviousSplit": (*BufPane).PreviousSplit,
|
"PreviousSplit": (*BufPane).PreviousSplit,
|
||||||
|
"FirstSplit": (*BufPane).FirstSplit,
|
||||||
|
"LastSplit": (*BufPane).LastSplit,
|
||||||
"Unsplit": (*BufPane).Unsplit,
|
"Unsplit": (*BufPane).Unsplit,
|
||||||
"VSplit": (*BufPane).VSplitAction,
|
"VSplit": (*BufPane).VSplitAction,
|
||||||
"HSplit": (*BufPane).HSplitAction,
|
"HSplit": (*BufPane).HSplitAction,
|
||||||
@ -841,6 +851,7 @@ var BufKeyActions = map[string]BufKeyAction{
|
|||||||
"RemoveMultiCursor": (*BufPane).RemoveMultiCursor,
|
"RemoveMultiCursor": (*BufPane).RemoveMultiCursor,
|
||||||
"RemoveAllMultiCursors": (*BufPane).RemoveAllMultiCursors,
|
"RemoveAllMultiCursors": (*BufPane).RemoveAllMultiCursors,
|
||||||
"SkipMultiCursor": (*BufPane).SkipMultiCursor,
|
"SkipMultiCursor": (*BufPane).SkipMultiCursor,
|
||||||
|
"SkipMultiCursorBack": (*BufPane).SkipMultiCursorBack,
|
||||||
"JumpToMatchingBrace": (*BufPane).JumpToMatchingBrace,
|
"JumpToMatchingBrace": (*BufPane).JumpToMatchingBrace,
|
||||||
"JumpLine": (*BufPane).JumpLine,
|
"JumpLine": (*BufPane).JumpLine,
|
||||||
"Deselect": (*BufPane).Deselect,
|
"Deselect": (*BufPane).Deselect,
|
||||||
@ -907,6 +918,7 @@ var MultiActions = map[string]bool{
|
|||||||
"Copy": true,
|
"Copy": true,
|
||||||
"Cut": true,
|
"Cut": true,
|
||||||
"CutLine": true,
|
"CutLine": true,
|
||||||
|
"Duplicate": true,
|
||||||
"DuplicateLine": true,
|
"DuplicateLine": true,
|
||||||
"DeleteLine": true,
|
"DeleteLine": true,
|
||||||
"MoveLinesUp": true,
|
"MoveLinesUp": true,
|
||||||
|
@ -3,7 +3,7 @@ package action
|
|||||||
var termdefaults = map[string]string{
|
var termdefaults = map[string]string{
|
||||||
"<Ctrl-q><Ctrl-q>": "Exit",
|
"<Ctrl-q><Ctrl-q>": "Exit",
|
||||||
"<Ctrl-e><Ctrl-e>": "CommandMode",
|
"<Ctrl-e><Ctrl-e>": "CommandMode",
|
||||||
"<Ctrl-w><Ctrl-w>": "NextSplit",
|
"<Ctrl-w><Ctrl-w>": "NextSplit|FirstSplit",
|
||||||
}
|
}
|
||||||
|
|
||||||
// DefaultBindings returns a map containing micro's default keybindings
|
// DefaultBindings returns a map containing micro's default keybindings
|
||||||
|
@ -45,23 +45,23 @@ var bufdefaults = map[string]string{
|
|||||||
"Alt-]": "DiffNext|CursorEnd",
|
"Alt-]": "DiffNext|CursorEnd",
|
||||||
"Ctrl-z": "Undo",
|
"Ctrl-z": "Undo",
|
||||||
"Ctrl-y": "Redo",
|
"Ctrl-y": "Redo",
|
||||||
"Ctrl-c": "CopyLine|Copy",
|
"Ctrl-c": "Copy|CopyLine",
|
||||||
"Ctrl-x": "Cut",
|
"Ctrl-x": "Cut|CutLine",
|
||||||
"Ctrl-k": "CutLine",
|
"Ctrl-k": "CutLine",
|
||||||
"Ctrl-d": "DuplicateLine",
|
"Ctrl-d": "Duplicate|DuplicateLine",
|
||||||
"Ctrl-v": "Paste",
|
"Ctrl-v": "Paste",
|
||||||
"Ctrl-a": "SelectAll",
|
"Ctrl-a": "SelectAll",
|
||||||
"Ctrl-t": "AddTab",
|
"Ctrl-t": "AddTab",
|
||||||
"Alt-,": "PreviousTab",
|
"Alt-,": "PreviousTab|LastTab",
|
||||||
"Alt-.": "NextTab",
|
"Alt-.": "NextTab|FirstTab",
|
||||||
"Home": "StartOfTextToggle",
|
"Home": "StartOfTextToggle",
|
||||||
"End": "EndOfLine",
|
"End": "EndOfLine",
|
||||||
"CtrlHome": "CursorStart",
|
"CtrlHome": "CursorStart",
|
||||||
"CtrlEnd": "CursorEnd",
|
"CtrlEnd": "CursorEnd",
|
||||||
"PageUp": "CursorPageUp",
|
"PageUp": "CursorPageUp",
|
||||||
"PageDown": "CursorPageDown",
|
"PageDown": "CursorPageDown",
|
||||||
"CtrlPageUp": "PreviousTab",
|
"CtrlPageUp": "PreviousTab|LastTab",
|
||||||
"CtrlPageDown": "NextTab",
|
"CtrlPageDown": "NextTab|FirstTab",
|
||||||
"ShiftPageUp": "SelectPageUp",
|
"ShiftPageUp": "SelectPageUp",
|
||||||
"ShiftPageDown": "SelectPageDown",
|
"ShiftPageDown": "SelectPageDown",
|
||||||
"Ctrl-g": "ToggleHelp",
|
"Ctrl-g": "ToggleHelp",
|
||||||
@ -72,7 +72,7 @@ var bufdefaults = map[string]string{
|
|||||||
"Ctrl-b": "ShellMode",
|
"Ctrl-b": "ShellMode",
|
||||||
"Ctrl-q": "Quit",
|
"Ctrl-q": "Quit",
|
||||||
"Ctrl-e": "CommandMode",
|
"Ctrl-e": "CommandMode",
|
||||||
"Ctrl-w": "NextSplit",
|
"Ctrl-w": "NextSplit|FirstSplit",
|
||||||
"Ctrl-u": "ToggleMacro",
|
"Ctrl-u": "ToggleMacro",
|
||||||
"Ctrl-j": "PlayMacro",
|
"Ctrl-j": "PlayMacro",
|
||||||
"Insert": "ToggleOverwriteMode",
|
"Insert": "ToggleOverwriteMode",
|
||||||
@ -146,8 +146,8 @@ var infodefaults = map[string]string{
|
|||||||
"Backtab": "CycleAutocompleteBack",
|
"Backtab": "CycleAutocompleteBack",
|
||||||
"Ctrl-z": "Undo",
|
"Ctrl-z": "Undo",
|
||||||
"Ctrl-y": "Redo",
|
"Ctrl-y": "Redo",
|
||||||
"Ctrl-c": "CopyLine|Copy",
|
"Ctrl-c": "Copy|CopyLine",
|
||||||
"Ctrl-x": "Cut",
|
"Ctrl-x": "Cut|CutLine",
|
||||||
"Ctrl-k": "CutLine",
|
"Ctrl-k": "CutLine",
|
||||||
"Ctrl-v": "Paste",
|
"Ctrl-v": "Paste",
|
||||||
"Home": "StartOfTextToggle",
|
"Home": "StartOfTextToggle",
|
||||||
|
@ -48,23 +48,23 @@ var bufdefaults = map[string]string{
|
|||||||
"Alt-]": "DiffNext|CursorEnd",
|
"Alt-]": "DiffNext|CursorEnd",
|
||||||
"Ctrl-z": "Undo",
|
"Ctrl-z": "Undo",
|
||||||
"Ctrl-y": "Redo",
|
"Ctrl-y": "Redo",
|
||||||
"Ctrl-c": "CopyLine|Copy",
|
"Ctrl-c": "Copy|CopyLine",
|
||||||
"Ctrl-x": "Cut",
|
"Ctrl-x": "Cut|CutLine",
|
||||||
"Ctrl-k": "CutLine",
|
"Ctrl-k": "CutLine",
|
||||||
"Ctrl-d": "DuplicateLine",
|
"Ctrl-d": "Duplicate|DuplicateLine",
|
||||||
"Ctrl-v": "Paste",
|
"Ctrl-v": "Paste",
|
||||||
"Ctrl-a": "SelectAll",
|
"Ctrl-a": "SelectAll",
|
||||||
"Ctrl-t": "AddTab",
|
"Ctrl-t": "AddTab",
|
||||||
"Alt-,": "PreviousTab",
|
"Alt-,": "PreviousTab|LastTab",
|
||||||
"Alt-.": "NextTab",
|
"Alt-.": "NextTab|FirstTab",
|
||||||
"Home": "StartOfTextToggle",
|
"Home": "StartOfTextToggle",
|
||||||
"End": "EndOfLine",
|
"End": "EndOfLine",
|
||||||
"CtrlHome": "CursorStart",
|
"CtrlHome": "CursorStart",
|
||||||
"CtrlEnd": "CursorEnd",
|
"CtrlEnd": "CursorEnd",
|
||||||
"PageUp": "CursorPageUp",
|
"PageUp": "CursorPageUp",
|
||||||
"PageDown": "CursorPageDown",
|
"PageDown": "CursorPageDown",
|
||||||
"CtrlPageUp": "PreviousTab",
|
"CtrlPageUp": "PreviousTab|LastTab",
|
||||||
"CtrlPageDown": "NextTab",
|
"CtrlPageDown": "NextTab|FirstTab",
|
||||||
"ShiftPageUp": "SelectPageUp",
|
"ShiftPageUp": "SelectPageUp",
|
||||||
"ShiftPageDown": "SelectPageDown",
|
"ShiftPageDown": "SelectPageDown",
|
||||||
"Ctrl-g": "ToggleHelp",
|
"Ctrl-g": "ToggleHelp",
|
||||||
@ -75,7 +75,7 @@ var bufdefaults = map[string]string{
|
|||||||
"Ctrl-b": "ShellMode",
|
"Ctrl-b": "ShellMode",
|
||||||
"Ctrl-q": "Quit",
|
"Ctrl-q": "Quit",
|
||||||
"Ctrl-e": "CommandMode",
|
"Ctrl-e": "CommandMode",
|
||||||
"Ctrl-w": "NextSplit",
|
"Ctrl-w": "NextSplit|FirstSplit",
|
||||||
"Ctrl-u": "ToggleMacro",
|
"Ctrl-u": "ToggleMacro",
|
||||||
"Ctrl-j": "PlayMacro",
|
"Ctrl-j": "PlayMacro",
|
||||||
"Insert": "ToggleOverwriteMode",
|
"Insert": "ToggleOverwriteMode",
|
||||||
@ -149,8 +149,8 @@ var infodefaults = map[string]string{
|
|||||||
"Backtab": "CycleAutocompleteBack",
|
"Backtab": "CycleAutocompleteBack",
|
||||||
"Ctrl-z": "Undo",
|
"Ctrl-z": "Undo",
|
||||||
"Ctrl-y": "Redo",
|
"Ctrl-y": "Redo",
|
||||||
"Ctrl-c": "CopyLine|Copy",
|
"Ctrl-c": "Copy|CopyLine",
|
||||||
"Ctrl-x": "Cut",
|
"Ctrl-x": "Cut|CutLine",
|
||||||
"Ctrl-k": "CutLine",
|
"Ctrl-k": "CutLine",
|
||||||
"Ctrl-v": "Paste",
|
"Ctrl-v": "Paste",
|
||||||
"Home": "StartOfTextToggle",
|
"Home": "StartOfTextToggle",
|
||||||
|
@ -349,6 +349,16 @@ func (t *Tab) SetActive(i int) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AddPane adds a pane at a given index
|
||||||
|
func (t *Tab) AddPane(pane Pane, i int) {
|
||||||
|
if len(t.Panes) == i {
|
||||||
|
t.Panes = append(t.Panes, pane)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
t.Panes = append(t.Panes[:i+1], t.Panes[i:]...)
|
||||||
|
t.Panes[i] = pane
|
||||||
|
}
|
||||||
|
|
||||||
// GetPane returns the pane with the given split index
|
// GetPane returns the pane with the given split index
|
||||||
func (t *Tab) GetPane(splitid uint64) int {
|
func (t *Tab) GetPane(splitid uint64) int {
|
||||||
for i, p := range t.Panes {
|
for i, p := range t.Panes {
|
||||||
|
@ -253,11 +253,15 @@ QuitAll
|
|||||||
AddTab
|
AddTab
|
||||||
PreviousTab
|
PreviousTab
|
||||||
NextTab
|
NextTab
|
||||||
|
FirstTab
|
||||||
|
LastTab
|
||||||
NextSplit
|
NextSplit
|
||||||
Unsplit
|
Unsplit
|
||||||
VSplit
|
VSplit
|
||||||
HSplit
|
HSplit
|
||||||
PreviousSplit
|
PreviousSplit
|
||||||
|
FirstSplit
|
||||||
|
LastSplit
|
||||||
ToggleMacro
|
ToggleMacro
|
||||||
PlayMacro
|
PlayMacro
|
||||||
Suspend (Unix only)
|
Suspend (Unix only)
|
||||||
@ -270,6 +274,7 @@ SpawnMultiCursorSelect
|
|||||||
RemoveMultiCursor
|
RemoveMultiCursor
|
||||||
RemoveAllMultiCursors
|
RemoveAllMultiCursors
|
||||||
SkipMultiCursor
|
SkipMultiCursor
|
||||||
|
SkipMultiCursorBack
|
||||||
None
|
None
|
||||||
JumpToMatchingBrace
|
JumpToMatchingBrace
|
||||||
Autocomplete
|
Autocomplete
|
||||||
@ -278,6 +283,14 @@ Autocomplete
|
|||||||
The `StartOfTextToggle` and `SelectToStartOfTextToggle` actions toggle between
|
The `StartOfTextToggle` and `SelectToStartOfTextToggle` actions toggle between
|
||||||
jumping to the start of the text (first) and start of the line.
|
jumping to the start of the text (first) and start of the line.
|
||||||
|
|
||||||
|
The `CutLine` action cuts the current line and adds it to the previously cut
|
||||||
|
lines in the clipboard since the last paste (rather than just replaces the
|
||||||
|
clipboard contents with this line). So you can cut multiple, not necessarily
|
||||||
|
consecutive lines to the clipboard just by pressing `Ctrl-k` multiple times,
|
||||||
|
without selecting them. If you want the more traditional behavior i.e. just
|
||||||
|
rewrite the clipboard every time, you can use `CopyLine,DeleteLine` action
|
||||||
|
instead of `CutLine`.
|
||||||
|
|
||||||
You can also bind some mouse actions (these must be bound to mouse buttons)
|
You can also bind some mouse actions (these must be bound to mouse buttons)
|
||||||
|
|
||||||
```
|
```
|
||||||
@ -495,23 +508,23 @@ conventions for text editing defaults.
|
|||||||
"Alt-]": "DiffNext|CursorEnd",
|
"Alt-]": "DiffNext|CursorEnd",
|
||||||
"Ctrl-z": "Undo",
|
"Ctrl-z": "Undo",
|
||||||
"Ctrl-y": "Redo",
|
"Ctrl-y": "Redo",
|
||||||
"Ctrl-c": "CopyLine|Copy",
|
"Ctrl-c": "Copy|CopyLine",
|
||||||
"Ctrl-x": "Cut",
|
"Ctrl-x": "Cut|CutLine",
|
||||||
"Ctrl-k": "CutLine",
|
"Ctrl-k": "CutLine",
|
||||||
"Ctrl-d": "DuplicateLine",
|
"Ctrl-d": "Duplicate|DuplicateLine",
|
||||||
"Ctrl-v": "Paste",
|
"Ctrl-v": "Paste",
|
||||||
"Ctrl-a": "SelectAll",
|
"Ctrl-a": "SelectAll",
|
||||||
"Ctrl-t": "AddTab",
|
"Ctrl-t": "AddTab",
|
||||||
"Alt-,": "PreviousTab",
|
"Alt-,": "PreviousTab|LastTab",
|
||||||
"Alt-.": "NextTab",
|
"Alt-.": "NextTab|FirstTab",
|
||||||
"Home": "StartOfText",
|
"Home": "StartOfText",
|
||||||
"End": "EndOfLine",
|
"End": "EndOfLine",
|
||||||
"CtrlHome": "CursorStart",
|
"CtrlHome": "CursorStart",
|
||||||
"CtrlEnd": "CursorEnd",
|
"CtrlEnd": "CursorEnd",
|
||||||
"PageUp": "CursorPageUp",
|
"PageUp": "CursorPageUp",
|
||||||
"PageDown": "CursorPageDown",
|
"PageDown": "CursorPageDown",
|
||||||
"CtrlPageUp": "PreviousTab",
|
"CtrlPageUp": "PreviousTab|LastTab",
|
||||||
"CtrlPageDown": "NextTab",
|
"CtrlPageDown": "NextTab|FirstTab",
|
||||||
"ShiftPageUp": "SelectPageUp",
|
"ShiftPageUp": "SelectPageUp",
|
||||||
"ShiftPageDown": "SelectPageDown",
|
"ShiftPageDown": "SelectPageDown",
|
||||||
"Ctrl-g": "ToggleHelp",
|
"Ctrl-g": "ToggleHelp",
|
||||||
@ -522,7 +535,7 @@ conventions for text editing defaults.
|
|||||||
"Ctrl-b": "ShellMode",
|
"Ctrl-b": "ShellMode",
|
||||||
"Ctrl-q": "Quit",
|
"Ctrl-q": "Quit",
|
||||||
"Ctrl-e": "CommandMode",
|
"Ctrl-e": "CommandMode",
|
||||||
"Ctrl-w": "NextSplit",
|
"Ctrl-w": "NextSplit|FirstSplit",
|
||||||
"Ctrl-u": "ToggleMacro",
|
"Ctrl-u": "ToggleMacro",
|
||||||
"Ctrl-j": "PlayMacro",
|
"Ctrl-j": "PlayMacro",
|
||||||
"Insert": "ToggleOverwriteMode",
|
"Insert": "ToggleOverwriteMode",
|
||||||
@ -621,8 +634,8 @@ are given below:
|
|||||||
"Backtab": "CycleAutocompleteBack",
|
"Backtab": "CycleAutocompleteBack",
|
||||||
"Ctrl-z": "Undo",
|
"Ctrl-z": "Undo",
|
||||||
"Ctrl-y": "Redo",
|
"Ctrl-y": "Redo",
|
||||||
"Ctrl-c": "CopyLine|Copy",
|
"Ctrl-c": "Copy|CopyLine",
|
||||||
"Ctrl-x": "Cut",
|
"Ctrl-x": "Cut|CutLine",
|
||||||
"Ctrl-k": "CutLine",
|
"Ctrl-k": "CutLine",
|
||||||
"Ctrl-v": "Paste",
|
"Ctrl-v": "Paste",
|
||||||
"Home": "StartOfTextToggle",
|
"Home": "StartOfTextToggle",
|
||||||
|
@ -54,6 +54,14 @@ if ./tools/package-deb.sh $VERSION; then
|
|||||||
fi
|
fi
|
||||||
create_artefact_generic "linux64"
|
create_artefact_generic "linux64"
|
||||||
|
|
||||||
|
echo "Linux 64 fully static (same as linux64)"
|
||||||
|
# It is kept for the next release only to support...
|
||||||
|
# https://github.com/benweissmann/getmic.ro/blob/f90870e948afab8be9ec40884050044b59ed5b7c/index.sh#L197-L204
|
||||||
|
# ...and allow a fluent switch via:
|
||||||
|
# https://github.com/benweissmann/getmic.ro/pull/40
|
||||||
|
GOOS=linux GOARCH=amd64 make build
|
||||||
|
create_artefact_generic "linux64-static"
|
||||||
|
|
||||||
echo "Linux 32"
|
echo "Linux 32"
|
||||||
GOOS=linux GOARCH=386 make build
|
GOOS=linux GOARCH=386 make build
|
||||||
create_artefact_generic "linux32"
|
create_artefact_generic "linux32"
|
||||||
|
Loading…
Reference in New Issue
Block a user