Skip to content

Commit ec80915

Browse files
Merge branch 'master' into dev
2 parents 55b82d8 + 4f4a13a commit ec80915

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+352
-343
lines changed

.github/workflows/nightly.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
nightly:
88
strategy:
99
matrix:
10-
go-version: [1.19.x]
10+
go-version: [1.23.x]
1111
os: [ubuntu-latest]
1212
runs-on: ${{ matrix.os }}
1313
steps:

.github/workflows/release.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
release:
99
strategy:
1010
matrix:
11-
go-version: [1.19.x]
11+
go-version: [1.23.x]
1212
os: [ubuntu-latest]
1313
runs-on: ${{ matrix.os }}
1414
steps:

.github/workflows/test.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ jobs:
44
test:
55
strategy:
66
matrix:
7-
go-version: [1.19.x]
7+
go-version: [1.17.x, 1.23.x]
88
os: [ubuntu-latest, macos-latest, windows-latest]
99
runs-on: ${{ matrix.os }}
1010
steps:

README.md

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,6 @@ To see more screenshots of micro, showcasing some of the default color schemes,
5050

5151
You can also check out the website for Micro at https://micro-editor.github.io.
5252

53-
## Table of Contents
54-
55-
- [Features](#features)
56-
- [Installation](#installation)
57-
- [Prebuilt binaries](#pre-built-binaries)
58-
- [Package Managers](#package-managers)
59-
- [Building from source](#building-from-source)
60-
- [Fully static binary](#fully-static-binary)
61-
- [macOS terminal](#macos-terminal)
62-
- [Linux clipboard support](#linux-clipboard-support)
63-
- [Colors and syntax highlighting](#colors-and-syntax-highlighting)
64-
- [Cygwin, Mingw, Plan9](#cygwin-mingw-plan9)
65-
- [Usage](#usage)
66-
- [Documentation and Help](#documentation-and-help)
67-
- [Contributing](#contributing)
68-
6953
- - -
7054

7155
## Features
@@ -117,7 +101,7 @@ Pre-built binaries are distributed in [releases](https://github.com/zyedidia/mic
117101

118102
To uninstall micro, simply remove the binary, and the configuration directory at `~/.config/micro`.
119103

120-
#### Quick-install script
104+
#### Third-party quick-install script
121105

122106
```bash
123107
curl https://getmic.ro | bash
@@ -207,7 +191,7 @@ Without these tools installed, micro will use an internal clipboard for copy and
207191

208192
If your operating system does not have a binary release, but does run Go, you can build from source.
209193

210-
Make sure that you have Go version 1.16 or greater and Go modules are enabled.
194+
Make sure that you have Go version 1.17 or greater and Go modules are enabled.
211195

212196
```
213197
git clone https://github.com/zyedidia/micro

cmd/micro/micro_test.go

Lines changed: 26 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package main
22

33
import (
44
"fmt"
5-
"io/ioutil"
65
"log"
76
"os"
87
"testing"
@@ -26,7 +25,7 @@ func init() {
2625
func startup(args []string) (tcell.SimulationScreen, error) {
2726
var err error
2827

29-
tempDir, err = ioutil.TempDir("", "micro_test")
28+
tempDir, err = os.MkdirTemp("", "micro_test")
3029
if err != nil {
3130
return nil, err
3231
}
@@ -164,20 +163,22 @@ func findBuffer(file string) *buffer.Buffer {
164163
return buf
165164
}
166165

167-
func createTestFile(name string, content string) (string, error) {
168-
testf, err := ioutil.TempFile("", name)
166+
func createTestFile(t *testing.T, content string) string {
167+
f, err := os.CreateTemp(t.TempDir(), "")
169168
if err != nil {
170-
return "", err
169+
t.Fatal(err)
171170
}
171+
defer func() {
172+
if err := f.Close(); err != nil {
173+
t.Fatal(err)
174+
}
175+
}()
172176

173-
if _, err := testf.Write([]byte(content)); err != nil {
174-
return "", err
175-
}
176-
if err := testf.Close(); err != nil {
177-
return "", err
177+
if _, err := f.WriteString(content); err != nil {
178+
t.Fatal(err)
178179
}
179180

180-
return testf.Name(), nil
181+
return f.Name()
181182
}
182183

183184
func TestMain(m *testing.M) {
@@ -194,18 +195,12 @@ func TestMain(m *testing.M) {
194195
}
195196

196197
func TestSimpleEdit(t *testing.T) {
197-
file, err := createTestFile("micro_simple_edit_test", "base content")
198-
if err != nil {
199-
t.Error(err)
200-
return
201-
}
202-
defer os.Remove(file)
198+
file := createTestFile(t, "base content")
203199

204200
openFile(file)
205201

206202
if findBuffer(file) == nil {
207-
t.Errorf("Could not find buffer %s", file)
208-
return
203+
t.Fatalf("Could not find buffer %s", file)
209204
}
210205

211206
injectKey(tcell.KeyEnter, rune(tcell.KeyEnter), tcell.ModNone)
@@ -223,28 +218,21 @@ func TestSimpleEdit(t *testing.T) {
223218

224219
injectKey(tcell.KeyCtrlS, rune(tcell.KeyCtrlS), tcell.ModCtrl)
225220

226-
data, err := ioutil.ReadFile(file)
221+
data, err := os.ReadFile(file)
227222
if err != nil {
228-
t.Error(err)
229-
return
223+
t.Fatal(err)
230224
}
231225

232226
assert.Equal(t, "firstfoobar\nbase content\n", string(data))
233227
}
234228

235229
func TestMouse(t *testing.T) {
236-
file, err := createTestFile("micro_mouse_test", "base content")
237-
if err != nil {
238-
t.Error(err)
239-
return
240-
}
241-
defer os.Remove(file)
230+
file := createTestFile(t, "base content")
242231

243232
openFile(file)
244233

245234
if findBuffer(file) == nil {
246-
t.Errorf("Could not find buffer %s", file)
247-
return
235+
t.Fatalf("Could not find buffer %s", file)
248236
}
249237

250238
// buffer:
@@ -275,10 +263,9 @@ func TestMouse(t *testing.T) {
275263
// base content
276264
injectKey(tcell.KeyCtrlS, rune(tcell.KeyCtrlS), tcell.ModCtrl)
277265

278-
data, err := ioutil.ReadFile(file)
266+
data, err := os.ReadFile(file)
279267
if err != nil {
280-
t.Error(err)
281-
return
268+
t.Fatal(err)
282269
}
283270

284271
assert.Equal(t, "firstline\nsecondline\nbase content\n", string(data))
@@ -301,18 +288,12 @@ Ernleȝe test_string æðelen
301288
`
302289

303290
func TestSearchAndReplace(t *testing.T) {
304-
file, err := createTestFile("micro_search_replace_test", srTestStart)
305-
if err != nil {
306-
t.Error(err)
307-
return
308-
}
309-
defer os.Remove(file)
291+
file := createTestFile(t, srTestStart)
310292

311293
openFile(file)
312294

313295
if findBuffer(file) == nil {
314-
t.Errorf("Could not find buffer %s", file)
315-
return
296+
t.Fatalf("Could not find buffer %s", file)
316297
}
317298

318299
injectKey(tcell.KeyCtrlE, rune(tcell.KeyCtrlE), tcell.ModCtrl)
@@ -321,10 +302,9 @@ func TestSearchAndReplace(t *testing.T) {
321302

322303
injectKey(tcell.KeyCtrlS, rune(tcell.KeyCtrlS), tcell.ModCtrl)
323304

324-
data, err := ioutil.ReadFile(file)
305+
data, err := os.ReadFile(file)
325306
if err != nil {
326-
t.Error(err)
327-
return
307+
t.Fatal(err)
328308
}
329309

330310
assert.Equal(t, srTest2, string(data))
@@ -336,10 +316,9 @@ func TestSearchAndReplace(t *testing.T) {
336316
injectKey(tcell.KeyEscape, 0, tcell.ModNone)
337317
injectKey(tcell.KeyCtrlS, rune(tcell.KeyCtrlS), tcell.ModCtrl)
338318

339-
data, err = ioutil.ReadFile(file)
319+
data, err = os.ReadFile(file)
340320
if err != nil {
341-
t.Error(err)
342-
return
321+
t.Fatal(err)
343322
}
344323

345324
assert.Equal(t, srTest3, string(data))

go.mod

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,29 @@ require (
1414
github.com/zyedidia/clipper v0.1.1
1515
github.com/zyedidia/glob v0.0.0-20170209203856-dd4023a66dc3
1616
github.com/zyedidia/json5 v0.0.0-20200102012142-2da050b1a98d
17-
github.com/zyedidia/tcell/v2 v2.0.10 // indirect
17+
github.com/zyedidia/tcell/v2 v2.0.10
1818
github.com/zyedidia/terminal v0.0.0-20230315200948-4b3bcf6dddef
1919
golang.org/x/text v0.3.8
2020
gopkg.in/yaml.v2 v2.2.8
2121
layeh.com/gopher-luar v1.0.7
2222
)
2323

24+
require (
25+
github.com/creack/pty v1.1.18 // indirect
26+
github.com/davecgh/go-spew v1.1.1 // indirect
27+
github.com/gdamore/encoding v1.0.0 // indirect
28+
github.com/lucasb-eyer/go-colorful v1.0.3 // indirect
29+
github.com/pmezard/go-difflib v1.0.0 // indirect
30+
github.com/rivo/uniseg v0.1.0 // indirect
31+
github.com/xo/terminfo v0.0.0-20200218205459-454e5b68f9e8 // indirect
32+
github.com/zyedidia/poller v1.0.1 // indirect
33+
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f // indirect
34+
)
35+
2436
replace github.com/kballard/go-shellquote => github.com/zyedidia/go-shellquote v0.0.0-20200613203517-eccd813c0655
2537

2638
replace github.com/mattn/go-runewidth => github.com/zyedidia/go-runewidth v0.0.12
2739

2840
replace layeh.com/gopher-luar => github.com/layeh/gopher-luar v1.0.7
2941

30-
go 1.16
42+
go 1.17

go.sum

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,6 @@ github.com/zyedidia/json5 v0.0.0-20200102012142-2da050b1a98d h1:zmDMkh22zXOB7gz8
5454
github.com/zyedidia/json5 v0.0.0-20200102012142-2da050b1a98d/go.mod h1:NDJSTTYWivnza6zkRapeX2/LwhKPEMQ7bJxqgDVT78I=
5555
github.com/zyedidia/poller v1.0.1 h1:Tt9S3AxAjXwWGNiC2TUdRJkQDZSzCBNVQ4xXiQ7440s=
5656
github.com/zyedidia/poller v1.0.1/go.mod h1:vZXJOHGDcuK08GXhF6IAY0ZFd2WcgOR5DOTp84Uk5eE=
57-
github.com/zyedidia/tcell/v2 v2.0.9 h1:FxXRkE62N0GPHES7EMLtp2rteYqC9r1kVid8vJN1kOE=
58-
github.com/zyedidia/tcell/v2 v2.0.9/go.mod h1:i4NNlquIQXFeNecrOgxDQQJdu+7LmTi3g62asvmwUws=
59-
github.com/zyedidia/tcell/v2 v2.0.10-0.20221007181625-f562052bccb8 h1:53ULv4mmLyQDnqbjVxanckP57WSreWHwTmlLJrJEutY=
60-
github.com/zyedidia/tcell/v2 v2.0.10-0.20221007181625-f562052bccb8/go.mod h1:i4NNlquIQXFeNecrOgxDQQJdu+7LmTi3g62asvmwUws=
61-
github.com/zyedidia/tcell/v2 v2.0.10-0.20230320201625-54f6acdada4a h1:W4TWa++Wk6uRGxZoxr2nPX1TpIEl+Wxv0mTtocG4TYc=
62-
github.com/zyedidia/tcell/v2 v2.0.10-0.20230320201625-54f6acdada4a/go.mod h1:i4NNlquIQXFeNecrOgxDQQJdu+7LmTi3g62asvmwUws=
63-
github.com/zyedidia/tcell/v2 v2.0.10-0.20230831153116-061c5b2c7260 h1:SCAmAacT5BxZsmOFdFy5zwwi6nj1MjA60gydjKdTgXo=
64-
github.com/zyedidia/tcell/v2 v2.0.10-0.20230831153116-061c5b2c7260/go.mod h1:i4NNlquIQXFeNecrOgxDQQJdu+7LmTi3g62asvmwUws=
6557
github.com/zyedidia/tcell/v2 v2.0.10 h1:6fbbYAx/DYc9A//4jU1OeBrxtc9qJxYCZXCtGQbtTWU=
6658
github.com/zyedidia/tcell/v2 v2.0.10/go.mod h1:i4NNlquIQXFeNecrOgxDQQJdu+7LmTi3g62asvmwUws=
6759
github.com/zyedidia/terminal v0.0.0-20230315200948-4b3bcf6dddef h1:LeB4Qs0Tss4r/Qh8pfsTTqagDYHysfKJLYzAH3MVfu0=

0 commit comments

Comments
 (0)