mirror of
https://github.com/zyedidia/micro.git
synced 2024-08-18 00:10:32 +03:00
Compare commits
14 Commits
572fe928ec
...
0b473cdf10
Author | SHA1 | Date | |
---|---|---|---|
|
0b473cdf10 | ||
|
dc7759204b | ||
|
a84aa225ab | ||
|
882b98f3f1 | ||
|
0fa4a3a8db | ||
|
531c7d88e2 | ||
|
c58ed0e51a | ||
|
f475220e67 | ||
|
57375e0732 | ||
|
d98fafd2f9 | ||
|
f5a9744bde | ||
|
f05d3582b3 | ||
|
26ae1b95cc | ||
|
9e808832f1 |
4
.github/workflows/nightly.yaml
vendored
4
.github/workflows/nightly.yaml
vendored
@ -1,5 +1,6 @@
|
||||
name: Nightly builds
|
||||
on:
|
||||
workflow_dispatch: # Allows manual trigger
|
||||
schedule:
|
||||
- cron: '0 0 * * *'
|
||||
jobs:
|
||||
@ -14,11 +15,14 @@ jobs:
|
||||
uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
cache: false
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
with:
|
||||
ref: master
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
|
||||
- name: Build
|
||||
run: tools/cross-compile.sh
|
||||
|
9
.github/workflows/test.yaml
vendored
9
.github/workflows/test.yaml
vendored
@ -8,10 +8,15 @@ jobs:
|
||||
os: [ubuntu-latest, macos-latest, windows-latest]
|
||||
runs-on: ${{ matrix.os }}
|
||||
steps:
|
||||
- uses: actions/setup-go@v3
|
||||
- uses: actions/setup-go@v5
|
||||
with:
|
||||
go-version: ${{ matrix.go-version }}
|
||||
- uses: actions/checkout@v3
|
||||
cache: false
|
||||
|
||||
- uses: actions/checkout@v4
|
||||
with:
|
||||
fetch-depth: 0
|
||||
fetch-tags: true
|
||||
|
||||
- name: Build
|
||||
run: |
|
||||
|
@ -156,7 +156,7 @@ for other operating systems. These packages are not guaranteed to be up-to-date.
|
||||
* `choco install micro`.
|
||||
* `scoop install micro`.
|
||||
* OpenBSD: Available in the ports tree and also available as a binary package.
|
||||
* `pkd_add -v micro`.
|
||||
* `pkg_add -v micro`.
|
||||
* NetBSD, macOS, Linux, Illumos, etc. with [pkgsrc](http://www.pkgsrc.org/)-current:
|
||||
* `pkg_add micro`
|
||||
* macOS: Available in package managers.
|
||||
|
@ -40,7 +40,6 @@ var (
|
||||
flagClean = flag.Bool("clean", false, "Clean configuration directory")
|
||||
optionFlags map[string]*string
|
||||
|
||||
sigterm chan os.Signal
|
||||
sighup chan os.Signal
|
||||
|
||||
timerChan chan func()
|
||||
@ -360,9 +359,9 @@ func main() {
|
||||
|
||||
screen.Events = make(chan tcell.Event)
|
||||
|
||||
sigterm = make(chan os.Signal, 1)
|
||||
util.Sigterm = make(chan os.Signal, 1)
|
||||
sighup = make(chan os.Signal, 1)
|
||||
signal.Notify(sigterm, syscall.SIGTERM, syscall.SIGINT, syscall.SIGQUIT, syscall.SIGABRT)
|
||||
signal.Notify(util.Sigterm, syscall.SIGTERM, syscall.SIGINT, syscall.SIGQUIT, syscall.SIGABRT)
|
||||
signal.Notify(sighup, syscall.SIGHUP)
|
||||
|
||||
timerChan = make(chan func())
|
||||
@ -437,7 +436,7 @@ func DoEvent() {
|
||||
}
|
||||
}
|
||||
os.Exit(0)
|
||||
case <-sigterm:
|
||||
case <-util.Sigterm:
|
||||
for _, b := range buffer.OpenBuffers {
|
||||
if !b.Modified() {
|
||||
b.Fini()
|
||||
|
@ -209,16 +209,28 @@ func (t *TermPane) CommandMode() {
|
||||
})
|
||||
}
|
||||
|
||||
// NextSplit moves to the next split
|
||||
// NextSplit changes the view to the next split
|
||||
func (t *TermPane) NextSplit() {
|
||||
a := t.tab.active
|
||||
if a < len(t.tab.Panes)-1 {
|
||||
a++
|
||||
} else {
|
||||
a = 0
|
||||
}
|
||||
a := Tabs.List[Tabs.Active()]
|
||||
a.SetActive((a.active + 1) % len(a.Panes))
|
||||
}
|
||||
|
||||
t.tab.SetActive(a)
|
||||
// PreviousSplit changes the view to the previous split
|
||||
func (t *TermPane) PreviousSplit() {
|
||||
a := Tabs.List[Tabs.Active()]
|
||||
panesLen := len(a.Panes)
|
||||
a.SetActive((a.active + panesLen - 1) % panesLen)
|
||||
}
|
||||
|
||||
// PreviousTab switches to the previous tab in the tab list
|
||||
func (t *TermPane) PreviousTab() {
|
||||
tabsLen := len(Tabs.List)
|
||||
Tabs.SetActive((Tabs.Active() + tabsLen - 1) % tabsLen)
|
||||
}
|
||||
|
||||
// NextTab switches to the next tab in the tab list
|
||||
func (t *TermPane) NextTab() {
|
||||
Tabs.SetActive((Tabs.Active() + 1) % len(Tabs.List))
|
||||
}
|
||||
|
||||
// HandleCommand handles a command for the term pane
|
||||
@ -231,4 +243,7 @@ var TermKeyActions = map[string]TermKeyAction{
|
||||
"Exit": (*TermPane).Exit,
|
||||
"CommandMode": (*TermPane).CommandMode,
|
||||
"NextSplit": (*TermPane).NextSplit,
|
||||
"PreviousSplit": (*TermPane).PreviousSplit,
|
||||
"NextTab": (*TermPane).NextTab,
|
||||
"PreviousTab": (*TermPane).PreviousTab,
|
||||
}
|
||||
|
@ -11,6 +11,7 @@ import (
|
||||
|
||||
shellquote "github.com/kballard/go-shellquote"
|
||||
"github.com/zyedidia/micro/v2/internal/screen"
|
||||
"github.com/zyedidia/micro/v2/internal/util"
|
||||
)
|
||||
|
||||
// ExecCommand executes a command using exec
|
||||
@ -95,28 +96,30 @@ func RunInteractiveShell(input string, wait bool, getOutput bool) (string, error
|
||||
cmd.Stderr = os.Stderr
|
||||
|
||||
// This is a trap for Ctrl-C so that it doesn't kill micro
|
||||
// Instead we trap Ctrl-C to kill the program we're running
|
||||
// micro is killed if the signal is ignored only on Windows, so it is
|
||||
// received
|
||||
c := make(chan os.Signal, 1)
|
||||
signal.Reset(os.Interrupt)
|
||||
signal.Notify(c, os.Interrupt)
|
||||
go func() {
|
||||
for range c {
|
||||
cmd.Process.Kill()
|
||||
}
|
||||
}()
|
||||
|
||||
cmd.Start()
|
||||
err = cmd.Start()
|
||||
if err == nil {
|
||||
err = cmd.Wait()
|
||||
|
||||
output := outputBytes.String()
|
||||
|
||||
if wait {
|
||||
// This is just so we don't return right away and let the user press enter to return
|
||||
screen.TermMessage("")
|
||||
}
|
||||
} else {
|
||||
screen.TermMessage(err)
|
||||
}
|
||||
|
||||
output := outputBytes.String()
|
||||
|
||||
// Start the screen back up
|
||||
screen.TempStart(screenb)
|
||||
|
||||
signal.Notify(util.Sigterm, os.Interrupt)
|
||||
signal.Stop(c)
|
||||
|
||||
return output, err
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,8 @@ var (
|
||||
|
||||
// Stdout is a buffer that is written to stdout when micro closes
|
||||
Stdout *bytes.Buffer
|
||||
// Sigterm is a channel where micro exits when written
|
||||
Sigterm chan os.Signal
|
||||
)
|
||||
|
||||
func init() {
|
||||
|
@ -4,6 +4,7 @@ package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"log"
|
||||
"os/exec"
|
||||
"strings"
|
||||
|
||||
@ -19,13 +20,17 @@ func getTag(match ...string) (string, *semver.PRVersion) {
|
||||
} else {
|
||||
tagParts := strings.Split(string(tag), "-")
|
||||
if len(tagParts) == 3 {
|
||||
if ahead, err := semver.NewPRVersion(tagParts[1]); err == nil {
|
||||
ahead, err := semver.NewPRVersion(tagParts[1])
|
||||
if err == nil {
|
||||
return tagParts[0], &ahead
|
||||
}
|
||||
log.Printf("semver.NewPRVersion(%s): %v", tagParts[1], err)
|
||||
} else if len(tagParts) == 4 {
|
||||
if ahead, err := semver.NewPRVersion(tagParts[2]); err == nil {
|
||||
ahead, err := semver.NewPRVersion(tagParts[2])
|
||||
if err == nil {
|
||||
return tagParts[0] + "-" + tagParts[1], &ahead
|
||||
}
|
||||
log.Printf("semver.NewPRVersion(%s): %v", tagParts[2], err)
|
||||
}
|
||||
|
||||
return string(tag), nil
|
||||
@ -33,15 +38,12 @@ func getTag(match ...string) (string, *semver.PRVersion) {
|
||||
}
|
||||
|
||||
func main() {
|
||||
if tags, err := exec.Command("git", "tag").Output(); err != nil || len(tags) == 0 {
|
||||
// no tags found -- fetch them
|
||||
exec.Command("git", "fetch", "--tags").Run()
|
||||
}
|
||||
// Find the last vX.X.X Tag and get how many builds we are ahead of it.
|
||||
versionStr, ahead := getTag("--match", "v*")
|
||||
version, err := semver.ParseTolerant(versionStr)
|
||||
if err != nil {
|
||||
// no version tag found so just return what ever we can find.
|
||||
log.Printf("semver.ParseTolerant(%s): %v", versionStr, err)
|
||||
fmt.Println("0.0.0-unknown")
|
||||
return
|
||||
}
|
||||
@ -66,6 +68,8 @@ func main() {
|
||||
if pr, err := semver.NewPRVersion(tag); err == nil {
|
||||
// append the tag as pre-release name
|
||||
version.Pre = append(version.Pre, pr)
|
||||
} else {
|
||||
log.Printf("semver.NewPRVersion(%s): %v", tag, err)
|
||||
}
|
||||
|
||||
if ahead != nil {
|
||||
|
Loading…
Reference in New Issue
Block a user