mirror of
https://github.com/jesseduffield/lazygit.git
synced 2025-02-03 13:21:56 +02:00
fix editor
This commit is contained in:
parent
7564e506b5
commit
345c90ac05
11
go.mod
11
go.mod
@ -11,8 +11,7 @@ require (
|
||||
github.com/creack/pty v1.1.11
|
||||
github.com/fatih/color v1.9.0 // indirect
|
||||
github.com/fsnotify/fsnotify v1.4.7
|
||||
github.com/gdamore/tcell/v2 v2.4.0 // indirect
|
||||
github.com/go-errors/errors v1.4.0
|
||||
github.com/go-errors/errors v1.4.1
|
||||
github.com/go-logfmt/logfmt v0.5.0 // indirect
|
||||
github.com/golang-collections/collections v0.0.0-20130729185459-604e922904d3
|
||||
github.com/golang/protobuf v1.3.2 // indirect
|
||||
@ -21,7 +20,7 @@ require (
|
||||
github.com/imdario/mergo v0.3.11
|
||||
github.com/integrii/flaggy v1.4.0
|
||||
github.com/jesseduffield/go-git/v5 v5.1.2-0.20201006095850-341962be15a4
|
||||
github.com/jesseduffield/gocui v0.3.1-0.20210927094955-aa62b56c153a
|
||||
github.com/jesseduffield/gocui v0.3.1-0.20211017041119-0ec562dfd23b
|
||||
github.com/jesseduffield/yaml v2.1.0+incompatible
|
||||
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0
|
||||
github.com/konsorten/go-windows-terminal-sequences v1.0.2 // indirect
|
||||
@ -36,11 +35,11 @@ require (
|
||||
github.com/sahilm/fuzzy v0.1.0
|
||||
github.com/sirupsen/logrus v1.4.2
|
||||
github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad
|
||||
github.com/stretchr/testify v1.6.1
|
||||
github.com/stretchr/testify v1.7.0
|
||||
github.com/xo/terminfo v0.0.0-20210125001918-ca9a967f8778
|
||||
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0 // indirect
|
||||
golang.org/x/net v0.0.0-20201002202402-0a1ea396d57c // indirect
|
||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 // indirect
|
||||
golang.org/x/term v0.0.0-20210916214954-140adaaadfaf // indirect
|
||||
golang.org/x/sys v0.0.0-20211015200801-69063c4bb744 // indirect
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 // indirect
|
||||
golang.org/x/text v0.3.7 // indirect
|
||||
)
|
||||
|
34
go.sum
34
go.sum
@ -32,16 +32,13 @@ github.com/fsnotify/fsnotify v1.4.7 h1:IXs+QLmnXW2CcXuY+8Mzv/fWEsPGWxqefPtCP5CnV
|
||||
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/go.mod h1:vSVL/GV5mCSlPC6thFP5kfOFdM9MGZcalipmpTxTgQA=
|
||||
github.com/gdamore/tcell/v2 v2.3.11 h1:ECO6WqHGbKZ3HrSL7bG/zArMCmLaNr5vcjjMVnLHpzc=
|
||||
github.com/gdamore/tcell/v2 v2.3.11/go.mod h1:cTTuF84Dlj/RqmaCIV5p4w8uG1zWdk0SF6oBpwHp4fU=
|
||||
github.com/gdamore/tcell/v2 v2.4.0 h1:W6dxJEmaxYvhICFoTY3WrLLEXsQ11SaFnKGVEXW57KM=
|
||||
github.com/gdamore/tcell/v2 v2.4.0/go.mod h1:cTTuF84Dlj/RqmaCIV5p4w8uG1zWdk0SF6oBpwHp4fU=
|
||||
github.com/gliderlabs/ssh v0.2.2 h1:6zsha5zo/TWhRhwqCD3+EarCAgZ2yN28ipRnGPnwkI0=
|
||||
github.com/gliderlabs/ssh v0.2.2/go.mod h1:U7qILu1NlMHj9FlMhZLlkCdDnU1DBEAqr0aevW3Awn0=
|
||||
github.com/go-errors/errors v1.0.2/go.mod h1:psDX2osz5VnTOnFWbDeWwS7yejl+uV3FEWEp4lssFEs=
|
||||
github.com/go-errors/errors v1.4.0 h1:2OA7MFw38+e9na72T1xgkomPb6GzZzzxvJ5U630FoRM=
|
||||
github.com/go-errors/errors v1.4.0/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
|
||||
github.com/go-errors/errors v1.4.1 h1:IvVlgbzSsaUNudsw5dcXSzF3EWyXTi5XrAdngnuhRyg=
|
||||
github.com/go-errors/errors v1.4.1/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og=
|
||||
github.com/go-git/gcfg v1.5.0 h1:Q5ViNfGF8zFgyJWPqYwA7qGFoMTEiBmdlkcfRmpIMa4=
|
||||
github.com/go-git/gcfg v1.5.0/go.mod h1:5m20vg6GwYabIxaOonVkTdrILxQMpEShl1xiMF4ua+E=
|
||||
github.com/go-git/go-billy/v5 v5.0.0 h1:7NQHvd9FVid8VL4qVUMm8XifBK+2xCoZ2lSk0agRrHM=
|
||||
@ -72,10 +69,10 @@ github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOl
|
||||
github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo=
|
||||
github.com/jesseduffield/go-git/v5 v5.1.2-0.20201006095850-341962be15a4 h1:GOQrmaE8i+KEdB8NzAegKYd4tPn/inM0I1uo0NXFerg=
|
||||
github.com/jesseduffield/go-git/v5 v5.1.2-0.20201006095850-341962be15a4/go.mod h1:nGNEErzf+NRznT+N2SWqmHnDnF9aLgANB1CUNEan09o=
|
||||
github.com/jesseduffield/gocui v0.3.1-0.20210614081440-74b42ecad52b h1:Wc2zx6xKLNaHc7/wIO6iYyDSjcFGN1Osd6tQvbgMmgo=
|
||||
github.com/jesseduffield/gocui v0.3.1-0.20210614081440-74b42ecad52b/go.mod h1:QWq79xplEoyhQO+dgpk3sojjTVRKjQklyTlzm5nC5Kg=
|
||||
github.com/jesseduffield/gocui v0.3.1-0.20210927094955-aa62b56c153a h1:WAxXz26dZbwxmWdFrkKjpuExmgRRVG4l1qKRLKmQZBw=
|
||||
github.com/jesseduffield/gocui v0.3.1-0.20210927094955-aa62b56c153a/go.mod h1:QWq79xplEoyhQO+dgpk3sojjTVRKjQklyTlzm5nC5Kg=
|
||||
github.com/jesseduffield/gocui v0.3.1-0.20211017035223-b68948e63cc3 h1:J5s/4Y860tas8J0AMQ3gJKCbJPx8zNpiTm5UjEgPQfY=
|
||||
github.com/jesseduffield/gocui v0.3.1-0.20211017035223-b68948e63cc3/go.mod h1:znJuCDnF2Ph40YZSlBwdX/4GEofnIoWLGdT4mK5zRAU=
|
||||
github.com/jesseduffield/gocui v0.3.1-0.20211017041119-0ec562dfd23b h1:kepukaDQfZ6LBSvHUYReFvVSW5Lx5ZQZDgGhXj0Mx7U=
|
||||
github.com/jesseduffield/gocui v0.3.1-0.20211017041119-0ec562dfd23b/go.mod h1:znJuCDnF2Ph40YZSlBwdX/4GEofnIoWLGdT4mK5zRAU=
|
||||
github.com/jesseduffield/yaml v2.1.0+incompatible h1:HWQJ1gIv2zHKbDYNp0Jwjlj24K8aqpFHnMCynY1EpmE=
|
||||
github.com/jesseduffield/yaml v2.1.0+incompatible/go.mod h1:w0xGhOSIJCGYYW+hnFPTutCy5aACpkcwbmORt5axGqk=
|
||||
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
||||
@ -109,8 +106,6 @@ github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd
|
||||
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
|
||||
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/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||
github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||
github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
|
||||
github.com/mattn/go-runewidth v0.0.13 h1:lTGmDsbAYt5DmK6OnoV7EuIF1wEIFAcxld6ypU4OSgU=
|
||||
github.com/mattn/go-runewidth v0.0.13/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||
@ -147,6 +142,8 @@ github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXf
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
|
||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
github.com/urfave/cli v1.20.1-0.20180226030253-8e01ec4cd3e2/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA=
|
||||
github.com/xanzy/ssh-agent v0.2.1 h1:TCbipTQL2JiiCprBWx9frJ2eJlCYT00NmctrHxVAr70=
|
||||
github.com/xanzy/ssh-agent v0.2.1/go.mod h1:mLlQY/MoOhWBj+gOGMQkOeiEvkx+8pJSI+0Bx9h2kr4=
|
||||
@ -171,7 +168,6 @@ golang.org/x/sys v0.0.0-20190221075227-b4e8571b14e0/go.mod h1:STP8DvDyc/dI5b8T5h
|
||||
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-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/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=
|
||||
@ -179,20 +175,14 @@ golang.org/x/sys v0.0.0-20200302150141-5c8b2ff67527/go.mod h1:h1NjWce9XRLGQEsW7w
|
||||
golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/sys v0.0.0-20210611083646-a4fc73990273 h1:faDu4veV+8pcThn4fewv6TVlNCezafGoC1gM/mxQLbQ=
|
||||
golang.org/x/sys v0.0.0-20210611083646-a4fc73990273/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6 h1:foEbQz/B0Oz6YIqu/69kfXPYeFQAuuMYFkjaqXzl5Wo=
|
||||
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20211015200801-69063c4bb744 h1:KzbpndAYEM+4oHRp9JmB2ewj0NHHxO3Z0g7Gus2O1kk=
|
||||
golang.org/x/sys v0.0.0-20211015200801-69063c4bb744/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210503060354-a79de5458b56 h1:b8jxX3zqjpqb2LklXPzKSGJhzyxCOZSz8ncv8Nv+y7w=
|
||||
golang.org/x/term v0.0.0-20210503060354-a79de5458b56/go.mod h1:tfny5GFUkzUvx4ps4ajbZsCe5lw1metzhBm9T3x7oIY=
|
||||
golang.org/x/term v0.0.0-20210916214954-140adaaadfaf h1:Ihq/mm/suC88gF8WFcVwk+OV6Tq+wyA1O0E5UEvDglI=
|
||||
golang.org/x/term v0.0.0-20210916214954-140adaaadfaf/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211 h1:JGgROgKl9N8DuW20oFS5gxc+lE67/N3FcwmBPMe7ArY=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
||||
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
|
||||
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
|
||||
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
|
||||
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
|
||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
||||
|
@ -10,7 +10,7 @@ import (
|
||||
)
|
||||
|
||||
func (gui *Gui) handleCommitConfirm() error {
|
||||
message := gui.trimmedContent(gui.Views.CommitMessage)
|
||||
message := strings.TrimSpace(gui.Views.CommitMessage.TextArea.GetContent())
|
||||
if message == "" {
|
||||
return gui.createErrorPanel(gui.Tr.CommitWithoutMessageErr)
|
||||
}
|
||||
@ -48,7 +48,7 @@ func (gui *Gui) handleCommitMessageFocused() error {
|
||||
}
|
||||
|
||||
func (gui *Gui) getBufferLength(view *gocui.View) string {
|
||||
return " " + strconv.Itoa(strings.Count(view.Buffer(), "")-1) + " "
|
||||
return " " + strconv.Itoa(strings.Count(view.TextArea.GetContent(), "")-1) + " "
|
||||
}
|
||||
|
||||
// RenderCommitLength is a function.
|
||||
|
@ -1,9 +1,5 @@
|
||||
// lots of this has been directly ported from one of the example files, will brush up later
|
||||
|
||||
// Copyright 2014 The gocui Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package gui
|
||||
|
||||
import (
|
||||
@ -169,7 +165,7 @@ func (gui *Gui) getConfirmationPanelDimensions(wrap bool, prompt string) (int, i
|
||||
height/2 + panelHeight/2
|
||||
}
|
||||
|
||||
func (gui *Gui) prepareConfirmationPanel(title, prompt string, hasLoader bool, findSuggestionsFunc func(string) []*types.Suggestion) error {
|
||||
func (gui *Gui) prepareConfirmationPanel(title, prompt string, hasLoader bool, findSuggestionsFunc func(string) []*types.Suggestion, editable bool) error {
|
||||
x0, y0, x1, y1 := gui.getConfirmationPanelDimensions(true, prompt)
|
||||
// calling SetView on an existing view returns the same view, so I'm not bothering
|
||||
// to reassign to gui.Views.Confirmation
|
||||
@ -182,7 +178,8 @@ func (gui *Gui) prepareConfirmationPanel(title, prompt string, hasLoader bool, f
|
||||
gui.g.StartTicking()
|
||||
}
|
||||
gui.Views.Confirmation.Title = title
|
||||
gui.Views.Confirmation.Wrap = true
|
||||
// for now we do not support wrapping in our editor
|
||||
gui.Views.Confirmation.Wrap = !editable
|
||||
gui.Views.Confirmation.FgColor = theme.GocuiDefaultTextColor
|
||||
|
||||
gui.findSuggestions = findSuggestionsFunc
|
||||
@ -209,19 +206,27 @@ func (gui *Gui) createPopupPanel(opts createPopupPanelOpts) error {
|
||||
// remove any previous keybindings
|
||||
gui.clearConfirmationViewKeyBindings()
|
||||
|
||||
err := gui.prepareConfirmationPanel(opts.title, opts.prompt, opts.hasLoader, opts.findSuggestionsFunc)
|
||||
err := gui.prepareConfirmationPanel(
|
||||
opts.title,
|
||||
opts.prompt,
|
||||
opts.hasLoader,
|
||||
opts.findSuggestionsFunc,
|
||||
opts.editable,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
gui.Views.Confirmation.Editable = opts.editable
|
||||
gui.Views.Confirmation.Editor = gocui.EditorFunc(gui.defaultEditor)
|
||||
confirmationView := gui.Views.Confirmation
|
||||
confirmationView.Editable = opts.editable
|
||||
confirmationView.Editor = gocui.EditorFunc(gui.defaultEditor)
|
||||
|
||||
if opts.editable {
|
||||
if err := gui.Views.Confirmation.SetEditorContent(opts.prompt); err != nil {
|
||||
return err
|
||||
}
|
||||
textArea := confirmationView.TextArea
|
||||
textArea.Clear()
|
||||
textArea.TypeString(opts.prompt)
|
||||
confirmationView.RenderTextArea()
|
||||
} else {
|
||||
if err := gui.renderStringSync(gui.Views.Confirmation, opts.prompt); err != nil {
|
||||
if err := gui.renderStringSync(confirmationView, opts.prompt); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ func (gui *Gui) promptUserForCredential(passOrUname string) string {
|
||||
|
||||
func (gui *Gui) handleSubmitCredential() error {
|
||||
credentialsView := gui.Views.Credentials
|
||||
message := gui.trimmedContent(credentialsView)
|
||||
message := strings.TrimSpace(credentialsView.TextArea.GetContent())
|
||||
gui.credentials <- message
|
||||
gui.clearEditorView(credentialsView)
|
||||
if err := gui.returnFromContext(); err != nil {
|
||||
|
@ -6,88 +6,77 @@ import (
|
||||
"github.com/jesseduffield/gocui"
|
||||
)
|
||||
|
||||
// we've just copy+pasted the editor from gocui to here so that we can also re-
|
||||
// render the commit message length on each keypress
|
||||
func (gui *Gui) commitMessageEditor(v *gocui.View, key gocui.Key, ch rune, mod gocui.Modifier) bool {
|
||||
func (gui *Gui) handleEditorKeypress(textArea *gocui.TextArea, key gocui.Key, ch rune, mod gocui.Modifier, allowMultiline bool) bool {
|
||||
newlineKey, ok := gui.getKey(gui.Config.GetUserConfig().Keybinding.Universal.AppendNewline).(gocui.Key)
|
||||
if !ok {
|
||||
newlineKey = gocui.KeyAltEnter
|
||||
}
|
||||
|
||||
matched := true
|
||||
switch {
|
||||
case key == gocui.KeyBackspace || key == gocui.KeyBackspace2:
|
||||
v.EditDelete(true)
|
||||
textArea.BackSpaceChar()
|
||||
case key == gocui.KeyCtrlD || key == gocui.KeyDelete:
|
||||
v.EditDelete(false)
|
||||
textArea.DeleteChar()
|
||||
case key == gocui.KeyArrowDown:
|
||||
v.MoveCursor(0, 1, false)
|
||||
textArea.MoveCursorDown()
|
||||
case key == gocui.KeyArrowUp:
|
||||
v.MoveCursor(0, -1, false)
|
||||
textArea.MoveCursorUp()
|
||||
case key == gocui.KeyArrowLeft:
|
||||
v.MoveCursor(-1, 0, false)
|
||||
textArea.MoveCursorLeft()
|
||||
case key == gocui.KeyArrowRight:
|
||||
v.MoveCursor(1, 0, false)
|
||||
textArea.MoveCursorRight()
|
||||
case key == newlineKey:
|
||||
v.EditNewLine()
|
||||
if allowMultiline {
|
||||
textArea.TypeRune('\n')
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
case key == gocui.KeySpace:
|
||||
v.EditWrite(' ')
|
||||
textArea.TypeRune(' ')
|
||||
case key == gocui.KeyInsert:
|
||||
v.Overwrite = !v.Overwrite
|
||||
textArea.ToggleOverwrite()
|
||||
case key == gocui.KeyCtrlU:
|
||||
v.EditDeleteToStartOfLine()
|
||||
textArea.DeleteToStartOfLine()
|
||||
case key == gocui.KeyCtrlA:
|
||||
v.EditGotoToStartOfLine()
|
||||
textArea.GoToStartOfLine()
|
||||
case key == gocui.KeyCtrlE:
|
||||
v.EditGotoToEndOfLine()
|
||||
textArea.GoToEndOfLine()
|
||||
|
||||
// TODO: see if we need all three of these conditions: maybe the final one is sufficient
|
||||
case ch != 0 && mod == 0 && unicode.IsPrint(ch):
|
||||
v.EditWrite(ch)
|
||||
textArea.TypeRune(ch)
|
||||
default:
|
||||
matched = false
|
||||
return false
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// we've just copy+pasted the editor from gocui to here so that we can also re-
|
||||
// render the commit message length on each keypress
|
||||
func (gui *Gui) commitMessageEditor(v *gocui.View, key gocui.Key, ch rune, mod gocui.Modifier) bool {
|
||||
matched := gui.handleEditorKeypress(v.TextArea, key, ch, mod, true)
|
||||
|
||||
// This function is called again on refresh as part of the general resize popup call,
|
||||
// but we need to call it here so that when we go to render the text area it's not
|
||||
// considered out of bounds to add a newline, meaning we can avoid unnecessary scrolling.
|
||||
err := gui.resizePopupPanel(v, v.TextArea.GetContent())
|
||||
if err != nil {
|
||||
gui.Log.Error(err)
|
||||
}
|
||||
v.RenderTextArea()
|
||||
gui.RenderCommitLength()
|
||||
|
||||
return matched
|
||||
}
|
||||
|
||||
func (gui *Gui) defaultEditor(v *gocui.View, key gocui.Key, ch rune, mod gocui.Modifier) bool {
|
||||
matched := true
|
||||
switch {
|
||||
case key == gocui.KeyBackspace || key == gocui.KeyBackspace2:
|
||||
v.EditDelete(true)
|
||||
case key == gocui.KeyCtrlD || key == gocui.KeyDelete:
|
||||
v.EditDelete(false)
|
||||
case key == gocui.KeyArrowDown:
|
||||
v.MoveCursor(0, 1, false)
|
||||
case key == gocui.KeyArrowUp:
|
||||
v.MoveCursor(0, -1, false)
|
||||
case key == gocui.KeyArrowLeft:
|
||||
v.MoveCursor(-1, 0, false)
|
||||
case key == gocui.KeyArrowRight:
|
||||
v.MoveCursor(1, 0, false)
|
||||
case key == gocui.KeySpace:
|
||||
v.EditWrite(' ')
|
||||
case key == gocui.KeyInsert:
|
||||
v.Overwrite = !v.Overwrite
|
||||
case key == gocui.KeyCtrlU:
|
||||
v.EditDeleteToStartOfLine()
|
||||
case key == gocui.KeyCtrlA:
|
||||
v.EditGotoToStartOfLine()
|
||||
case key == gocui.KeyCtrlE:
|
||||
v.EditGotoToEndOfLine()
|
||||
matched := gui.handleEditorKeypress(v.TextArea, key, ch, mod, false)
|
||||
|
||||
// TODO: see if we need all three of these conditions: maybe the final one is sufficient
|
||||
case ch != 0 && mod == 0 && unicode.IsPrint(ch):
|
||||
v.EditWrite(ch)
|
||||
default:
|
||||
matched = false
|
||||
}
|
||||
v.RenderTextArea()
|
||||
|
||||
if gui.findSuggestions != nil {
|
||||
input := v.Buffer()
|
||||
input := v.TextArea.GetContent()
|
||||
suggestions := gui.findSuggestions(input)
|
||||
gui.setSuggestions(suggestions)
|
||||
}
|
||||
|
@ -347,9 +347,10 @@ func (gui *Gui) handleWIPCommitPress() error {
|
||||
return gui.createErrorPanel(gui.Tr.SkipHookPrefixNotConfigured)
|
||||
}
|
||||
|
||||
if err := gui.Views.CommitMessage.SetEditorContent(skipHookPrefix); err != nil {
|
||||
return err
|
||||
}
|
||||
textArea := gui.Views.CommitMessage.TextArea
|
||||
textArea.Clear()
|
||||
textArea.TypeString(skipHookPrefix)
|
||||
gui.Views.CommitMessage.RenderTextArea()
|
||||
|
||||
return gui.handleCommitPress()
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ func (gui *Gui) handleOpenSearch(viewName string) error {
|
||||
gui.State.Searching.isSearching = true
|
||||
gui.State.Searching.view = view
|
||||
|
||||
gui.renderString(gui.Views.Search, "")
|
||||
gui.Views.Search.ClearTextArea()
|
||||
|
||||
if err := gui.pushContext(gui.State.Contexts.Search); err != nil {
|
||||
return err
|
||||
@ -25,7 +25,7 @@ func (gui *Gui) handleOpenSearch(viewName string) error {
|
||||
}
|
||||
|
||||
func (gui *Gui) handleSearch() error {
|
||||
gui.State.Searching.searchString = gui.Views.Search.Buffer()
|
||||
gui.State.Searching.searchString = gui.Views.Search.TextArea.GetContent()
|
||||
if err := gui.returnFromContext(); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -244,10 +244,6 @@ func (gui *Gui) renderOptionsMap(optionsMap map[string]string) {
|
||||
gui.renderString(gui.Views.Options, gui.optionsMapToString(optionsMap))
|
||||
}
|
||||
|
||||
func (gui *Gui) trimmedContent(v *gocui.View) string {
|
||||
return strings.TrimSpace(v.Buffer())
|
||||
}
|
||||
|
||||
func (gui *Gui) currentViewName() string {
|
||||
currentView := gui.g.CurrentView()
|
||||
if currentView == nil {
|
||||
@ -262,15 +258,14 @@ func (gui *Gui) resizeCurrentPopupPanel() error {
|
||||
return nil
|
||||
}
|
||||
if gui.isPopupPanel(v.Name()) {
|
||||
return gui.resizePopupPanel(v)
|
||||
return gui.resizePopupPanel(v, v.Buffer())
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (gui *Gui) resizePopupPanel(v *gocui.View) error {
|
||||
func (gui *Gui) resizePopupPanel(v *gocui.View, content string) error {
|
||||
// If the confirmation panel is already displayed, just resize the width,
|
||||
// otherwise continue
|
||||
content := v.Buffer()
|
||||
x0, y0, x1, y1 := gui.getConfirmationPanelDimensions(v.Wrap, content)
|
||||
vx0, vy0, vx1, vy1 := v.Dimensions()
|
||||
if vx0 == x0 && vy0 == y0 && vx1 == x1 && vy1 == y1 {
|
||||
@ -346,9 +341,8 @@ func (gui *Gui) secondaryViewFocused() bool {
|
||||
}
|
||||
|
||||
func (gui *Gui) clearEditorView(v *gocui.View) {
|
||||
v.Clear()
|
||||
_ = v.SetCursor(0, 0)
|
||||
_ = v.SetOrigin(0, 0)
|
||||
v.TextArea.Clear()
|
||||
v.RenderTextArea()
|
||||
}
|
||||
|
||||
func (gui *Gui) onViewTabClick(viewName string, tabIndex int) error {
|
||||
|
1
vendor/github.com/go-errors/errors/README.md
generated
vendored
1
vendor/github.com/go-errors/errors/README.md
generated
vendored
@ -78,3 +78,4 @@ This package is licensed under the MIT license, see LICENSE.MIT for details.
|
||||
>. errors.AsError(errors.Wrap(err)).ErrorStack()
|
||||
> ```
|
||||
* v1.4.0 *BREAKING* v1.4.0 reverted all changes from v1.3.0 and is identical to v1.2.0
|
||||
* v1.4.1 no code change, but now without an unnecessary cover.out file.
|
||||
|
89
vendor/github.com/go-errors/errors/cover.out
generated
vendored
89
vendor/github.com/go-errors/errors/cover.out
generated
vendored
@ -1,89 +0,0 @@
|
||||
mode: set
|
||||
github.com/go-errors/errors/stackframe.go:27.51,30.25 2 1
|
||||
github.com/go-errors/errors/stackframe.go:33.2,38.8 3 1
|
||||
github.com/go-errors/errors/stackframe.go:30.25,32.3 1 0
|
||||
github.com/go-errors/errors/stackframe.go:43.47,44.31 1 1
|
||||
github.com/go-errors/errors/stackframe.go:47.2,47.48 1 1
|
||||
github.com/go-errors/errors/stackframe.go:44.31,46.3 1 1
|
||||
github.com/go-errors/errors/stackframe.go:52.42,56.16 3 1
|
||||
github.com/go-errors/errors/stackframe.go:60.2,60.60 1 1
|
||||
github.com/go-errors/errors/stackframe.go:56.16,58.3 1 0
|
||||
github.com/go-errors/errors/stackframe.go:64.55,67.16 2 1
|
||||
github.com/go-errors/errors/stackframe.go:71.2,72.61 2 1
|
||||
github.com/go-errors/errors/stackframe.go:76.2,76.66 1 1
|
||||
github.com/go-errors/errors/stackframe.go:67.16,69.3 1 0
|
||||
github.com/go-errors/errors/stackframe.go:72.61,74.3 1 0
|
||||
github.com/go-errors/errors/stackframe.go:79.56,91.63 3 1
|
||||
github.com/go-errors/errors/stackframe.go:95.2,95.53 1 1
|
||||
github.com/go-errors/errors/stackframe.go:100.2,101.18 2 1
|
||||
github.com/go-errors/errors/stackframe.go:91.63,94.3 2 1
|
||||
github.com/go-errors/errors/stackframe.go:95.53,98.3 2 1
|
||||
github.com/go-errors/errors/error.go:70.32,73.23 2 1
|
||||
github.com/go-errors/errors/error.go:80.2,85.3 3 1
|
||||
github.com/go-errors/errors/error.go:74.2,75.10 1 1
|
||||
github.com/go-errors/errors/error.go:76.2,77.28 1 1
|
||||
github.com/go-errors/errors/error.go:92.43,95.23 2 1
|
||||
github.com/go-errors/errors/error.go:104.2,109.3 3 1
|
||||
github.com/go-errors/errors/error.go:96.2,97.11 1 1
|
||||
github.com/go-errors/errors/error.go:98.2,99.10 1 1
|
||||
github.com/go-errors/errors/error.go:100.2,101.28 1 1
|
||||
github.com/go-errors/errors/error.go:115.39,117.19 1 1
|
||||
github.com/go-errors/errors/error.go:121.2,121.29 1 1
|
||||
github.com/go-errors/errors/error.go:125.2,125.43 1 1
|
||||
github.com/go-errors/errors/error.go:129.2,129.14 1 1
|
||||
github.com/go-errors/errors/error.go:117.19,119.3 1 1
|
||||
github.com/go-errors/errors/error.go:121.29,123.3 1 1
|
||||
github.com/go-errors/errors/error.go:125.43,127.3 1 1
|
||||
github.com/go-errors/errors/error.go:135.53,137.2 1 1
|
||||
github.com/go-errors/errors/error.go:140.34,142.2 1 1
|
||||
github.com/go-errors/errors/error.go:146.34,149.42 2 1
|
||||
github.com/go-errors/errors/error.go:153.2,153.20 1 1
|
||||
github.com/go-errors/errors/error.go:149.42,151.3 1 1
|
||||
github.com/go-errors/errors/error.go:158.39,160.2 1 1
|
||||
github.com/go-errors/errors/error.go:164.46,165.23 1 1
|
||||
github.com/go-errors/errors/error.go:173.2,173.19 1 1
|
||||
github.com/go-errors/errors/error.go:165.23,168.32 2 1
|
||||
github.com/go-errors/errors/error.go:168.32,170.4 1 1
|
||||
github.com/go-errors/errors/error.go:177.37,178.42 1 1
|
||||
github.com/go-errors/errors/error.go:181.2,181.41 1 1
|
||||
github.com/go-errors/errors/error.go:178.42,180.3 1 1
|
||||
github.com/go-errors/errors/parse_panic.go:10.39,12.2 1 1
|
||||
github.com/go-errors/errors/parse_panic.go:16.46,24.34 5 1
|
||||
github.com/go-errors/errors/parse_panic.go:70.2,70.43 1 1
|
||||
github.com/go-errors/errors/parse_panic.go:73.2,73.55 1 0
|
||||
github.com/go-errors/errors/parse_panic.go:24.34,27.23 2 1
|
||||
github.com/go-errors/errors/parse_panic.go:27.23,28.42 1 1
|
||||
github.com/go-errors/errors/parse_panic.go:28.42,31.5 2 1
|
||||
github.com/go-errors/errors/parse_panic.go:31.6,33.5 1 0
|
||||
github.com/go-errors/errors/parse_panic.go:35.5,35.29 1 1
|
||||
github.com/go-errors/errors/parse_panic.go:35.29,36.86 1 1
|
||||
github.com/go-errors/errors/parse_panic.go:36.86,38.5 1 1
|
||||
github.com/go-errors/errors/parse_panic.go:40.5,40.32 1 1
|
||||
github.com/go-errors/errors/parse_panic.go:40.32,41.18 1 1
|
||||
github.com/go-errors/errors/parse_panic.go:45.4,46.46 2 1
|
||||
github.com/go-errors/errors/parse_panic.go:51.4,53.23 2 1
|
||||
github.com/go-errors/errors/parse_panic.go:57.4,58.18 2 1
|
||||
github.com/go-errors/errors/parse_panic.go:62.4,63.17 2 1
|
||||
github.com/go-errors/errors/parse_panic.go:41.18,43.10 2 1
|
||||
github.com/go-errors/errors/parse_panic.go:46.46,49.5 2 1
|
||||
github.com/go-errors/errors/parse_panic.go:53.23,55.5 1 0
|
||||
github.com/go-errors/errors/parse_panic.go:58.18,60.5 1 0
|
||||
github.com/go-errors/errors/parse_panic.go:63.17,65.10 2 1
|
||||
github.com/go-errors/errors/parse_panic.go:70.43,72.3 1 1
|
||||
github.com/go-errors/errors/parse_panic.go:80.85,82.29 2 1
|
||||
github.com/go-errors/errors/parse_panic.go:85.2,85.15 1 1
|
||||
github.com/go-errors/errors/parse_panic.go:88.2,90.63 2 1
|
||||
github.com/go-errors/errors/parse_panic.go:94.2,94.53 1 1
|
||||
github.com/go-errors/errors/parse_panic.go:99.2,101.36 2 1
|
||||
github.com/go-errors/errors/parse_panic.go:105.2,106.15 2 1
|
||||
github.com/go-errors/errors/parse_panic.go:109.2,112.49 3 1
|
||||
github.com/go-errors/errors/parse_panic.go:116.2,117.16 2 1
|
||||
github.com/go-errors/errors/parse_panic.go:121.2,126.8 1 1
|
||||
github.com/go-errors/errors/parse_panic.go:82.29,84.3 1 0
|
||||
github.com/go-errors/errors/parse_panic.go:85.15,87.3 1 1
|
||||
github.com/go-errors/errors/parse_panic.go:90.63,93.3 2 1
|
||||
github.com/go-errors/errors/parse_panic.go:94.53,97.3 2 1
|
||||
github.com/go-errors/errors/parse_panic.go:101.36,103.3 1 0
|
||||
github.com/go-errors/errors/parse_panic.go:106.15,108.3 1 0
|
||||
github.com/go-errors/errors/parse_panic.go:112.49,114.3 1 1
|
||||
github.com/go-errors/errors/parse_panic.go:117.16,119.3 1 0
|
473
vendor/github.com/jesseduffield/gocui/edit.go
generated
vendored
473
vendor/github.com/jesseduffield/gocui/edit.go
generated
vendored
@ -6,14 +6,8 @@ package gocui
|
||||
|
||||
import (
|
||||
"unicode"
|
||||
|
||||
"github.com/go-errors/errors"
|
||||
|
||||
"github.com/mattn/go-runewidth"
|
||||
)
|
||||
|
||||
const maxInt = int(^uint(0) >> 1)
|
||||
|
||||
// Editor interface must be satisfied by gocui editors.
|
||||
type Editor interface {
|
||||
Edit(v *View, key Key, ch rune, mod Modifier) bool
|
||||
@ -34,467 +28,40 @@ var DefaultEditor Editor = EditorFunc(simpleEditor)
|
||||
|
||||
// simpleEditor is used as the default gocui editor.
|
||||
func simpleEditor(v *View, key Key, ch rune, mod Modifier) bool {
|
||||
matched := true
|
||||
|
||||
switch {
|
||||
case ch != 0 && mod == 0:
|
||||
v.EditWrite(ch)
|
||||
case key == KeySpace:
|
||||
v.EditWrite(' ')
|
||||
case key == KeyBackspace || key == KeyBackspace2:
|
||||
v.EditDelete(true)
|
||||
v.TextArea.BackSpaceChar()
|
||||
case key == KeyCtrlD || key == KeyDelete:
|
||||
v.EditDelete(false)
|
||||
case key == KeyInsert:
|
||||
v.Overwrite = !v.Overwrite
|
||||
v.TextArea.DeleteChar()
|
||||
case key == KeyArrowDown:
|
||||
v.MoveCursor(0, 1, false)
|
||||
v.TextArea.MoveCursorDown()
|
||||
case key == KeyArrowUp:
|
||||
v.MoveCursor(0, -1, false)
|
||||
v.TextArea.MoveCursorUp()
|
||||
case key == KeyArrowLeft:
|
||||
v.MoveCursor(-1, 0, false)
|
||||
v.TextArea.MoveCursorLeft()
|
||||
case key == KeyArrowRight:
|
||||
v.MoveCursor(1, 0, false)
|
||||
v.TextArea.MoveCursorRight()
|
||||
case key == KeyEnter:
|
||||
v.EditNewLine()
|
||||
v.TextArea.TypeRune('\n')
|
||||
case key == KeySpace:
|
||||
v.TextArea.TypeRune(' ')
|
||||
case key == KeyInsert:
|
||||
v.TextArea.ToggleOverwrite()
|
||||
case key == KeyCtrlU:
|
||||
v.EditDeleteToStartOfLine()
|
||||
v.TextArea.DeleteToStartOfLine()
|
||||
case key == KeyCtrlA:
|
||||
v.EditGotoToStartOfLine()
|
||||
v.TextArea.GoToStartOfLine()
|
||||
case key == KeyCtrlE:
|
||||
v.EditGotoToEndOfLine()
|
||||
matched = true
|
||||
v.TextArea.GoToEndOfLine()
|
||||
|
||||
// TODO: see if we need all three of these conditions: maybe the final one is sufficient
|
||||
// TODO: see if we need all three of these conditions: maybe the final one is sufficient
|
||||
case ch != 0 && mod == 0 && unicode.IsPrint(ch):
|
||||
v.EditWrite(ch)
|
||||
v.TextArea.TypeRune(ch)
|
||||
default:
|
||||
matched = false
|
||||
return false
|
||||
}
|
||||
|
||||
return matched
|
||||
}
|
||||
|
||||
// EditWrite writes a rune at the cursor position.
|
||||
func (v *View) EditWrite(ch rune) {
|
||||
w := runewidth.RuneWidth(ch)
|
||||
if w == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
v.writeRune(v.cx, v.cy, ch)
|
||||
v.moveCursor(w, 0, true)
|
||||
}
|
||||
|
||||
func (v *View) EditWriteString(str string) {
|
||||
for _, ch := range str {
|
||||
v.EditWrite(ch)
|
||||
}
|
||||
}
|
||||
|
||||
func (v *View) SetEditorContent(content string) error {
|
||||
v.Clear()
|
||||
if err := v.SetOrigin(0, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
if err := v.SetCursor(0, 0); err != nil {
|
||||
return err
|
||||
}
|
||||
v.EditWriteString(content)
|
||||
return nil
|
||||
}
|
||||
|
||||
// EditDeleteToStartOfLine is the equivalent of pressing ctrl+U in your terminal, it deletes to the start of the line. Or if you are already at the start of the line, it deletes the newline character
|
||||
func (v *View) EditDeleteToStartOfLine() {
|
||||
x, _ := v.Cursor()
|
||||
if x == 0 {
|
||||
v.EditDelete(true)
|
||||
} else {
|
||||
// delete characters until we are the start of the line
|
||||
for x > 0 {
|
||||
v.EditDelete(true)
|
||||
x, _ = v.Cursor()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// EditGotoToStartOfLine takes you to the start of the current line
|
||||
func (v *View) EditGotoToStartOfLine() {
|
||||
x, _ := v.Cursor()
|
||||
for x > 0 {
|
||||
v.MoveCursor(-1, 0, false)
|
||||
x, _ = v.Cursor()
|
||||
}
|
||||
}
|
||||
|
||||
// EditGotoToEndOfLine takes you to the end of the line
|
||||
func (v *View) EditGotoToEndOfLine() {
|
||||
_, y := v.Cursor()
|
||||
_ = v.SetCursor(0, y+1)
|
||||
x, newY := v.Cursor()
|
||||
if newY == y {
|
||||
// we must be on the last line, so lets move to the very end
|
||||
prevX := -1
|
||||
for prevX != x {
|
||||
prevX = x
|
||||
v.MoveCursor(1, 0, false)
|
||||
x, _ = v.Cursor()
|
||||
}
|
||||
} else {
|
||||
// most left so now we're at the end of the original line
|
||||
v.MoveCursor(-1, 0, false)
|
||||
}
|
||||
}
|
||||
|
||||
// EditDelete deletes a rune at the cursor position. back determines the
|
||||
// direction.
|
||||
func (v *View) EditDelete(back bool) {
|
||||
v.writeMutex.Lock()
|
||||
defer v.writeMutex.Unlock()
|
||||
|
||||
x, y := v.ox+v.cx, v.oy+v.cy
|
||||
if y < 0 {
|
||||
return
|
||||
} else if y >= len(v.viewLines) {
|
||||
v.MoveCursor(-1, 0, true)
|
||||
return
|
||||
}
|
||||
|
||||
maxX, _ := v.Size()
|
||||
if back {
|
||||
if x == 0 { // start of the line
|
||||
if y < 1 {
|
||||
return
|
||||
}
|
||||
|
||||
var maxPrevWidth int
|
||||
if v.Wrap {
|
||||
maxPrevWidth = maxX
|
||||
} else {
|
||||
maxPrevWidth = maxInt
|
||||
}
|
||||
|
||||
if v.viewLines[y].linesX == 0 { // regular line
|
||||
v.mergeLines(v.cy - 1)
|
||||
if len(v.viewLines[y-1].line) < maxPrevWidth {
|
||||
v.MoveCursor(-1, 0, true)
|
||||
}
|
||||
} else { // wrapped line
|
||||
n, _ := v.deleteRune(len(v.viewLines[y-1].line)-1, v.cy-1)
|
||||
v.MoveCursor(-n, 0, true)
|
||||
}
|
||||
} else { // middle/end of the line
|
||||
n, _ := v.deleteRune(v.cx-1, v.cy)
|
||||
v.MoveCursor(-n, 0, true)
|
||||
}
|
||||
} else {
|
||||
if x == len(v.viewLines[y].line) { // end of the line
|
||||
v.mergeLines(v.cy)
|
||||
} else { // start/middle of the line
|
||||
v.deleteRune(v.cx, v.cy)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// EditNewLine inserts a new line under the cursor.
|
||||
func (v *View) EditNewLine() {
|
||||
v.writeMutex.Lock()
|
||||
defer v.writeMutex.Unlock()
|
||||
|
||||
v.breakLine(v.cx, v.cy)
|
||||
v.ox = 0
|
||||
v.cy = v.cy + 1
|
||||
v.cx = 0
|
||||
}
|
||||
|
||||
// MoveCursor moves the cursor taking into account the width of the line/view,
|
||||
// displacing the origin if necessary.
|
||||
func (v *View) MoveCursor(dx, dy int, writeMode bool) {
|
||||
ox, oy := v.cx+v.ox, v.cy+v.oy
|
||||
x, y := ox+dx, oy+dy
|
||||
|
||||
if y < 0 || y >= len(v.viewLines) {
|
||||
v.moveCursor(dx, dy, writeMode)
|
||||
return
|
||||
}
|
||||
|
||||
// Removing newline.
|
||||
if x < 0 {
|
||||
var prevLen int
|
||||
if y-1 >= 0 && y-1 < len(v.viewLines) {
|
||||
prevLen = lineWidth(v.viewLines[y-1].line)
|
||||
}
|
||||
|
||||
v.MoveCursor(prevLen, -1, writeMode)
|
||||
return
|
||||
}
|
||||
|
||||
line := v.viewLines[y].line
|
||||
var col int
|
||||
var prevCol int
|
||||
for i := range line {
|
||||
prevCol = col
|
||||
col += runewidth.RuneWidth(line[i].chr)
|
||||
if dx > 0 {
|
||||
if x <= col {
|
||||
x = col
|
||||
break
|
||||
}
|
||||
continue
|
||||
}
|
||||
|
||||
if x < col {
|
||||
x = prevCol
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
v.moveCursor(x-ox, y-oy, writeMode)
|
||||
}
|
||||
|
||||
func (v *View) moveCursor(dx, dy int, writeMode bool) {
|
||||
maxX, maxY := v.Size()
|
||||
cx, cy := v.cx+dx, v.cy+dy
|
||||
x, y := v.ox+cx, v.oy+cy
|
||||
|
||||
var curLineWidth, prevLineWidth int
|
||||
// get the width of the current line
|
||||
curLineWidth = maxInt
|
||||
if v.Wrap {
|
||||
curLineWidth = maxX - 1
|
||||
}
|
||||
|
||||
if !writeMode {
|
||||
curLineWidth = 0
|
||||
if y >= 0 && y < len(v.viewLines) {
|
||||
curLineWidth = lineWidth(v.viewLines[y].line)
|
||||
if v.Wrap && curLineWidth >= maxX {
|
||||
curLineWidth = maxX - 1
|
||||
}
|
||||
}
|
||||
}
|
||||
// get the width of the previous line
|
||||
prevLineWidth = 0
|
||||
if y-1 >= 0 && y-1 < len(v.viewLines) {
|
||||
prevLineWidth = lineWidth(v.viewLines[y-1].line)
|
||||
}
|
||||
// adjust cursor's x position and view's x origin
|
||||
if x > curLineWidth { // move to next line
|
||||
if dx > 0 { // horizontal movement
|
||||
cy++
|
||||
if writeMode || v.oy+cy < len(v.viewLines) {
|
||||
if !v.Wrap {
|
||||
v.ox = 0
|
||||
}
|
||||
v.cx = 0
|
||||
}
|
||||
} else { // vertical movement
|
||||
if curLineWidth > 0 { // move cursor to the EOL
|
||||
if v.Wrap {
|
||||
v.cx = curLineWidth
|
||||
} else {
|
||||
ncx := curLineWidth - v.ox
|
||||
if ncx < 0 {
|
||||
v.ox += ncx
|
||||
if v.ox < 0 {
|
||||
v.ox = 0
|
||||
}
|
||||
v.cx = 0
|
||||
} else {
|
||||
v.cx = ncx
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if writeMode || v.oy+cy < len(v.viewLines) {
|
||||
if !v.Wrap {
|
||||
v.ox = 0
|
||||
}
|
||||
v.cx = 0
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if cx < 0 {
|
||||
if !v.Wrap && v.ox > 0 { // move origin to the left
|
||||
v.ox += cx
|
||||
v.cx = 0
|
||||
} else { // move to previous line
|
||||
cy--
|
||||
if prevLineWidth > 0 {
|
||||
if !v.Wrap { // set origin so the EOL is visible
|
||||
nox := prevLineWidth - maxX + 1
|
||||
if nox < 0 {
|
||||
nox = 0
|
||||
}
|
||||
v.ox = nox
|
||||
}
|
||||
v.cx = prevLineWidth
|
||||
} else {
|
||||
if !v.Wrap {
|
||||
v.ox = 0
|
||||
}
|
||||
v.cx = 0
|
||||
}
|
||||
}
|
||||
} else { // stay on the same line
|
||||
if v.Wrap {
|
||||
v.cx = cx
|
||||
} else {
|
||||
if cx >= maxX {
|
||||
v.ox += cx - maxX + 1
|
||||
v.cx = maxX
|
||||
} else {
|
||||
v.cx = cx
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// adjust cursor's y position and view's y origin
|
||||
if cy < 0 {
|
||||
if v.oy > 0 {
|
||||
v.oy--
|
||||
}
|
||||
} else if writeMode || v.oy+cy < len(v.viewLines) {
|
||||
if cy >= maxY {
|
||||
v.oy++
|
||||
} else {
|
||||
v.cy = cy
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// writeRune writes a rune into the view's internal buffer, at the
|
||||
// position corresponding to the point (x, y). The length of the internal
|
||||
// buffer is increased if the point is out of bounds. Overwrite mode is
|
||||
// governed by the value of View.overwrite.
|
||||
func (v *View) writeRune(x, y int, ch rune) error {
|
||||
v.writeMutex.Lock()
|
||||
defer v.writeMutex.Unlock()
|
||||
|
||||
v.tainted = true
|
||||
|
||||
x, y, err := v.realPosition(x, y)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if x < 0 || y < 0 {
|
||||
return errors.New("invalid point")
|
||||
}
|
||||
|
||||
if y >= len(v.lines) {
|
||||
s := make([][]cell, y-len(v.lines)+1)
|
||||
v.lines = append(v.lines, s...)
|
||||
}
|
||||
|
||||
olen := len(v.lines[y])
|
||||
w := runewidth.RuneWidth(ch)
|
||||
|
||||
var s []cell
|
||||
if x >= len(v.lines[y]) {
|
||||
s = make([]cell, x-len(v.lines[y])+w)
|
||||
} else if !v.Overwrite {
|
||||
s = make([]cell, w)
|
||||
}
|
||||
v.lines[y] = append(v.lines[y], s...)
|
||||
|
||||
if !v.Overwrite || (v.Overwrite && x >= olen-w) {
|
||||
copy(v.lines[y][x+w:], v.lines[y][x:])
|
||||
}
|
||||
v.lines[y][x] = cell{
|
||||
fgColor: v.FgColor,
|
||||
bgColor: v.BgColor,
|
||||
chr: ch,
|
||||
}
|
||||
|
||||
for i := 1; i < w; i++ {
|
||||
v.lines[y][x+i] = cell{
|
||||
fgColor: v.FgColor,
|
||||
bgColor: v.BgColor,
|
||||
chr: '\x00',
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
// deleteRune removes a rune from the view's internal buffer, at the
|
||||
// position corresponding to the point (x, y).
|
||||
// returns the amount of columns that where removed.
|
||||
func (v *View) deleteRune(x, y int) (int, error) {
|
||||
v.tainted = true
|
||||
|
||||
x, y, err := v.realPosition(x, y)
|
||||
if err != nil {
|
||||
return 0, err
|
||||
}
|
||||
|
||||
if x < 0 || y < 0 || y >= len(v.lines) || x >= len(v.lines[y]) {
|
||||
return 0, errors.New("invalid point")
|
||||
}
|
||||
|
||||
var tw int
|
||||
for i := range v.lines[y] {
|
||||
w := runewidth.RuneWidth(v.lines[y][i].chr)
|
||||
tw += w
|
||||
if tw > x {
|
||||
v.lines[y] = append(v.lines[y][:i], v.lines[y][i+w:]...)
|
||||
return w, nil
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return 0, nil
|
||||
}
|
||||
|
||||
// mergeLines merges the lines "y" and "y+1" if possible.
|
||||
func (v *View) mergeLines(y int) error {
|
||||
v.clearViewLines()
|
||||
|
||||
_, y, err := v.realPosition(0, y)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if y < 0 || y >= len(v.lines) {
|
||||
return errors.New("invalid point")
|
||||
}
|
||||
|
||||
if y < len(v.lines)-1 { // otherwise we don't need to merge anything
|
||||
v.lines[y] = append(v.lines[y], v.lines[y+1]...)
|
||||
v.lines = append(v.lines[:y+1], v.lines[y+2:]...)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
// breakLine breaks a line of the internal buffer at the position corresponding
|
||||
// to the point (x, y).
|
||||
func (v *View) breakLine(x, y int) error {
|
||||
v.tainted = true
|
||||
|
||||
x, y, err := v.realPosition(x, y)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
if y < 0 || y >= len(v.lines) {
|
||||
return errors.New("invalid point")
|
||||
}
|
||||
|
||||
var left, right []cell
|
||||
if x < len(v.lines[y]) { // break line
|
||||
left = make([]cell, len(v.lines[y][:x]))
|
||||
copy(left, v.lines[y][:x])
|
||||
right = make([]cell, len(v.lines[y][x:]))
|
||||
copy(right, v.lines[y][x:])
|
||||
} else { // new empty line
|
||||
left = v.lines[y]
|
||||
}
|
||||
|
||||
lines := make([][]cell, len(v.lines)+1)
|
||||
lines[y] = left
|
||||
lines[y+1] = right
|
||||
copy(lines, v.lines[:y])
|
||||
copy(lines[y+2:], v.lines[y+1:])
|
||||
v.lines = lines
|
||||
return nil
|
||||
v.RenderTextArea()
|
||||
|
||||
return true
|
||||
}
|
||||
|
5
vendor/github.com/jesseduffield/gocui/go.mod
generated
vendored
5
vendor/github.com/jesseduffield/gocui/go.mod
generated
vendored
@ -3,7 +3,8 @@ module github.com/jesseduffield/gocui
|
||||
go 1.12
|
||||
|
||||
require (
|
||||
github.com/gdamore/tcell/v2 v2.0.0
|
||||
github.com/gdamore/tcell/v2 v2.4.0
|
||||
github.com/go-errors/errors v1.0.2
|
||||
github.com/mattn/go-runewidth v0.0.9
|
||||
github.com/mattn/go-runewidth v0.0.10
|
||||
github.com/stretchr/testify v1.7.0
|
||||
)
|
||||
|
28
vendor/github.com/jesseduffield/gocui/go.sum
generated
vendored
28
vendor/github.com/jesseduffield/gocui/go.sum
generated
vendored
@ -1,15 +1,29 @@
|
||||
github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8=
|
||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
||||
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/gdamore/tcell/v2 v2.4.0 h1:W6dxJEmaxYvhICFoTY3WrLLEXsQ11SaFnKGVEXW57KM=
|
||||
github.com/gdamore/tcell/v2 v2.4.0/go.mod h1:cTTuF84Dlj/RqmaCIV5p4w8uG1zWdk0SF6oBpwHp4fU=
|
||||
github.com/go-errors/errors v1.0.2 h1:xMxH9j2fNg/L4hLn/4y3M0IUsn0M6Wbu/Uh9QlOfBh4=
|
||||
github.com/go-errors/errors v1.0.2/go.mod h1:psDX2osz5VnTOnFWbDeWwS7yejl+uV3FEWEp4lssFEs=
|
||||
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-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=
|
||||
golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756 h1:9nuHUbU8dRnRRfj9KjWUVrJeoexdbeMjttk6Oh1rD10=
|
||||
golang.org/x/sys v0.0.0-20190626150813-e07cf5db2756/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
github.com/mattn/go-runewidth v0.0.10 h1:CoZ3S2P7pvtP45xOtBw+/mDL2z0RKI576gSkzRRpdGg=
|
||||
github.com/mattn/go-runewidth v0.0.10/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk=
|
||||
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 h1:+2KBaVoUmb9XzDsrx/Ct0W/EYOSFf/nWTauy++DprtY=
|
||||
github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
||||
github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY=
|
||||
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68 h1:nxC68pudNYkKU6jWhgrqdreuFiOQWj1Fs7T3VrH4Pjw=
|
||||
golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
||||
golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf h1:MZ2shdL+ZM/XzY3ZGOnh4Nlpnxz5GSOhOmtHo3iPU6M=
|
||||
golang.org/x/term v0.0.0-20201210144234-2321bbc49cbf/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
|
||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
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/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
|
209
vendor/github.com/jesseduffield/gocui/text_area.go
generated
vendored
Normal file
209
vendor/github.com/jesseduffield/gocui/text_area.go
generated
vendored
Normal file
@ -0,0 +1,209 @@
|
||||
package gocui
|
||||
|
||||
import "github.com/mattn/go-runewidth"
|
||||
|
||||
type TextArea struct {
|
||||
content []rune
|
||||
cursor int
|
||||
overwrite bool
|
||||
}
|
||||
|
||||
func (self *TextArea) TypeRune(r rune) {
|
||||
if self.overwrite && !self.atEnd() {
|
||||
self.content[self.cursor] = r
|
||||
} else {
|
||||
self.content = append(
|
||||
self.content[:self.cursor],
|
||||
append([]rune{r}, self.content[self.cursor:]...)...,
|
||||
)
|
||||
}
|
||||
|
||||
self.cursor++
|
||||
}
|
||||
|
||||
func (self *TextArea) BackSpaceChar() {
|
||||
if self.cursor == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
self.content = append(self.content[:self.cursor-1], self.content[self.cursor:]...)
|
||||
self.cursor--
|
||||
}
|
||||
|
||||
func (self *TextArea) DeleteChar() {
|
||||
if self.atEnd() {
|
||||
return
|
||||
}
|
||||
|
||||
self.content = append(self.content[:self.cursor], self.content[self.cursor+1:]...)
|
||||
}
|
||||
|
||||
func (self *TextArea) MoveCursorLeft() {
|
||||
if self.cursor == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
self.cursor--
|
||||
}
|
||||
|
||||
func (self *TextArea) MoveCursorRight() {
|
||||
if self.cursor == len(self.content) {
|
||||
return
|
||||
}
|
||||
|
||||
self.cursor++
|
||||
}
|
||||
|
||||
func (self *TextArea) MoveCursorUp() {
|
||||
x, y := self.GetCursorXY()
|
||||
self.SetCursor2D(x, y-1)
|
||||
}
|
||||
|
||||
func (self *TextArea) MoveCursorDown() {
|
||||
x, y := self.GetCursorXY()
|
||||
self.SetCursor2D(x, y+1)
|
||||
}
|
||||
|
||||
func (self *TextArea) GetContent() string {
|
||||
return string(self.content)
|
||||
}
|
||||
|
||||
func (self *TextArea) ToggleOverwrite() {
|
||||
self.overwrite = !self.overwrite
|
||||
}
|
||||
|
||||
func (self *TextArea) atEnd() bool {
|
||||
return self.cursor == len(self.content)
|
||||
}
|
||||
|
||||
func (self *TextArea) DeleteToStartOfLine() {
|
||||
// copying vim's logic: if you're at the start of the line, you delete the newline
|
||||
// character and go to the end of the previous line
|
||||
if self.atLineStart() {
|
||||
if self.cursor == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
self.content = append(self.content[:self.cursor-1], self.content[self.cursor:]...)
|
||||
self.cursor--
|
||||
return
|
||||
}
|
||||
|
||||
// otherwise, you delete everything up to the start of the current line, without
|
||||
// deleting the newline character
|
||||
newlineIndex := self.closestNewlineOnLeft()
|
||||
self.content = append(self.content[:newlineIndex+1], self.content[self.cursor:]...)
|
||||
self.cursor = newlineIndex + 1
|
||||
}
|
||||
|
||||
func (self *TextArea) GoToStartOfLine() {
|
||||
if self.atLineStart() {
|
||||
return
|
||||
}
|
||||
|
||||
// otherwise, you delete everything up to the start of the current line, without
|
||||
// deleting the newline character
|
||||
newlineIndex := self.closestNewlineOnLeft()
|
||||
self.cursor = newlineIndex + 1
|
||||
}
|
||||
|
||||
func (self *TextArea) closestNewlineOnLeft() int {
|
||||
newlineIndex := -1
|
||||
|
||||
for i, r := range self.content[0:self.cursor] {
|
||||
if r == '\n' {
|
||||
newlineIndex = i
|
||||
}
|
||||
}
|
||||
|
||||
return newlineIndex
|
||||
}
|
||||
|
||||
func (self *TextArea) GoToEndOfLine() {
|
||||
if self.atEnd() {
|
||||
return
|
||||
}
|
||||
|
||||
self.cursor = self.closestNewlineOnRight()
|
||||
}
|
||||
|
||||
func (self *TextArea) closestNewlineOnRight() int {
|
||||
for i, r := range self.content[self.cursor:] {
|
||||
if r == '\n' {
|
||||
return self.cursor + i
|
||||
}
|
||||
}
|
||||
|
||||
return len(self.content)
|
||||
}
|
||||
|
||||
func (self *TextArea) atLineStart() bool {
|
||||
return self.cursor == 0 ||
|
||||
(len(self.content) > self.cursor-1 && self.content[self.cursor-1] == '\n')
|
||||
}
|
||||
|
||||
func (self *TextArea) GetCursorXY() (int, int) {
|
||||
cursorX := 0
|
||||
cursorY := 0
|
||||
for _, r := range self.content[0:self.cursor] {
|
||||
if r == '\n' {
|
||||
cursorY++
|
||||
cursorX = 0
|
||||
} else {
|
||||
chWidth := runewidth.RuneWidth(r)
|
||||
cursorX += chWidth
|
||||
}
|
||||
}
|
||||
|
||||
return cursorX, cursorY
|
||||
}
|
||||
|
||||
// takes an x,y position and maps it to a 1D cursor position
|
||||
func (self *TextArea) SetCursor2D(x int, y int) {
|
||||
if y < 0 {
|
||||
y = 0
|
||||
}
|
||||
if x < 0 {
|
||||
x = 0
|
||||
}
|
||||
|
||||
newCursor := 0
|
||||
for _, r := range self.content {
|
||||
if x <= 0 && y == 0 {
|
||||
self.cursor = newCursor
|
||||
return
|
||||
}
|
||||
|
||||
if r == '\n' {
|
||||
if y == 0 {
|
||||
self.cursor = newCursor
|
||||
return
|
||||
}
|
||||
y--
|
||||
} else if y == 0 {
|
||||
chWidth := runewidth.RuneWidth(r)
|
||||
x -= chWidth
|
||||
}
|
||||
|
||||
newCursor++
|
||||
}
|
||||
|
||||
// if we weren't able to run-down our arg, the user is trying to move out of
|
||||
// bounds so we'll just return
|
||||
if y > 0 {
|
||||
return
|
||||
}
|
||||
|
||||
self.cursor = newCursor
|
||||
}
|
||||
|
||||
func (self *TextArea) Clear() {
|
||||
self.content = []rune{}
|
||||
self.cursor = 0
|
||||
}
|
||||
|
||||
func (self *TextArea) TypeString(str string) {
|
||||
for _, r := range str {
|
||||
self.TypeRune(r)
|
||||
}
|
||||
}
|
44
vendor/github.com/jesseduffield/gocui/view.go
generated
vendored
44
vendor/github.com/jesseduffield/gocui/view.go
generated
vendored
@ -6,6 +6,7 @@ package gocui
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"fmt"
|
||||
"io"
|
||||
"strings"
|
||||
"sync"
|
||||
@ -158,6 +159,8 @@ type View struct {
|
||||
// KeybindOnEdit should be set to true when you want to execute keybindings even when the view is editable
|
||||
// (this is usually not the case)
|
||||
KeybindOnEdit bool
|
||||
|
||||
TextArea *TextArea
|
||||
}
|
||||
|
||||
// call this in the event of a view resize, or if you want to render new content
|
||||
@ -340,6 +343,7 @@ func newView(name string, x0, y0, x1, y1 int, mode OutputMode) *View {
|
||||
outMode: mode,
|
||||
ei: newEscapeInterpreter(mode),
|
||||
searcher: &searcher{},
|
||||
TextArea: &TextArea{},
|
||||
}
|
||||
|
||||
v.FgColor, v.BgColor = ColorDefault, ColorDefault
|
||||
@ -1119,3 +1123,43 @@ func (v *View) SelectedPoint() (int, int) {
|
||||
ox, oy := v.Origin()
|
||||
return cx + ox, cy + oy
|
||||
}
|
||||
|
||||
func (v *View) RenderTextArea() {
|
||||
v.Clear()
|
||||
fmt.Fprint(v, v.TextArea.GetContent())
|
||||
cursorX, cursorY := v.TextArea.GetCursorXY()
|
||||
prevOriginX, prevOriginY := v.Origin()
|
||||
width, height := v.Size()
|
||||
|
||||
frameAdjustment := 0
|
||||
if v.Frame {
|
||||
frameAdjustment = -1
|
||||
}
|
||||
newViewCursorX, newOriginX := updatedCursorAndOrigin(prevOriginX, width+frameAdjustment, cursorX)
|
||||
newViewCursorY, newOriginY := updatedCursorAndOrigin(prevOriginY, height+frameAdjustment, cursorY)
|
||||
|
||||
_ = v.SetCursor(newViewCursorX, newViewCursorY)
|
||||
_ = v.SetOrigin(newOriginX, newOriginY)
|
||||
}
|
||||
|
||||
func updatedCursorAndOrigin(prevOrigin int, size int, cursor int) (int, int) {
|
||||
var newViewCursor int
|
||||
newOrigin := prevOrigin
|
||||
|
||||
if cursor > prevOrigin+size {
|
||||
newOrigin = cursor - size
|
||||
newViewCursor = size
|
||||
} else if cursor < prevOrigin {
|
||||
newOrigin = cursor
|
||||
newViewCursor = 0
|
||||
} else {
|
||||
newViewCursor = cursor - prevOrigin
|
||||
}
|
||||
|
||||
return newViewCursor, newOrigin
|
||||
}
|
||||
|
||||
func (v *View) ClearTextArea() {
|
||||
v.TextArea.Clear()
|
||||
v.Clear()
|
||||
}
|
||||
|
172
vendor/github.com/stretchr/testify/assert/assertion_compare.go
generated
vendored
172
vendor/github.com/stretchr/testify/assert/assertion_compare.go
generated
vendored
@ -13,12 +13,42 @@ const (
|
||||
compareGreater
|
||||
)
|
||||
|
||||
var (
|
||||
intType = reflect.TypeOf(int(1))
|
||||
int8Type = reflect.TypeOf(int8(1))
|
||||
int16Type = reflect.TypeOf(int16(1))
|
||||
int32Type = reflect.TypeOf(int32(1))
|
||||
int64Type = reflect.TypeOf(int64(1))
|
||||
|
||||
uintType = reflect.TypeOf(uint(1))
|
||||
uint8Type = reflect.TypeOf(uint8(1))
|
||||
uint16Type = reflect.TypeOf(uint16(1))
|
||||
uint32Type = reflect.TypeOf(uint32(1))
|
||||
uint64Type = reflect.TypeOf(uint64(1))
|
||||
|
||||
float32Type = reflect.TypeOf(float32(1))
|
||||
float64Type = reflect.TypeOf(float64(1))
|
||||
|
||||
stringType = reflect.TypeOf("")
|
||||
)
|
||||
|
||||
func compare(obj1, obj2 interface{}, kind reflect.Kind) (CompareType, bool) {
|
||||
obj1Value := reflect.ValueOf(obj1)
|
||||
obj2Value := reflect.ValueOf(obj2)
|
||||
|
||||
// throughout this switch we try and avoid calling .Convert() if possible,
|
||||
// as this has a pretty big performance impact
|
||||
switch kind {
|
||||
case reflect.Int:
|
||||
{
|
||||
intobj1 := obj1.(int)
|
||||
intobj2 := obj2.(int)
|
||||
intobj1, ok := obj1.(int)
|
||||
if !ok {
|
||||
intobj1 = obj1Value.Convert(intType).Interface().(int)
|
||||
}
|
||||
intobj2, ok := obj2.(int)
|
||||
if !ok {
|
||||
intobj2 = obj2Value.Convert(intType).Interface().(int)
|
||||
}
|
||||
if intobj1 > intobj2 {
|
||||
return compareGreater, true
|
||||
}
|
||||
@ -31,8 +61,14 @@ func compare(obj1, obj2 interface{}, kind reflect.Kind) (CompareType, bool) {
|
||||
}
|
||||
case reflect.Int8:
|
||||
{
|
||||
int8obj1 := obj1.(int8)
|
||||
int8obj2 := obj2.(int8)
|
||||
int8obj1, ok := obj1.(int8)
|
||||
if !ok {
|
||||
int8obj1 = obj1Value.Convert(int8Type).Interface().(int8)
|
||||
}
|
||||
int8obj2, ok := obj2.(int8)
|
||||
if !ok {
|
||||
int8obj2 = obj2Value.Convert(int8Type).Interface().(int8)
|
||||
}
|
||||
if int8obj1 > int8obj2 {
|
||||
return compareGreater, true
|
||||
}
|
||||
@ -45,8 +81,14 @@ func compare(obj1, obj2 interface{}, kind reflect.Kind) (CompareType, bool) {
|
||||
}
|
||||
case reflect.Int16:
|
||||
{
|
||||
int16obj1 := obj1.(int16)
|
||||
int16obj2 := obj2.(int16)
|
||||
int16obj1, ok := obj1.(int16)
|
||||
if !ok {
|
||||
int16obj1 = obj1Value.Convert(int16Type).Interface().(int16)
|
||||
}
|
||||
int16obj2, ok := obj2.(int16)
|
||||
if !ok {
|
||||
int16obj2 = obj2Value.Convert(int16Type).Interface().(int16)
|
||||
}
|
||||
if int16obj1 > int16obj2 {
|
||||
return compareGreater, true
|
||||
}
|
||||
@ -59,8 +101,14 @@ func compare(obj1, obj2 interface{}, kind reflect.Kind) (CompareType, bool) {
|
||||
}
|
||||
case reflect.Int32:
|
||||
{
|
||||
int32obj1 := obj1.(int32)
|
||||
int32obj2 := obj2.(int32)
|
||||
int32obj1, ok := obj1.(int32)
|
||||
if !ok {
|
||||
int32obj1 = obj1Value.Convert(int32Type).Interface().(int32)
|
||||
}
|
||||
int32obj2, ok := obj2.(int32)
|
||||
if !ok {
|
||||
int32obj2 = obj2Value.Convert(int32Type).Interface().(int32)
|
||||
}
|
||||
if int32obj1 > int32obj2 {
|
||||
return compareGreater, true
|
||||
}
|
||||
@ -73,8 +121,14 @@ func compare(obj1, obj2 interface{}, kind reflect.Kind) (CompareType, bool) {
|
||||
}
|
||||
case reflect.Int64:
|
||||
{
|
||||
int64obj1 := obj1.(int64)
|
||||
int64obj2 := obj2.(int64)
|
||||
int64obj1, ok := obj1.(int64)
|
||||
if !ok {
|
||||
int64obj1 = obj1Value.Convert(int64Type).Interface().(int64)
|
||||
}
|
||||
int64obj2, ok := obj2.(int64)
|
||||
if !ok {
|
||||
int64obj2 = obj2Value.Convert(int64Type).Interface().(int64)
|
||||
}
|
||||
if int64obj1 > int64obj2 {
|
||||
return compareGreater, true
|
||||
}
|
||||
@ -87,8 +141,14 @@ func compare(obj1, obj2 interface{}, kind reflect.Kind) (CompareType, bool) {
|
||||
}
|
||||
case reflect.Uint:
|
||||
{
|
||||
uintobj1 := obj1.(uint)
|
||||
uintobj2 := obj2.(uint)
|
||||
uintobj1, ok := obj1.(uint)
|
||||
if !ok {
|
||||
uintobj1 = obj1Value.Convert(uintType).Interface().(uint)
|
||||
}
|
||||
uintobj2, ok := obj2.(uint)
|
||||
if !ok {
|
||||
uintobj2 = obj2Value.Convert(uintType).Interface().(uint)
|
||||
}
|
||||
if uintobj1 > uintobj2 {
|
||||
return compareGreater, true
|
||||
}
|
||||
@ -101,8 +161,14 @@ func compare(obj1, obj2 interface{}, kind reflect.Kind) (CompareType, bool) {
|
||||
}
|
||||
case reflect.Uint8:
|
||||
{
|
||||
uint8obj1 := obj1.(uint8)
|
||||
uint8obj2 := obj2.(uint8)
|
||||
uint8obj1, ok := obj1.(uint8)
|
||||
if !ok {
|
||||
uint8obj1 = obj1Value.Convert(uint8Type).Interface().(uint8)
|
||||
}
|
||||
uint8obj2, ok := obj2.(uint8)
|
||||
if !ok {
|
||||
uint8obj2 = obj2Value.Convert(uint8Type).Interface().(uint8)
|
||||
}
|
||||
if uint8obj1 > uint8obj2 {
|
||||
return compareGreater, true
|
||||
}
|
||||
@ -115,8 +181,14 @@ func compare(obj1, obj2 interface{}, kind reflect.Kind) (CompareType, bool) {
|
||||
}
|
||||
case reflect.Uint16:
|
||||
{
|
||||
uint16obj1 := obj1.(uint16)
|
||||
uint16obj2 := obj2.(uint16)
|
||||
uint16obj1, ok := obj1.(uint16)
|
||||
if !ok {
|
||||
uint16obj1 = obj1Value.Convert(uint16Type).Interface().(uint16)
|
||||
}
|
||||
uint16obj2, ok := obj2.(uint16)
|
||||
if !ok {
|
||||
uint16obj2 = obj2Value.Convert(uint16Type).Interface().(uint16)
|
||||
}
|
||||
if uint16obj1 > uint16obj2 {
|
||||
return compareGreater, true
|
||||
}
|
||||
@ -129,8 +201,14 @@ func compare(obj1, obj2 interface{}, kind reflect.Kind) (CompareType, bool) {
|
||||
}
|
||||
case reflect.Uint32:
|
||||
{
|
||||
uint32obj1 := obj1.(uint32)
|
||||
uint32obj2 := obj2.(uint32)
|
||||
uint32obj1, ok := obj1.(uint32)
|
||||
if !ok {
|
||||
uint32obj1 = obj1Value.Convert(uint32Type).Interface().(uint32)
|
||||
}
|
||||
uint32obj2, ok := obj2.(uint32)
|
||||
if !ok {
|
||||
uint32obj2 = obj2Value.Convert(uint32Type).Interface().(uint32)
|
||||
}
|
||||
if uint32obj1 > uint32obj2 {
|
||||
return compareGreater, true
|
||||
}
|
||||
@ -143,8 +221,14 @@ func compare(obj1, obj2 interface{}, kind reflect.Kind) (CompareType, bool) {
|
||||
}
|
||||
case reflect.Uint64:
|
||||
{
|
||||
uint64obj1 := obj1.(uint64)
|
||||
uint64obj2 := obj2.(uint64)
|
||||
uint64obj1, ok := obj1.(uint64)
|
||||
if !ok {
|
||||
uint64obj1 = obj1Value.Convert(uint64Type).Interface().(uint64)
|
||||
}
|
||||
uint64obj2, ok := obj2.(uint64)
|
||||
if !ok {
|
||||
uint64obj2 = obj2Value.Convert(uint64Type).Interface().(uint64)
|
||||
}
|
||||
if uint64obj1 > uint64obj2 {
|
||||
return compareGreater, true
|
||||
}
|
||||
@ -157,8 +241,14 @@ func compare(obj1, obj2 interface{}, kind reflect.Kind) (CompareType, bool) {
|
||||
}
|
||||
case reflect.Float32:
|
||||
{
|
||||
float32obj1 := obj1.(float32)
|
||||
float32obj2 := obj2.(float32)
|
||||
float32obj1, ok := obj1.(float32)
|
||||
if !ok {
|
||||
float32obj1 = obj1Value.Convert(float32Type).Interface().(float32)
|
||||
}
|
||||
float32obj2, ok := obj2.(float32)
|
||||
if !ok {
|
||||
float32obj2 = obj2Value.Convert(float32Type).Interface().(float32)
|
||||
}
|
||||
if float32obj1 > float32obj2 {
|
||||
return compareGreater, true
|
||||
}
|
||||
@ -171,8 +261,14 @@ func compare(obj1, obj2 interface{}, kind reflect.Kind) (CompareType, bool) {
|
||||
}
|
||||
case reflect.Float64:
|
||||
{
|
||||
float64obj1 := obj1.(float64)
|
||||
float64obj2 := obj2.(float64)
|
||||
float64obj1, ok := obj1.(float64)
|
||||
if !ok {
|
||||
float64obj1 = obj1Value.Convert(float64Type).Interface().(float64)
|
||||
}
|
||||
float64obj2, ok := obj2.(float64)
|
||||
if !ok {
|
||||
float64obj2 = obj2Value.Convert(float64Type).Interface().(float64)
|
||||
}
|
||||
if float64obj1 > float64obj2 {
|
||||
return compareGreater, true
|
||||
}
|
||||
@ -185,8 +281,14 @@ func compare(obj1, obj2 interface{}, kind reflect.Kind) (CompareType, bool) {
|
||||
}
|
||||
case reflect.String:
|
||||
{
|
||||
stringobj1 := obj1.(string)
|
||||
stringobj2 := obj2.(string)
|
||||
stringobj1, ok := obj1.(string)
|
||||
if !ok {
|
||||
stringobj1 = obj1Value.Convert(stringType).Interface().(string)
|
||||
}
|
||||
stringobj2, ok := obj2.(string)
|
||||
if !ok {
|
||||
stringobj2 = obj2Value.Convert(stringType).Interface().(string)
|
||||
}
|
||||
if stringobj1 > stringobj2 {
|
||||
return compareGreater, true
|
||||
}
|
||||
@ -240,6 +342,24 @@ func LessOrEqual(t TestingT, e1 interface{}, e2 interface{}, msgAndArgs ...inter
|
||||
return compareTwoValues(t, e1, e2, []CompareType{compareLess, compareEqual}, "\"%v\" is not less than or equal to \"%v\"", msgAndArgs)
|
||||
}
|
||||
|
||||
// Positive asserts that the specified element is positive
|
||||
//
|
||||
// assert.Positive(t, 1)
|
||||
// assert.Positive(t, 1.23)
|
||||
func Positive(t TestingT, e interface{}, msgAndArgs ...interface{}) bool {
|
||||
zero := reflect.Zero(reflect.TypeOf(e))
|
||||
return compareTwoValues(t, e, zero.Interface(), []CompareType{compareGreater}, "\"%v\" is not positive", msgAndArgs)
|
||||
}
|
||||
|
||||
// Negative asserts that the specified element is negative
|
||||
//
|
||||
// assert.Negative(t, -1)
|
||||
// assert.Negative(t, -1.23)
|
||||
func Negative(t TestingT, e interface{}, msgAndArgs ...interface{}) bool {
|
||||
zero := reflect.Zero(reflect.TypeOf(e))
|
||||
return compareTwoValues(t, e, zero.Interface(), []CompareType{compareLess}, "\"%v\" is not negative", msgAndArgs)
|
||||
}
|
||||
|
||||
func compareTwoValues(t TestingT, e1 interface{}, e2 interface{}, allowedComparesResults []CompareType, failMessage string, msgAndArgs ...interface{}) bool {
|
||||
if h, ok := t.(tHelper); ok {
|
||||
h.Helper()
|
||||
|
97
vendor/github.com/stretchr/testify/assert/assertion_format.go
generated
vendored
97
vendor/github.com/stretchr/testify/assert/assertion_format.go
generated
vendored
@ -114,6 +114,24 @@ func Errorf(t TestingT, err error, msg string, args ...interface{}) bool {
|
||||
return Error(t, err, append([]interface{}{msg}, args...)...)
|
||||
}
|
||||
|
||||
// ErrorAsf asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value.
|
||||
// This is a wrapper for errors.As.
|
||||
func ErrorAsf(t TestingT, err error, target interface{}, msg string, args ...interface{}) bool {
|
||||
if h, ok := t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
return ErrorAs(t, err, target, append([]interface{}{msg}, args...)...)
|
||||
}
|
||||
|
||||
// ErrorIsf asserts that at least one of the errors in err's chain matches target.
|
||||
// This is a wrapper for errors.Is.
|
||||
func ErrorIsf(t TestingT, err error, target error, msg string, args ...interface{}) bool {
|
||||
if h, ok := t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
return ErrorIs(t, err, target, append([]interface{}{msg}, args...)...)
|
||||
}
|
||||
|
||||
// Eventuallyf asserts that given condition will be met in waitFor time,
|
||||
// periodically checking target function each tick.
|
||||
//
|
||||
@ -321,6 +339,54 @@ func InEpsilonSlicef(t TestingT, expected interface{}, actual interface{}, epsil
|
||||
return InEpsilonSlice(t, expected, actual, epsilon, append([]interface{}{msg}, args...)...)
|
||||
}
|
||||
|
||||
// IsDecreasingf asserts that the collection is decreasing
|
||||
//
|
||||
// assert.IsDecreasingf(t, []int{2, 1, 0}, "error message %s", "formatted")
|
||||
// assert.IsDecreasingf(t, []float{2, 1}, "error message %s", "formatted")
|
||||
// assert.IsDecreasingf(t, []string{"b", "a"}, "error message %s", "formatted")
|
||||
func IsDecreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
|
||||
if h, ok := t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
return IsDecreasing(t, object, append([]interface{}{msg}, args...)...)
|
||||
}
|
||||
|
||||
// IsIncreasingf asserts that the collection is increasing
|
||||
//
|
||||
// assert.IsIncreasingf(t, []int{1, 2, 3}, "error message %s", "formatted")
|
||||
// assert.IsIncreasingf(t, []float{1, 2}, "error message %s", "formatted")
|
||||
// assert.IsIncreasingf(t, []string{"a", "b"}, "error message %s", "formatted")
|
||||
func IsIncreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
|
||||
if h, ok := t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
return IsIncreasing(t, object, append([]interface{}{msg}, args...)...)
|
||||
}
|
||||
|
||||
// IsNonDecreasingf asserts that the collection is not decreasing
|
||||
//
|
||||
// assert.IsNonDecreasingf(t, []int{1, 1, 2}, "error message %s", "formatted")
|
||||
// assert.IsNonDecreasingf(t, []float{1, 2}, "error message %s", "formatted")
|
||||
// assert.IsNonDecreasingf(t, []string{"a", "b"}, "error message %s", "formatted")
|
||||
func IsNonDecreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
|
||||
if h, ok := t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
return IsNonDecreasing(t, object, append([]interface{}{msg}, args...)...)
|
||||
}
|
||||
|
||||
// IsNonIncreasingf asserts that the collection is not increasing
|
||||
//
|
||||
// assert.IsNonIncreasingf(t, []int{2, 1, 1}, "error message %s", "formatted")
|
||||
// assert.IsNonIncreasingf(t, []float{2, 1}, "error message %s", "formatted")
|
||||
// assert.IsNonIncreasingf(t, []string{"b", "a"}, "error message %s", "formatted")
|
||||
func IsNonIncreasingf(t TestingT, object interface{}, msg string, args ...interface{}) bool {
|
||||
if h, ok := t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
return IsNonIncreasing(t, object, append([]interface{}{msg}, args...)...)
|
||||
}
|
||||
|
||||
// IsTypef asserts that the specified objects are of the same type.
|
||||
func IsTypef(t TestingT, expectedType interface{}, object interface{}, msg string, args ...interface{}) bool {
|
||||
if h, ok := t.(tHelper); ok {
|
||||
@ -375,6 +441,17 @@ func LessOrEqualf(t TestingT, e1 interface{}, e2 interface{}, msg string, args .
|
||||
return LessOrEqual(t, e1, e2, append([]interface{}{msg}, args...)...)
|
||||
}
|
||||
|
||||
// Negativef asserts that the specified element is negative
|
||||
//
|
||||
// assert.Negativef(t, -1, "error message %s", "formatted")
|
||||
// assert.Negativef(t, -1.23, "error message %s", "formatted")
|
||||
func Negativef(t TestingT, e interface{}, msg string, args ...interface{}) bool {
|
||||
if h, ok := t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
return Negative(t, e, append([]interface{}{msg}, args...)...)
|
||||
}
|
||||
|
||||
// Neverf asserts that the given condition doesn't satisfy in waitFor time,
|
||||
// periodically checking the target function each tick.
|
||||
//
|
||||
@ -476,6 +553,15 @@ func NotEqualValuesf(t TestingT, expected interface{}, actual interface{}, msg s
|
||||
return NotEqualValues(t, expected, actual, append([]interface{}{msg}, args...)...)
|
||||
}
|
||||
|
||||
// NotErrorIsf asserts that at none of the errors in err's chain matches target.
|
||||
// This is a wrapper for errors.Is.
|
||||
func NotErrorIsf(t TestingT, err error, target error, msg string, args ...interface{}) bool {
|
||||
if h, ok := t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
return NotErrorIs(t, err, target, append([]interface{}{msg}, args...)...)
|
||||
}
|
||||
|
||||
// NotNilf asserts that the specified object is not nil.
|
||||
//
|
||||
// assert.NotNilf(t, err, "error message %s", "formatted")
|
||||
@ -572,6 +658,17 @@ func PanicsWithValuef(t TestingT, expected interface{}, f PanicTestFunc, msg str
|
||||
return PanicsWithValue(t, expected, f, append([]interface{}{msg}, args...)...)
|
||||
}
|
||||
|
||||
// Positivef asserts that the specified element is positive
|
||||
//
|
||||
// assert.Positivef(t, 1, "error message %s", "formatted")
|
||||
// assert.Positivef(t, 1.23, "error message %s", "formatted")
|
||||
func Positivef(t TestingT, e interface{}, msg string, args ...interface{}) bool {
|
||||
if h, ok := t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
return Positive(t, e, append([]interface{}{msg}, args...)...)
|
||||
}
|
||||
|
||||
// Regexpf asserts that a specified regexp matches a string.
|
||||
//
|
||||
// assert.Regexpf(t, regexp.MustCompile("start"), "it's starting", "error message %s", "formatted")
|
||||
|
194
vendor/github.com/stretchr/testify/assert/assertion_forward.go
generated
vendored
194
vendor/github.com/stretchr/testify/assert/assertion_forward.go
generated
vendored
@ -204,6 +204,42 @@ func (a *Assertions) Error(err error, msgAndArgs ...interface{}) bool {
|
||||
return Error(a.t, err, msgAndArgs...)
|
||||
}
|
||||
|
||||
// ErrorAs asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value.
|
||||
// This is a wrapper for errors.As.
|
||||
func (a *Assertions) ErrorAs(err error, target interface{}, msgAndArgs ...interface{}) bool {
|
||||
if h, ok := a.t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
return ErrorAs(a.t, err, target, msgAndArgs...)
|
||||
}
|
||||
|
||||
// ErrorAsf asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value.
|
||||
// This is a wrapper for errors.As.
|
||||
func (a *Assertions) ErrorAsf(err error, target interface{}, msg string, args ...interface{}) bool {
|
||||
if h, ok := a.t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
return ErrorAsf(a.t, err, target, msg, args...)
|
||||
}
|
||||
|
||||
// ErrorIs asserts that at least one of the errors in err's chain matches target.
|
||||
// This is a wrapper for errors.Is.
|
||||
func (a *Assertions) ErrorIs(err error, target error, msgAndArgs ...interface{}) bool {
|
||||
if h, ok := a.t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
return ErrorIs(a.t, err, target, msgAndArgs...)
|
||||
}
|
||||
|
||||
// ErrorIsf asserts that at least one of the errors in err's chain matches target.
|
||||
// This is a wrapper for errors.Is.
|
||||
func (a *Assertions) ErrorIsf(err error, target error, msg string, args ...interface{}) bool {
|
||||
if h, ok := a.t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
return ErrorIsf(a.t, err, target, msg, args...)
|
||||
}
|
||||
|
||||
// Errorf asserts that a function returned an error (i.e. not `nil`).
|
||||
//
|
||||
// actualObj, err := SomeFunction()
|
||||
@ -631,6 +667,102 @@ func (a *Assertions) InEpsilonf(expected interface{}, actual interface{}, epsilo
|
||||
return InEpsilonf(a.t, expected, actual, epsilon, msg, args...)
|
||||
}
|
||||
|
||||
// IsDecreasing asserts that the collection is decreasing
|
||||
//
|
||||
// a.IsDecreasing([]int{2, 1, 0})
|
||||
// a.IsDecreasing([]float{2, 1})
|
||||
// a.IsDecreasing([]string{"b", "a"})
|
||||
func (a *Assertions) IsDecreasing(object interface{}, msgAndArgs ...interface{}) bool {
|
||||
if h, ok := a.t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
return IsDecreasing(a.t, object, msgAndArgs...)
|
||||
}
|
||||
|
||||
// IsDecreasingf asserts that the collection is decreasing
|
||||
//
|
||||
// a.IsDecreasingf([]int{2, 1, 0}, "error message %s", "formatted")
|
||||
// a.IsDecreasingf([]float{2, 1}, "error message %s", "formatted")
|
||||
// a.IsDecreasingf([]string{"b", "a"}, "error message %s", "formatted")
|
||||
func (a *Assertions) IsDecreasingf(object interface{}, msg string, args ...interface{}) bool {
|
||||
if h, ok := a.t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
return IsDecreasingf(a.t, object, msg, args...)
|
||||
}
|
||||
|
||||
// IsIncreasing asserts that the collection is increasing
|
||||
//
|
||||
// a.IsIncreasing([]int{1, 2, 3})
|
||||
// a.IsIncreasing([]float{1, 2})
|
||||
// a.IsIncreasing([]string{"a", "b"})
|
||||
func (a *Assertions) IsIncreasing(object interface{}, msgAndArgs ...interface{}) bool {
|
||||
if h, ok := a.t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
return IsIncreasing(a.t, object, msgAndArgs...)
|
||||
}
|
||||
|
||||
// IsIncreasingf asserts that the collection is increasing
|
||||
//
|
||||
// a.IsIncreasingf([]int{1, 2, 3}, "error message %s", "formatted")
|
||||
// a.IsIncreasingf([]float{1, 2}, "error message %s", "formatted")
|
||||
// a.IsIncreasingf([]string{"a", "b"}, "error message %s", "formatted")
|
||||
func (a *Assertions) IsIncreasingf(object interface{}, msg string, args ...interface{}) bool {
|
||||
if h, ok := a.t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
return IsIncreasingf(a.t, object, msg, args...)
|
||||
}
|
||||
|
||||
// IsNonDecreasing asserts that the collection is not decreasing
|
||||
//
|
||||
// a.IsNonDecreasing([]int{1, 1, 2})
|
||||
// a.IsNonDecreasing([]float{1, 2})
|
||||
// a.IsNonDecreasing([]string{"a", "b"})
|
||||
func (a *Assertions) IsNonDecreasing(object interface{}, msgAndArgs ...interface{}) bool {
|
||||
if h, ok := a.t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
return IsNonDecreasing(a.t, object, msgAndArgs...)
|
||||
}
|
||||
|
||||
// IsNonDecreasingf asserts that the collection is not decreasing
|
||||
//
|
||||
// a.IsNonDecreasingf([]int{1, 1, 2}, "error message %s", "formatted")
|
||||
// a.IsNonDecreasingf([]float{1, 2}, "error message %s", "formatted")
|
||||
// a.IsNonDecreasingf([]string{"a", "b"}, "error message %s", "formatted")
|
||||
func (a *Assertions) IsNonDecreasingf(object interface{}, msg string, args ...interface{}) bool {
|
||||
if h, ok := a.t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
return IsNonDecreasingf(a.t, object, msg, args...)
|
||||
}
|
||||
|
||||
// IsNonIncreasing asserts that the collection is not increasing
|
||||
//
|
||||
// a.IsNonIncreasing([]int{2, 1, 1})
|
||||
// a.IsNonIncreasing([]float{2, 1})
|
||||
// a.IsNonIncreasing([]string{"b", "a"})
|
||||
func (a *Assertions) IsNonIncreasing(object interface{}, msgAndArgs ...interface{}) bool {
|
||||
if h, ok := a.t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
return IsNonIncreasing(a.t, object, msgAndArgs...)
|
||||
}
|
||||
|
||||
// IsNonIncreasingf asserts that the collection is not increasing
|
||||
//
|
||||
// a.IsNonIncreasingf([]int{2, 1, 1}, "error message %s", "formatted")
|
||||
// a.IsNonIncreasingf([]float{2, 1}, "error message %s", "formatted")
|
||||
// a.IsNonIncreasingf([]string{"b", "a"}, "error message %s", "formatted")
|
||||
func (a *Assertions) IsNonIncreasingf(object interface{}, msg string, args ...interface{}) bool {
|
||||
if h, ok := a.t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
return IsNonIncreasingf(a.t, object, msg, args...)
|
||||
}
|
||||
|
||||
// IsType asserts that the specified objects are of the same type.
|
||||
func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool {
|
||||
if h, ok := a.t.(tHelper); ok {
|
||||
@ -739,6 +871,28 @@ func (a *Assertions) Lessf(e1 interface{}, e2 interface{}, msg string, args ...i
|
||||
return Lessf(a.t, e1, e2, msg, args...)
|
||||
}
|
||||
|
||||
// Negative asserts that the specified element is negative
|
||||
//
|
||||
// a.Negative(-1)
|
||||
// a.Negative(-1.23)
|
||||
func (a *Assertions) Negative(e interface{}, msgAndArgs ...interface{}) bool {
|
||||
if h, ok := a.t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
return Negative(a.t, e, msgAndArgs...)
|
||||
}
|
||||
|
||||
// Negativef asserts that the specified element is negative
|
||||
//
|
||||
// a.Negativef(-1, "error message %s", "formatted")
|
||||
// a.Negativef(-1.23, "error message %s", "formatted")
|
||||
func (a *Assertions) Negativef(e interface{}, msg string, args ...interface{}) bool {
|
||||
if h, ok := a.t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
return Negativef(a.t, e, msg, args...)
|
||||
}
|
||||
|
||||
// Never asserts that the given condition doesn't satisfy in waitFor time,
|
||||
// periodically checking the target function each tick.
|
||||
//
|
||||
@ -941,6 +1095,24 @@ func (a *Assertions) NotEqualf(expected interface{}, actual interface{}, msg str
|
||||
return NotEqualf(a.t, expected, actual, msg, args...)
|
||||
}
|
||||
|
||||
// NotErrorIs asserts that at none of the errors in err's chain matches target.
|
||||
// This is a wrapper for errors.Is.
|
||||
func (a *Assertions) NotErrorIs(err error, target error, msgAndArgs ...interface{}) bool {
|
||||
if h, ok := a.t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
return NotErrorIs(a.t, err, target, msgAndArgs...)
|
||||
}
|
||||
|
||||
// NotErrorIsf asserts that at none of the errors in err's chain matches target.
|
||||
// This is a wrapper for errors.Is.
|
||||
func (a *Assertions) NotErrorIsf(err error, target error, msg string, args ...interface{}) bool {
|
||||
if h, ok := a.t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
return NotErrorIsf(a.t, err, target, msg, args...)
|
||||
}
|
||||
|
||||
// NotNil asserts that the specified object is not nil.
|
||||
//
|
||||
// a.NotNil(err)
|
||||
@ -1133,6 +1305,28 @@ func (a *Assertions) Panicsf(f PanicTestFunc, msg string, args ...interface{}) b
|
||||
return Panicsf(a.t, f, msg, args...)
|
||||
}
|
||||
|
||||
// Positive asserts that the specified element is positive
|
||||
//
|
||||
// a.Positive(1)
|
||||
// a.Positive(1.23)
|
||||
func (a *Assertions) Positive(e interface{}, msgAndArgs ...interface{}) bool {
|
||||
if h, ok := a.t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
return Positive(a.t, e, msgAndArgs...)
|
||||
}
|
||||
|
||||
// Positivef asserts that the specified element is positive
|
||||
//
|
||||
// a.Positivef(1, "error message %s", "formatted")
|
||||
// a.Positivef(1.23, "error message %s", "formatted")
|
||||
func (a *Assertions) Positivef(e interface{}, msg string, args ...interface{}) bool {
|
||||
if h, ok := a.t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
return Positivef(a.t, e, msg, args...)
|
||||
}
|
||||
|
||||
// Regexp asserts that a specified regexp matches a string.
|
||||
//
|
||||
// a.Regexp(regexp.MustCompile("start"), "it's starting")
|
||||
|
81
vendor/github.com/stretchr/testify/assert/assertion_order.go
generated
vendored
Normal file
81
vendor/github.com/stretchr/testify/assert/assertion_order.go
generated
vendored
Normal file
@ -0,0 +1,81 @@
|
||||
package assert
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"reflect"
|
||||
)
|
||||
|
||||
// isOrdered checks that collection contains orderable elements.
|
||||
func isOrdered(t TestingT, object interface{}, allowedComparesResults []CompareType, failMessage string, msgAndArgs ...interface{}) bool {
|
||||
objKind := reflect.TypeOf(object).Kind()
|
||||
if objKind != reflect.Slice && objKind != reflect.Array {
|
||||
return false
|
||||
}
|
||||
|
||||
objValue := reflect.ValueOf(object)
|
||||
objLen := objValue.Len()
|
||||
|
||||
if objLen <= 1 {
|
||||
return true
|
||||
}
|
||||
|
||||
value := objValue.Index(0)
|
||||
valueInterface := value.Interface()
|
||||
firstValueKind := value.Kind()
|
||||
|
||||
for i := 1; i < objLen; i++ {
|
||||
prevValue := value
|
||||
prevValueInterface := valueInterface
|
||||
|
||||
value = objValue.Index(i)
|
||||
valueInterface = value.Interface()
|
||||
|
||||
compareResult, isComparable := compare(prevValueInterface, valueInterface, firstValueKind)
|
||||
|
||||
if !isComparable {
|
||||
return Fail(t, fmt.Sprintf("Can not compare type \"%s\" and \"%s\"", reflect.TypeOf(value), reflect.TypeOf(prevValue)), msgAndArgs...)
|
||||
}
|
||||
|
||||
if !containsValue(allowedComparesResults, compareResult) {
|
||||
return Fail(t, fmt.Sprintf(failMessage, prevValue, value), msgAndArgs...)
|
||||
}
|
||||
}
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
// IsIncreasing asserts that the collection is increasing
|
||||
//
|
||||
// assert.IsIncreasing(t, []int{1, 2, 3})
|
||||
// assert.IsIncreasing(t, []float{1, 2})
|
||||
// assert.IsIncreasing(t, []string{"a", "b"})
|
||||
func IsIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
|
||||
return isOrdered(t, object, []CompareType{compareLess}, "\"%v\" is not less than \"%v\"", msgAndArgs)
|
||||
}
|
||||
|
||||
// IsNonIncreasing asserts that the collection is not increasing
|
||||
//
|
||||
// assert.IsNonIncreasing(t, []int{2, 1, 1})
|
||||
// assert.IsNonIncreasing(t, []float{2, 1})
|
||||
// assert.IsNonIncreasing(t, []string{"b", "a"})
|
||||
func IsNonIncreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
|
||||
return isOrdered(t, object, []CompareType{compareEqual, compareGreater}, "\"%v\" is not greater than or equal to \"%v\"", msgAndArgs)
|
||||
}
|
||||
|
||||
// IsDecreasing asserts that the collection is decreasing
|
||||
//
|
||||
// assert.IsDecreasing(t, []int{2, 1, 0})
|
||||
// assert.IsDecreasing(t, []float{2, 1})
|
||||
// assert.IsDecreasing(t, []string{"b", "a"})
|
||||
func IsDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
|
||||
return isOrdered(t, object, []CompareType{compareGreater}, "\"%v\" is not greater than \"%v\"", msgAndArgs)
|
||||
}
|
||||
|
||||
// IsNonDecreasing asserts that the collection is not decreasing
|
||||
//
|
||||
// assert.IsNonDecreasing(t, []int{1, 1, 2})
|
||||
// assert.IsNonDecreasing(t, []float{1, 2})
|
||||
// assert.IsNonDecreasing(t, []string{"a", "b"})
|
||||
func IsNonDecreasing(t TestingT, object interface{}, msgAndArgs ...interface{}) bool {
|
||||
return isOrdered(t, object, []CompareType{compareLess, compareEqual}, "\"%v\" is not less than or equal to \"%v\"", msgAndArgs)
|
||||
}
|
83
vendor/github.com/stretchr/testify/assert/assertions.go
generated
vendored
83
vendor/github.com/stretchr/testify/assert/assertions.go
generated
vendored
@ -172,8 +172,8 @@ func isTest(name, prefix string) bool {
|
||||
if len(name) == len(prefix) { // "Test" is ok
|
||||
return true
|
||||
}
|
||||
rune, _ := utf8.DecodeRuneInString(name[len(prefix):])
|
||||
return !unicode.IsLower(rune)
|
||||
r, _ := utf8.DecodeRuneInString(name[len(prefix):])
|
||||
return !unicode.IsLower(r)
|
||||
}
|
||||
|
||||
func messageFromMsgAndArgs(msgAndArgs ...interface{}) string {
|
||||
@ -1622,6 +1622,7 @@ var spewConfig = spew.ConfigState{
|
||||
DisableCapacities: true,
|
||||
SortKeys: true,
|
||||
DisableMethods: true,
|
||||
MaxDepth: 10,
|
||||
}
|
||||
|
||||
type tHelper interface {
|
||||
@ -1693,3 +1694,81 @@ func Never(t TestingT, condition func() bool, waitFor time.Duration, tick time.D
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ErrorIs asserts that at least one of the errors in err's chain matches target.
|
||||
// This is a wrapper for errors.Is.
|
||||
func ErrorIs(t TestingT, err, target error, msgAndArgs ...interface{}) bool {
|
||||
if h, ok := t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
if errors.Is(err, target) {
|
||||
return true
|
||||
}
|
||||
|
||||
var expectedText string
|
||||
if target != nil {
|
||||
expectedText = target.Error()
|
||||
}
|
||||
|
||||
chain := buildErrorChainString(err)
|
||||
|
||||
return Fail(t, fmt.Sprintf("Target error should be in err chain:\n"+
|
||||
"expected: %q\n"+
|
||||
"in chain: %s", expectedText, chain,
|
||||
), msgAndArgs...)
|
||||
}
|
||||
|
||||
// NotErrorIs asserts that at none of the errors in err's chain matches target.
|
||||
// This is a wrapper for errors.Is.
|
||||
func NotErrorIs(t TestingT, err, target error, msgAndArgs ...interface{}) bool {
|
||||
if h, ok := t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
if !errors.Is(err, target) {
|
||||
return true
|
||||
}
|
||||
|
||||
var expectedText string
|
||||
if target != nil {
|
||||
expectedText = target.Error()
|
||||
}
|
||||
|
||||
chain := buildErrorChainString(err)
|
||||
|
||||
return Fail(t, fmt.Sprintf("Target error should not be in err chain:\n"+
|
||||
"found: %q\n"+
|
||||
"in chain: %s", expectedText, chain,
|
||||
), msgAndArgs...)
|
||||
}
|
||||
|
||||
// ErrorAs asserts that at least one of the errors in err's chain matches target, and if so, sets target to that error value.
|
||||
// This is a wrapper for errors.As.
|
||||
func ErrorAs(t TestingT, err error, target interface{}, msgAndArgs ...interface{}) bool {
|
||||
if h, ok := t.(tHelper); ok {
|
||||
h.Helper()
|
||||
}
|
||||
if errors.As(err, target) {
|
||||
return true
|
||||
}
|
||||
|
||||
chain := buildErrorChainString(err)
|
||||
|
||||
return Fail(t, fmt.Sprintf("Should be in error chain:\n"+
|
||||
"expected: %q\n"+
|
||||
"in chain: %s", target, chain,
|
||||
), msgAndArgs...)
|
||||
}
|
||||
|
||||
func buildErrorChainString(err error) string {
|
||||
if err == nil {
|
||||
return ""
|
||||
}
|
||||
|
||||
e := errors.Unwrap(err)
|
||||
chain := fmt.Sprintf("%q", err.Error())
|
||||
for e != nil {
|
||||
chain += fmt.Sprintf("\n\t%q", e.Error())
|
||||
e = errors.Unwrap(e)
|
||||
}
|
||||
return chain
|
||||
}
|
||||
|
7
vendor/golang.org/x/sys/unix/mkerrors.sh
generated
vendored
7
vendor/golang.org/x/sys/unix/mkerrors.sh
generated
vendored
@ -54,7 +54,7 @@ includes_AIX='
|
||||
|
||||
includes_Darwin='
|
||||
#define _DARWIN_C_SOURCE
|
||||
#define KERNEL
|
||||
#define KERNEL 1
|
||||
#define _DARWIN_USE_64_BIT_INODE
|
||||
#define __APPLE_USE_RFC_3542
|
||||
#include <stdint.h>
|
||||
@ -75,6 +75,7 @@ includes_Darwin='
|
||||
#include <sys/utsname.h>
|
||||
#include <sys/wait.h>
|
||||
#include <sys/xattr.h>
|
||||
#include <sys/vsock.h>
|
||||
#include <net/bpf.h>
|
||||
#include <net/if.h>
|
||||
#include <net/if_types.h>
|
||||
@ -82,6 +83,9 @@ includes_Darwin='
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <termios.h>
|
||||
|
||||
// for backwards compatibility because moved TIOCREMOTE to Kernel.framework after MacOSX12.0.sdk.
|
||||
#define TIOCREMOTE 0x80047469
|
||||
'
|
||||
|
||||
includes_DragonFly='
|
||||
@ -466,7 +470,6 @@ ccflags="$@"
|
||||
$2 !~ /^EQUIV_/ &&
|
||||
$2 !~ /^EXPR_/ &&
|
||||
$2 !~ /^EVIOC/ &&
|
||||
$2 !~ /^EV_/ &&
|
||||
$2 ~ /^E[A-Z0-9_]+$/ ||
|
||||
$2 ~ /^B[0-9_]+$/ ||
|
||||
$2 ~ /^(OLD|NEW)DEV$/ ||
|
||||
|
40
vendor/golang.org/x/sys/unix/syscall_darwin.go
generated
vendored
40
vendor/golang.org/x/sys/unix/syscall_darwin.go
generated
vendored
@ -48,6 +48,30 @@ func (sa *SockaddrCtl) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrCtl, nil
|
||||
}
|
||||
|
||||
// SockaddrVM implements the Sockaddr interface for AF_VSOCK type sockets.
|
||||
// SockaddrVM provides access to Darwin VM sockets: a mechanism that enables
|
||||
// bidirectional communication between a hypervisor and its guest virtual
|
||||
// machines.
|
||||
type SockaddrVM struct {
|
||||
// CID and Port specify a context ID and port address for a VM socket.
|
||||
// Guests have a unique CID, and hosts may have a well-known CID of:
|
||||
// - VMADDR_CID_HYPERVISOR: refers to the hypervisor process.
|
||||
// - VMADDR_CID_LOCAL: refers to local communication (loopback).
|
||||
// - VMADDR_CID_HOST: refers to other processes on the host.
|
||||
CID uint32
|
||||
Port uint32
|
||||
raw RawSockaddrVM
|
||||
}
|
||||
|
||||
func (sa *SockaddrVM) sockaddr() (unsafe.Pointer, _Socklen, error) {
|
||||
sa.raw.Len = SizeofSockaddrVM
|
||||
sa.raw.Family = AF_VSOCK
|
||||
sa.raw.Port = sa.Port
|
||||
sa.raw.Cid = sa.CID
|
||||
|
||||
return unsafe.Pointer(&sa.raw), SizeofSockaddrVM, nil
|
||||
}
|
||||
|
||||
func anyToSockaddrGOOS(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||
switch rsa.Addr.Family {
|
||||
case AF_SYSTEM:
|
||||
@ -58,6 +82,13 @@ func anyToSockaddrGOOS(fd int, rsa *RawSockaddrAny) (Sockaddr, error) {
|
||||
sa.Unit = pp.Sc_unit
|
||||
return sa, nil
|
||||
}
|
||||
case AF_VSOCK:
|
||||
pp := (*RawSockaddrVM)(unsafe.Pointer(rsa))
|
||||
sa := &SockaddrVM{
|
||||
CID: pp.Cid,
|
||||
Port: pp.Port,
|
||||
}
|
||||
return sa, nil
|
||||
}
|
||||
return nil, EAFNOSUPPORT
|
||||
}
|
||||
@ -433,6 +464,11 @@ func SysctlKinfoProcSlice(name string) ([]KinfoProc, error) {
|
||||
|
||||
//sys sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error)
|
||||
|
||||
//sys shmat(id int, addr uintptr, flag int) (ret uintptr, err error)
|
||||
//sys shmctl(id int, cmd int, buf *SysvShmDesc) (result int, err error)
|
||||
//sys shmdt(addr uintptr) (err error)
|
||||
//sys shmget(key int, size int, flag int) (id int, err error)
|
||||
|
||||
/*
|
||||
* Exposed directly
|
||||
*/
|
||||
@ -590,10 +626,6 @@ func SysctlKinfoProcSlice(name string) ([]KinfoProc, error) {
|
||||
// Msgget
|
||||
// Msgsnd
|
||||
// Msgrcv
|
||||
// Shmat
|
||||
// Shmctl
|
||||
// Shmdt
|
||||
// Shmget
|
||||
// Shm_open
|
||||
// Shm_unlink
|
||||
// Sem_open
|
||||
|
9
vendor/golang.org/x/sys/unix/syscall_linux.go
generated
vendored
9
vendor/golang.org/x/sys/unix/syscall_linux.go
generated
vendored
@ -2319,6 +2319,11 @@ type RemoteIovec struct {
|
||||
//sys PidfdOpen(pid int, flags int) (fd int, err error) = SYS_PIDFD_OPEN
|
||||
//sys PidfdGetfd(pidfd int, targetfd int, flags int) (fd int, err error) = SYS_PIDFD_GETFD
|
||||
|
||||
//sys shmat(id int, addr uintptr, flag int) (ret uintptr, err error)
|
||||
//sys shmctl(id int, cmd int, buf *SysvShmDesc) (result int, err error)
|
||||
//sys shmdt(addr uintptr) (err error)
|
||||
//sys shmget(key int, size int, flag int) (id int, err error)
|
||||
|
||||
/*
|
||||
* Unimplemented
|
||||
*/
|
||||
@ -2400,10 +2405,6 @@ type RemoteIovec struct {
|
||||
// SetRobustList
|
||||
// SetThreadArea
|
||||
// SetTidAddress
|
||||
// Shmat
|
||||
// Shmctl
|
||||
// Shmdt
|
||||
// Shmget
|
||||
// Sigaltstack
|
||||
// Swapoff
|
||||
// Swapon
|
||||
|
21
vendor/golang.org/x/sys/unix/sysvshm_linux.go
generated
vendored
Normal file
21
vendor/golang.org/x/sys/unix/sysvshm_linux.go
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
// Copyright 2021 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build linux
|
||||
// +build linux
|
||||
|
||||
package unix
|
||||
|
||||
import "runtime"
|
||||
|
||||
// SysvShmCtl performs control operations on the shared memory segment
|
||||
// specified by id.
|
||||
func SysvShmCtl(id, cmd int, desc *SysvShmDesc) (result int, err error) {
|
||||
if runtime.GOARCH == "arm" ||
|
||||
runtime.GOARCH == "mips64" || runtime.GOARCH == "mips64le" {
|
||||
cmd |= ipc_64
|
||||
}
|
||||
|
||||
return shmctl(id, cmd, desc)
|
||||
}
|
61
vendor/golang.org/x/sys/unix/sysvshm_unix.go
generated
vendored
Normal file
61
vendor/golang.org/x/sys/unix/sysvshm_unix.go
generated
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
// Copyright 2021 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build (darwin && !ios) || linux
|
||||
// +build darwin,!ios linux
|
||||
|
||||
package unix
|
||||
|
||||
import (
|
||||
"unsafe"
|
||||
|
||||
"golang.org/x/sys/internal/unsafeheader"
|
||||
)
|
||||
|
||||
// SysvShmAttach attaches the Sysv shared memory segment associated with the
|
||||
// shared memory identifier id.
|
||||
func SysvShmAttach(id int, addr uintptr, flag int) ([]byte, error) {
|
||||
addr, errno := shmat(id, addr, flag)
|
||||
if errno != nil {
|
||||
return nil, errno
|
||||
}
|
||||
|
||||
// Retrieve the size of the shared memory to enable slice creation
|
||||
var info SysvShmDesc
|
||||
|
||||
_, err := SysvShmCtl(id, IPC_STAT, &info)
|
||||
if err != nil {
|
||||
// release the shared memory if we can't find the size
|
||||
|
||||
// ignoring error from shmdt as there's nothing sensible to return here
|
||||
shmdt(addr)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
// Use unsafe to convert addr into a []byte.
|
||||
// TODO: convert to unsafe.Slice once we can assume Go 1.17
|
||||
var b []byte
|
||||
hdr := (*unsafeheader.Slice)(unsafe.Pointer(&b))
|
||||
hdr.Data = unsafe.Pointer(addr)
|
||||
hdr.Cap = int(info.Segsz)
|
||||
hdr.Len = int(info.Segsz)
|
||||
return b, nil
|
||||
}
|
||||
|
||||
// SysvShmDetach unmaps the shared memory slice returned from SysvShmAttach.
|
||||
//
|
||||
// It is not safe to use the slice after calling this function.
|
||||
func SysvShmDetach(data []byte) error {
|
||||
if len(data) == 0 {
|
||||
return EINVAL
|
||||
}
|
||||
|
||||
return shmdt(uintptr(unsafe.Pointer(&data[0])))
|
||||
}
|
||||
|
||||
// SysvShmGet returns the Sysv shared memory identifier associated with key.
|
||||
// If the IPC_CREAT flag is specified a new segment is created.
|
||||
func SysvShmGet(key, size, flag int) (id int, err error) {
|
||||
return shmget(key, size, flag)
|
||||
}
|
14
vendor/golang.org/x/sys/unix/sysvshm_unix_other.go
generated
vendored
Normal file
14
vendor/golang.org/x/sys/unix/sysvshm_unix_other.go
generated
vendored
Normal file
@ -0,0 +1,14 @@
|
||||
// Copyright 2021 The Go Authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
//go:build darwin && !ios
|
||||
// +build darwin,!ios
|
||||
|
||||
package unix
|
||||
|
||||
// SysvShmCtl performs control operations on the shared memory segment
|
||||
// specified by id.
|
||||
func SysvShmCtl(id, cmd int, desc *SysvShmDesc) (result int, err error) {
|
||||
return shmctl(id, cmd, desc)
|
||||
}
|
3126
vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go
generated
vendored
3126
vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go
generated
vendored
File diff suppressed because it is too large
Load Diff
3126
vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go
generated
vendored
3126
vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go
generated
vendored
File diff suppressed because it is too large
Load Diff
2
vendor/golang.org/x/sys/unix/zerrors_linux.go
generated
vendored
2
vendor/golang.org/x/sys/unix/zerrors_linux.go
generated
vendored
@ -1397,6 +1397,8 @@ const (
|
||||
MADV_NOHUGEPAGE = 0xf
|
||||
MADV_NORMAL = 0x0
|
||||
MADV_PAGEOUT = 0x15
|
||||
MADV_POPULATE_READ = 0x16
|
||||
MADV_POPULATE_WRITE = 0x17
|
||||
MADV_RANDOM = 0x1
|
||||
MADV_REMOVE = 0x9
|
||||
MADV_SEQUENTIAL = 0x2
|
||||
|
59
vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go
generated
vendored
59
vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go
generated
vendored
@ -734,6 +734,65 @@ var libc_sendfile_trampoline_addr uintptr
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func shmat(id int, addr uintptr, flag int) (ret uintptr, err error) {
|
||||
r0, _, e1 := syscall_syscall(libc_shmat_trampoline_addr, uintptr(id), uintptr(addr), uintptr(flag))
|
||||
ret = uintptr(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
var libc_shmat_trampoline_addr uintptr
|
||||
|
||||
//go:cgo_import_dynamic libc_shmat shmat "/usr/lib/libSystem.B.dylib"
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func shmctl(id int, cmd int, buf *SysvShmDesc) (result int, err error) {
|
||||
r0, _, e1 := syscall_syscall(libc_shmctl_trampoline_addr, uintptr(id), uintptr(cmd), uintptr(unsafe.Pointer(buf)))
|
||||
result = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
var libc_shmctl_trampoline_addr uintptr
|
||||
|
||||
//go:cgo_import_dynamic libc_shmctl shmctl "/usr/lib/libSystem.B.dylib"
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func shmdt(addr uintptr) (err error) {
|
||||
_, _, e1 := syscall_syscall(libc_shmdt_trampoline_addr, uintptr(addr), 0, 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
var libc_shmdt_trampoline_addr uintptr
|
||||
|
||||
//go:cgo_import_dynamic libc_shmdt shmdt "/usr/lib/libSystem.B.dylib"
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func shmget(key int, size int, flag int) (id int, err error) {
|
||||
r0, _, e1 := syscall_syscall(libc_shmget_trampoline_addr, uintptr(key), uintptr(size), uintptr(flag))
|
||||
id = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
var libc_shmget_trampoline_addr uintptr
|
||||
|
||||
//go:cgo_import_dynamic libc_shmget shmget "/usr/lib/libSystem.B.dylib"
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Access(path string, mode uint32) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
|
24
vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s
generated
vendored
24
vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s
generated
vendored
@ -264,6 +264,30 @@ TEXT libc_sendfile_trampoline<>(SB),NOSPLIT,$0-0
|
||||
GLOBL ·libc_sendfile_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_sendfile_trampoline_addr(SB)/8, $libc_sendfile_trampoline<>(SB)
|
||||
|
||||
TEXT libc_shmat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_shmat(SB)
|
||||
|
||||
GLOBL ·libc_shmat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_shmat_trampoline_addr(SB)/8, $libc_shmat_trampoline<>(SB)
|
||||
|
||||
TEXT libc_shmctl_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_shmctl(SB)
|
||||
|
||||
GLOBL ·libc_shmctl_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_shmctl_trampoline_addr(SB)/8, $libc_shmctl_trampoline<>(SB)
|
||||
|
||||
TEXT libc_shmdt_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_shmdt(SB)
|
||||
|
||||
GLOBL ·libc_shmdt_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_shmdt_trampoline_addr(SB)/8, $libc_shmdt_trampoline<>(SB)
|
||||
|
||||
TEXT libc_shmget_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_shmget(SB)
|
||||
|
||||
GLOBL ·libc_shmget_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_shmget_trampoline_addr(SB)/8, $libc_shmget_trampoline<>(SB)
|
||||
|
||||
TEXT libc_access_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_access(SB)
|
||||
|
||||
|
59
vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go
generated
vendored
59
vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go
generated
vendored
@ -734,6 +734,65 @@ var libc_sendfile_trampoline_addr uintptr
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func shmat(id int, addr uintptr, flag int) (ret uintptr, err error) {
|
||||
r0, _, e1 := syscall_syscall(libc_shmat_trampoline_addr, uintptr(id), uintptr(addr), uintptr(flag))
|
||||
ret = uintptr(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
var libc_shmat_trampoline_addr uintptr
|
||||
|
||||
//go:cgo_import_dynamic libc_shmat shmat "/usr/lib/libSystem.B.dylib"
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func shmctl(id int, cmd int, buf *SysvShmDesc) (result int, err error) {
|
||||
r0, _, e1 := syscall_syscall(libc_shmctl_trampoline_addr, uintptr(id), uintptr(cmd), uintptr(unsafe.Pointer(buf)))
|
||||
result = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
var libc_shmctl_trampoline_addr uintptr
|
||||
|
||||
//go:cgo_import_dynamic libc_shmctl shmctl "/usr/lib/libSystem.B.dylib"
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func shmdt(addr uintptr) (err error) {
|
||||
_, _, e1 := syscall_syscall(libc_shmdt_trampoline_addr, uintptr(addr), 0, 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
var libc_shmdt_trampoline_addr uintptr
|
||||
|
||||
//go:cgo_import_dynamic libc_shmdt shmdt "/usr/lib/libSystem.B.dylib"
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func shmget(key int, size int, flag int) (id int, err error) {
|
||||
r0, _, e1 := syscall_syscall(libc_shmget_trampoline_addr, uintptr(key), uintptr(size), uintptr(flag))
|
||||
id = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
var libc_shmget_trampoline_addr uintptr
|
||||
|
||||
//go:cgo_import_dynamic libc_shmget shmget "/usr/lib/libSystem.B.dylib"
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func Access(path string, mode uint32) (err error) {
|
||||
var _p0 *byte
|
||||
_p0, err = BytePtrFromString(path)
|
||||
|
24
vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s
generated
vendored
24
vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s
generated
vendored
@ -264,6 +264,30 @@ TEXT libc_sendfile_trampoline<>(SB),NOSPLIT,$0-0
|
||||
GLOBL ·libc_sendfile_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_sendfile_trampoline_addr(SB)/8, $libc_sendfile_trampoline<>(SB)
|
||||
|
||||
TEXT libc_shmat_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_shmat(SB)
|
||||
|
||||
GLOBL ·libc_shmat_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_shmat_trampoline_addr(SB)/8, $libc_shmat_trampoline<>(SB)
|
||||
|
||||
TEXT libc_shmctl_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_shmctl(SB)
|
||||
|
||||
GLOBL ·libc_shmctl_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_shmctl_trampoline_addr(SB)/8, $libc_shmctl_trampoline<>(SB)
|
||||
|
||||
TEXT libc_shmdt_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_shmdt(SB)
|
||||
|
||||
GLOBL ·libc_shmdt_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_shmdt_trampoline_addr(SB)/8, $libc_shmdt_trampoline<>(SB)
|
||||
|
||||
TEXT libc_shmget_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_shmget(SB)
|
||||
|
||||
GLOBL ·libc_shmget_trampoline_addr(SB), RODATA, $8
|
||||
DATA ·libc_shmget_trampoline_addr(SB)/8, $libc_shmget_trampoline<>(SB)
|
||||
|
||||
TEXT libc_access_trampoline<>(SB),NOSPLIT,$0-0
|
||||
JMP libc_access(SB)
|
||||
|
||||
|
43
vendor/golang.org/x/sys/unix/zsyscall_linux.go
generated
vendored
43
vendor/golang.org/x/sys/unix/zsyscall_linux.go
generated
vendored
@ -1974,3 +1974,46 @@ func PidfdGetfd(pidfd int, targetfd int, flags int) (fd int, err error) {
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func shmat(id int, addr uintptr, flag int) (ret uintptr, err error) {
|
||||
r0, _, e1 := Syscall(SYS_SHMAT, uintptr(id), uintptr(addr), uintptr(flag))
|
||||
ret = uintptr(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func shmctl(id int, cmd int, buf *SysvShmDesc) (result int, err error) {
|
||||
r0, _, e1 := Syscall(SYS_SHMCTL, uintptr(id), uintptr(cmd), uintptr(unsafe.Pointer(buf)))
|
||||
result = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func shmdt(addr uintptr) (err error) {
|
||||
_, _, e1 := Syscall(SYS_SHMDT, uintptr(addr), 0, 0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT
|
||||
|
||||
func shmget(key int, size int, flag int) (id int, err error) {
|
||||
r0, _, e1 := Syscall(SYS_SHMGET, uintptr(key), uintptr(size), uintptr(flag))
|
||||
id = int(r0)
|
||||
if e1 != 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
127
vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go
generated
vendored
127
vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go
generated
vendored
@ -209,6 +209,92 @@ type RawSockaddrCtl struct {
|
||||
Sc_reserved [5]uint32
|
||||
}
|
||||
|
||||
type RawSockaddrVM struct {
|
||||
Len uint8
|
||||
Family uint8
|
||||
Reserved1 uint16
|
||||
Port uint32
|
||||
Cid uint32
|
||||
}
|
||||
|
||||
type XVSockPCB struct {
|
||||
Xv_len uint32
|
||||
Xv_vsockpp uint64
|
||||
Xvp_local_cid uint32
|
||||
Xvp_local_port uint32
|
||||
Xvp_remote_cid uint32
|
||||
Xvp_remote_port uint32
|
||||
Xvp_rxcnt uint32
|
||||
Xvp_txcnt uint32
|
||||
Xvp_peer_rxhiwat uint32
|
||||
Xvp_peer_rxcnt uint32
|
||||
Xvp_last_pid int32
|
||||
Xvp_gencnt uint64
|
||||
Xv_socket XSocket
|
||||
_ [4]byte
|
||||
}
|
||||
|
||||
type XSocket struct {
|
||||
Xso_len uint32
|
||||
Xso_so uint32
|
||||
So_type int16
|
||||
So_options int16
|
||||
So_linger int16
|
||||
So_state int16
|
||||
So_pcb uint32
|
||||
Xso_protocol int32
|
||||
Xso_family int32
|
||||
So_qlen int16
|
||||
So_incqlen int16
|
||||
So_qlimit int16
|
||||
So_timeo int16
|
||||
So_error uint16
|
||||
So_pgid int32
|
||||
So_oobmark uint32
|
||||
So_rcv XSockbuf
|
||||
So_snd XSockbuf
|
||||
So_uid uint32
|
||||
}
|
||||
|
||||
type XSocket64 struct {
|
||||
Xso_len uint32
|
||||
_ [8]byte
|
||||
So_type int16
|
||||
So_options int16
|
||||
So_linger int16
|
||||
So_state int16
|
||||
_ [8]byte
|
||||
Xso_protocol int32
|
||||
Xso_family int32
|
||||
So_qlen int16
|
||||
So_incqlen int16
|
||||
So_qlimit int16
|
||||
So_timeo int16
|
||||
So_error uint16
|
||||
So_pgid int32
|
||||
So_oobmark uint32
|
||||
So_rcv XSockbuf
|
||||
So_snd XSockbuf
|
||||
So_uid uint32
|
||||
}
|
||||
|
||||
type XSockbuf struct {
|
||||
Cc uint32
|
||||
Hiwat uint32
|
||||
Mbcnt uint32
|
||||
Mbmax uint32
|
||||
Lowat int32
|
||||
Flags int16
|
||||
Timeo int16
|
||||
}
|
||||
|
||||
type XVSockPgen struct {
|
||||
Len uint32
|
||||
Count uint64
|
||||
Gen uint64
|
||||
Sogen uint64
|
||||
}
|
||||
|
||||
type _Socklen uint32
|
||||
|
||||
type Xucred struct {
|
||||
@ -287,6 +373,11 @@ const (
|
||||
SizeofSockaddrUnix = 0x6a
|
||||
SizeofSockaddrDatalink = 0x14
|
||||
SizeofSockaddrCtl = 0x20
|
||||
SizeofSockaddrVM = 0xc
|
||||
SizeofXvsockpcb = 0xa8
|
||||
SizeofXSocket = 0x64
|
||||
SizeofXSockbuf = 0x18
|
||||
SizeofXVSockPgen = 0x20
|
||||
SizeofXucred = 0x4c
|
||||
SizeofLinger = 0x8
|
||||
SizeofIovec = 0x10
|
||||
@ -639,3 +730,39 @@ type Ucred struct {
|
||||
Ngroups int16
|
||||
Groups [16]uint32
|
||||
}
|
||||
|
||||
type SysvIpcPerm struct {
|
||||
Uid uint32
|
||||
Gid uint32
|
||||
Cuid uint32
|
||||
Cgid uint32
|
||||
Mode uint16
|
||||
_ uint16
|
||||
_ int32
|
||||
}
|
||||
type SysvShmDesc struct {
|
||||
Perm SysvIpcPerm
|
||||
Segsz uint64
|
||||
Lpid int32
|
||||
Cpid int32
|
||||
Nattch uint16
|
||||
_ [34]byte
|
||||
}
|
||||
|
||||
const (
|
||||
IPC_CREAT = 0x200
|
||||
IPC_EXCL = 0x400
|
||||
IPC_NOWAIT = 0x800
|
||||
IPC_PRIVATE = 0x0
|
||||
)
|
||||
|
||||
const (
|
||||
IPC_RMID = 0x0
|
||||
IPC_SET = 0x1
|
||||
IPC_STAT = 0x2
|
||||
)
|
||||
|
||||
const (
|
||||
SHM_RDONLY = 0x1000
|
||||
SHM_RND = 0x2000
|
||||
)
|
||||
|
127
vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go
generated
vendored
127
vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go
generated
vendored
@ -209,6 +209,92 @@ type RawSockaddrCtl struct {
|
||||
Sc_reserved [5]uint32
|
||||
}
|
||||
|
||||
type RawSockaddrVM struct {
|
||||
Len uint8
|
||||
Family uint8
|
||||
Reserved1 uint16
|
||||
Port uint32
|
||||
Cid uint32
|
||||
}
|
||||
|
||||
type XVSockPCB struct {
|
||||
Xv_len uint32
|
||||
Xv_vsockpp uint64
|
||||
Xvp_local_cid uint32
|
||||
Xvp_local_port uint32
|
||||
Xvp_remote_cid uint32
|
||||
Xvp_remote_port uint32
|
||||
Xvp_rxcnt uint32
|
||||
Xvp_txcnt uint32
|
||||
Xvp_peer_rxhiwat uint32
|
||||
Xvp_peer_rxcnt uint32
|
||||
Xvp_last_pid int32
|
||||
Xvp_gencnt uint64
|
||||
Xv_socket XSocket
|
||||
_ [4]byte
|
||||
}
|
||||
|
||||
type XSocket struct {
|
||||
Xso_len uint32
|
||||
Xso_so uint32
|
||||
So_type int16
|
||||
So_options int16
|
||||
So_linger int16
|
||||
So_state int16
|
||||
So_pcb uint32
|
||||
Xso_protocol int32
|
||||
Xso_family int32
|
||||
So_qlen int16
|
||||
So_incqlen int16
|
||||
So_qlimit int16
|
||||
So_timeo int16
|
||||
So_error uint16
|
||||
So_pgid int32
|
||||
So_oobmark uint32
|
||||
So_rcv XSockbuf
|
||||
So_snd XSockbuf
|
||||
So_uid uint32
|
||||
}
|
||||
|
||||
type XSocket64 struct {
|
||||
Xso_len uint32
|
||||
_ [8]byte
|
||||
So_type int16
|
||||
So_options int16
|
||||
So_linger int16
|
||||
So_state int16
|
||||
_ [8]byte
|
||||
Xso_protocol int32
|
||||
Xso_family int32
|
||||
So_qlen int16
|
||||
So_incqlen int16
|
||||
So_qlimit int16
|
||||
So_timeo int16
|
||||
So_error uint16
|
||||
So_pgid int32
|
||||
So_oobmark uint32
|
||||
So_rcv XSockbuf
|
||||
So_snd XSockbuf
|
||||
So_uid uint32
|
||||
}
|
||||
|
||||
type XSockbuf struct {
|
||||
Cc uint32
|
||||
Hiwat uint32
|
||||
Mbcnt uint32
|
||||
Mbmax uint32
|
||||
Lowat int32
|
||||
Flags int16
|
||||
Timeo int16
|
||||
}
|
||||
|
||||
type XVSockPgen struct {
|
||||
Len uint32
|
||||
Count uint64
|
||||
Gen uint64
|
||||
Sogen uint64
|
||||
}
|
||||
|
||||
type _Socklen uint32
|
||||
|
||||
type Xucred struct {
|
||||
@ -287,6 +373,11 @@ const (
|
||||
SizeofSockaddrUnix = 0x6a
|
||||
SizeofSockaddrDatalink = 0x14
|
||||
SizeofSockaddrCtl = 0x20
|
||||
SizeofSockaddrVM = 0xc
|
||||
SizeofXvsockpcb = 0xa8
|
||||
SizeofXSocket = 0x64
|
||||
SizeofXSockbuf = 0x18
|
||||
SizeofXVSockPgen = 0x20
|
||||
SizeofXucred = 0x4c
|
||||
SizeofLinger = 0x8
|
||||
SizeofIovec = 0x10
|
||||
@ -639,3 +730,39 @@ type Ucred struct {
|
||||
Ngroups int16
|
||||
Groups [16]uint32
|
||||
}
|
||||
|
||||
type SysvIpcPerm struct {
|
||||
Uid uint32
|
||||
Gid uint32
|
||||
Cuid uint32
|
||||
Cgid uint32
|
||||
Mode uint16
|
||||
_ uint16
|
||||
_ int32
|
||||
}
|
||||
type SysvShmDesc struct {
|
||||
Perm SysvIpcPerm
|
||||
Segsz uint64
|
||||
Lpid int32
|
||||
Cpid int32
|
||||
Nattch uint16
|
||||
_ [34]byte
|
||||
}
|
||||
|
||||
const (
|
||||
IPC_CREAT = 0x200
|
||||
IPC_EXCL = 0x400
|
||||
IPC_NOWAIT = 0x800
|
||||
IPC_PRIVATE = 0x0
|
||||
)
|
||||
|
||||
const (
|
||||
IPC_RMID = 0x0
|
||||
IPC_SET = 0x1
|
||||
IPC_STAT = 0x2
|
||||
)
|
||||
|
||||
const (
|
||||
SHM_RDONLY = 0x1000
|
||||
SHM_RND = 0x2000
|
||||
)
|
||||
|
20
vendor/golang.org/x/sys/unix/ztypes_linux.go
generated
vendored
20
vendor/golang.org/x/sys/unix/ztypes_linux.go
generated
vendored
@ -3936,3 +3936,23 @@ type LandlockPathBeneathAttr struct {
|
||||
const (
|
||||
LANDLOCK_RULE_PATH_BENEATH = 0x1
|
||||
)
|
||||
|
||||
const (
|
||||
IPC_CREAT = 0x200
|
||||
IPC_EXCL = 0x400
|
||||
IPC_NOWAIT = 0x800
|
||||
IPC_PRIVATE = 0x0
|
||||
|
||||
ipc_64 = 0x100
|
||||
)
|
||||
|
||||
const (
|
||||
IPC_RMID = 0x0
|
||||
IPC_SET = 0x1
|
||||
IPC_STAT = 0x2
|
||||
)
|
||||
|
||||
const (
|
||||
SHM_RDONLY = 0x1000
|
||||
SHM_RND = 0x2000
|
||||
)
|
||||
|
29
vendor/golang.org/x/sys/unix/ztypes_linux_386.go
generated
vendored
29
vendor/golang.org/x/sys/unix/ztypes_linux_386.go
generated
vendored
@ -639,3 +639,32 @@ const (
|
||||
const (
|
||||
PIDFD_NONBLOCK = 0x800
|
||||
)
|
||||
|
||||
type SysvIpcPerm struct {
|
||||
Key int32
|
||||
Uid uint32
|
||||
Gid uint32
|
||||
Cuid uint32
|
||||
Cgid uint32
|
||||
Mode uint16
|
||||
_ [2]uint8
|
||||
Seq uint16
|
||||
_ uint16
|
||||
_ uint32
|
||||
_ uint32
|
||||
}
|
||||
type SysvShmDesc struct {
|
||||
Perm SysvIpcPerm
|
||||
Segsz uint32
|
||||
Atime uint32
|
||||
Atime_high uint32
|
||||
Dtime uint32
|
||||
Dtime_high uint32
|
||||
Ctime uint32
|
||||
Ctime_high uint32
|
||||
Cpid int32
|
||||
Lpid int32
|
||||
Nattch uint32
|
||||
_ uint32
|
||||
_ uint32
|
||||
}
|
||||
|
26
vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go
generated
vendored
26
vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go
generated
vendored
@ -657,3 +657,29 @@ const (
|
||||
const (
|
||||
PIDFD_NONBLOCK = 0x800
|
||||
)
|
||||
|
||||
type SysvIpcPerm struct {
|
||||
Key int32
|
||||
Uid uint32
|
||||
Gid uint32
|
||||
Cuid uint32
|
||||
Cgid uint32
|
||||
Mode uint32
|
||||
_ [0]uint8
|
||||
Seq uint16
|
||||
_ uint16
|
||||
_ uint64
|
||||
_ uint64
|
||||
}
|
||||
type SysvShmDesc struct {
|
||||
Perm SysvIpcPerm
|
||||
Segsz uint64
|
||||
Atime int64
|
||||
Dtime int64
|
||||
Ctime int64
|
||||
Cpid int32
|
||||
Lpid int32
|
||||
Nattch uint64
|
||||
_ uint64
|
||||
_ uint64
|
||||
}
|
||||
|
29
vendor/golang.org/x/sys/unix/ztypes_linux_arm.go
generated
vendored
29
vendor/golang.org/x/sys/unix/ztypes_linux_arm.go
generated
vendored
@ -634,3 +634,32 @@ const (
|
||||
const (
|
||||
PIDFD_NONBLOCK = 0x800
|
||||
)
|
||||
|
||||
type SysvIpcPerm struct {
|
||||
Key int32
|
||||
Uid uint32
|
||||
Gid uint32
|
||||
Cuid uint32
|
||||
Cgid uint32
|
||||
Mode uint16
|
||||
_ [2]uint8
|
||||
Seq uint16
|
||||
_ uint16
|
||||
_ uint32
|
||||
_ uint32
|
||||
}
|
||||
type SysvShmDesc struct {
|
||||
Perm SysvIpcPerm
|
||||
Segsz uint32
|
||||
Atime uint32
|
||||
Atime_high uint32
|
||||
Dtime uint32
|
||||
Dtime_high uint32
|
||||
Ctime uint32
|
||||
Ctime_high uint32
|
||||
Cpid int32
|
||||
Lpid int32
|
||||
Nattch uint32
|
||||
_ uint32
|
||||
_ uint32
|
||||
}
|
||||
|
26
vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go
generated
vendored
26
vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go
generated
vendored
@ -636,3 +636,29 @@ const (
|
||||
const (
|
||||
PIDFD_NONBLOCK = 0x800
|
||||
)
|
||||
|
||||
type SysvIpcPerm struct {
|
||||
Key int32
|
||||
Uid uint32
|
||||
Gid uint32
|
||||
Cuid uint32
|
||||
Cgid uint32
|
||||
Mode uint32
|
||||
_ [0]uint8
|
||||
Seq uint16
|
||||
_ uint16
|
||||
_ uint64
|
||||
_ uint64
|
||||
}
|
||||
type SysvShmDesc struct {
|
||||
Perm SysvIpcPerm
|
||||
Segsz uint64
|
||||
Atime int64
|
||||
Dtime int64
|
||||
Ctime int64
|
||||
Cpid int32
|
||||
Lpid int32
|
||||
Nattch uint64
|
||||
_ uint64
|
||||
_ uint64
|
||||
}
|
||||
|
28
vendor/golang.org/x/sys/unix/ztypes_linux_mips.go
generated
vendored
28
vendor/golang.org/x/sys/unix/ztypes_linux_mips.go
generated
vendored
@ -640,3 +640,31 @@ const (
|
||||
const (
|
||||
PIDFD_NONBLOCK = 0x80
|
||||
)
|
||||
|
||||
type SysvIpcPerm struct {
|
||||
Key int32
|
||||
Uid uint32
|
||||
Gid uint32
|
||||
Cuid uint32
|
||||
Cgid uint32
|
||||
Mode uint32
|
||||
_ [0]uint8
|
||||
Seq uint16
|
||||
_ uint16
|
||||
_ uint32
|
||||
_ uint32
|
||||
}
|
||||
type SysvShmDesc struct {
|
||||
Perm SysvIpcPerm
|
||||
Segsz uint32
|
||||
Atime uint32
|
||||
Dtime uint32
|
||||
Ctime uint32
|
||||
Cpid int32
|
||||
Lpid int32
|
||||
Nattch uint32
|
||||
Atime_high uint16
|
||||
Dtime_high uint16
|
||||
Ctime_high uint16
|
||||
_ uint16
|
||||
}
|
||||
|
26
vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go
generated
vendored
26
vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go
generated
vendored
@ -639,3 +639,29 @@ const (
|
||||
const (
|
||||
PIDFD_NONBLOCK = 0x80
|
||||
)
|
||||
|
||||
type SysvIpcPerm struct {
|
||||
Key int32
|
||||
Uid uint32
|
||||
Gid uint32
|
||||
Cuid uint32
|
||||
Cgid uint32
|
||||
Mode uint32
|
||||
_ [0]uint8
|
||||
Seq uint16
|
||||
_ uint16
|
||||
_ uint64
|
||||
_ uint64
|
||||
}
|
||||
type SysvShmDesc struct {
|
||||
Perm SysvIpcPerm
|
||||
Segsz uint64
|
||||
Atime int64
|
||||
Dtime int64
|
||||
Ctime int64
|
||||
Cpid int32
|
||||
Lpid int32
|
||||
Nattch uint64
|
||||
_ uint64
|
||||
_ uint64
|
||||
}
|
||||
|
26
vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go
generated
vendored
26
vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go
generated
vendored
@ -639,3 +639,29 @@ const (
|
||||
const (
|
||||
PIDFD_NONBLOCK = 0x80
|
||||
)
|
||||
|
||||
type SysvIpcPerm struct {
|
||||
Key int32
|
||||
Uid uint32
|
||||
Gid uint32
|
||||
Cuid uint32
|
||||
Cgid uint32
|
||||
Mode uint32
|
||||
_ [0]uint8
|
||||
Seq uint16
|
||||
_ uint16
|
||||
_ uint64
|
||||
_ uint64
|
||||
}
|
||||
type SysvShmDesc struct {
|
||||
Perm SysvIpcPerm
|
||||
Segsz uint64
|
||||
Atime int64
|
||||
Dtime int64
|
||||
Ctime int64
|
||||
Cpid int32
|
||||
Lpid int32
|
||||
Nattch uint64
|
||||
_ uint64
|
||||
_ uint64
|
||||
}
|
||||
|
28
vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go
generated
vendored
28
vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go
generated
vendored
@ -640,3 +640,31 @@ const (
|
||||
const (
|
||||
PIDFD_NONBLOCK = 0x80
|
||||
)
|
||||
|
||||
type SysvIpcPerm struct {
|
||||
Key int32
|
||||
Uid uint32
|
||||
Gid uint32
|
||||
Cuid uint32
|
||||
Cgid uint32
|
||||
Mode uint32
|
||||
_ [0]uint8
|
||||
Seq uint16
|
||||
_ uint16
|
||||
_ uint32
|
||||
_ uint32
|
||||
}
|
||||
type SysvShmDesc struct {
|
||||
Perm SysvIpcPerm
|
||||
Segsz uint32
|
||||
Atime uint32
|
||||
Dtime uint32
|
||||
Ctime uint32
|
||||
Cpid int32
|
||||
Lpid int32
|
||||
Nattch uint32
|
||||
Atime_high uint16
|
||||
Dtime_high uint16
|
||||
Ctime_high uint16
|
||||
_ uint16
|
||||
}
|
||||
|
30
vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go
generated
vendored
30
vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go
generated
vendored
@ -646,3 +646,33 @@ const (
|
||||
const (
|
||||
PIDFD_NONBLOCK = 0x800
|
||||
)
|
||||
|
||||
type SysvIpcPerm struct {
|
||||
Key int32
|
||||
Uid uint32
|
||||
Gid uint32
|
||||
Cuid uint32
|
||||
Cgid uint32
|
||||
Mode uint32
|
||||
Seq uint32
|
||||
_ uint32
|
||||
_ uint64
|
||||
_ uint64
|
||||
}
|
||||
type SysvShmDesc struct {
|
||||
Perm SysvIpcPerm
|
||||
Atime_high uint32
|
||||
Atime uint32
|
||||
Dtime_high uint32
|
||||
Dtime uint32
|
||||
Ctime_high uint32
|
||||
Ctime uint32
|
||||
_ uint32
|
||||
Segsz uint32
|
||||
Cpid int32
|
||||
Lpid int32
|
||||
Nattch uint32
|
||||
_ uint32
|
||||
_ uint32
|
||||
_ [4]byte
|
||||
}
|
||||
|
25
vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go
generated
vendored
25
vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go
generated
vendored
@ -646,3 +646,28 @@ const (
|
||||
const (
|
||||
PIDFD_NONBLOCK = 0x800
|
||||
)
|
||||
|
||||
type SysvIpcPerm struct {
|
||||
Key int32
|
||||
Uid uint32
|
||||
Gid uint32
|
||||
Cuid uint32
|
||||
Cgid uint32
|
||||
Mode uint32
|
||||
Seq uint32
|
||||
_ uint32
|
||||
_ uint64
|
||||
_ uint64
|
||||
}
|
||||
type SysvShmDesc struct {
|
||||
Perm SysvIpcPerm
|
||||
Atime int64
|
||||
Dtime int64
|
||||
Ctime int64
|
||||
Segsz uint64
|
||||
Cpid int32
|
||||
Lpid int32
|
||||
Nattch uint64
|
||||
_ uint64
|
||||
_ uint64
|
||||
}
|
||||
|
25
vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go
generated
vendored
25
vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go
generated
vendored
@ -646,3 +646,28 @@ const (
|
||||
const (
|
||||
PIDFD_NONBLOCK = 0x800
|
||||
)
|
||||
|
||||
type SysvIpcPerm struct {
|
||||
Key int32
|
||||
Uid uint32
|
||||
Gid uint32
|
||||
Cuid uint32
|
||||
Cgid uint32
|
||||
Mode uint32
|
||||
Seq uint32
|
||||
_ uint32
|
||||
_ uint64
|
||||
_ uint64
|
||||
}
|
||||
type SysvShmDesc struct {
|
||||
Perm SysvIpcPerm
|
||||
Atime int64
|
||||
Dtime int64
|
||||
Ctime int64
|
||||
Segsz uint64
|
||||
Cpid int32
|
||||
Lpid int32
|
||||
Nattch uint64
|
||||
_ uint64
|
||||
_ uint64
|
||||
}
|
||||
|
26
vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go
generated
vendored
26
vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go
generated
vendored
@ -664,3 +664,29 @@ const (
|
||||
const (
|
||||
PIDFD_NONBLOCK = 0x800
|
||||
)
|
||||
|
||||
type SysvIpcPerm struct {
|
||||
Key int32
|
||||
Uid uint32
|
||||
Gid uint32
|
||||
Cuid uint32
|
||||
Cgid uint32
|
||||
Mode uint32
|
||||
_ [0]uint8
|
||||
Seq uint16
|
||||
_ uint16
|
||||
_ uint64
|
||||
_ uint64
|
||||
}
|
||||
type SysvShmDesc struct {
|
||||
Perm SysvIpcPerm
|
||||
Segsz uint64
|
||||
Atime int64
|
||||
Dtime int64
|
||||
Ctime int64
|
||||
Cpid int32
|
||||
Lpid int32
|
||||
Nattch uint64
|
||||
_ uint64
|
||||
_ uint64
|
||||
}
|
||||
|
25
vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go
generated
vendored
25
vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go
generated
vendored
@ -660,3 +660,28 @@ const (
|
||||
const (
|
||||
PIDFD_NONBLOCK = 0x800
|
||||
)
|
||||
|
||||
type SysvIpcPerm struct {
|
||||
Key int32
|
||||
Uid uint32
|
||||
Gid uint32
|
||||
Cuid uint32
|
||||
Cgid uint32
|
||||
Mode uint32
|
||||
_ uint16
|
||||
Seq uint16
|
||||
_ uint64
|
||||
_ uint64
|
||||
}
|
||||
type SysvShmDesc struct {
|
||||
Perm SysvIpcPerm
|
||||
Segsz uint64
|
||||
Atime int64
|
||||
Dtime int64
|
||||
Ctime int64
|
||||
Cpid int32
|
||||
Lpid int32
|
||||
Nattch uint64
|
||||
_ uint64
|
||||
_ uint64
|
||||
}
|
||||
|
25
vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go
generated
vendored
25
vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go
generated
vendored
@ -641,3 +641,28 @@ const (
|
||||
const (
|
||||
PIDFD_NONBLOCK = 0x4000
|
||||
)
|
||||
|
||||
type SysvIpcPerm struct {
|
||||
Key int32
|
||||
Uid uint32
|
||||
Gid uint32
|
||||
Cuid uint32
|
||||
Cgid uint32
|
||||
Mode uint32
|
||||
_ uint16
|
||||
Seq uint16
|
||||
_ uint64
|
||||
_ uint64
|
||||
}
|
||||
type SysvShmDesc struct {
|
||||
Perm SysvIpcPerm
|
||||
Atime int64
|
||||
Dtime int64
|
||||
Ctime int64
|
||||
Segsz uint64
|
||||
Cpid int32
|
||||
Lpid int32
|
||||
Nattch uint64
|
||||
_ uint64
|
||||
_ uint64
|
||||
}
|
||||
|
11
vendor/golang.org/x/sys/windows/memory_windows.go
generated
vendored
11
vendor/golang.org/x/sys/windows/memory_windows.go
generated
vendored
@ -35,3 +35,14 @@ const (
|
||||
QUOTA_LIMITS_HARDWS_MAX_DISABLE = 0x00000008
|
||||
QUOTA_LIMITS_HARDWS_MAX_ENABLE = 0x00000004
|
||||
)
|
||||
|
||||
type MemoryBasicInformation struct {
|
||||
BaseAddress uintptr
|
||||
AllocationBase uintptr
|
||||
AllocationProtect uint32
|
||||
PartitionId uint16
|
||||
RegionSize uintptr
|
||||
State uint32
|
||||
Protect uint32
|
||||
Type uint32
|
||||
}
|
||||
|
5
vendor/golang.org/x/sys/windows/syscall_windows.go
generated
vendored
5
vendor/golang.org/x/sys/windows/syscall_windows.go
generated
vendored
@ -274,6 +274,11 @@ func NewCallbackCDecl(fn interface{}) uintptr {
|
||||
//sys VirtualAlloc(address uintptr, size uintptr, alloctype uint32, protect uint32) (value uintptr, err error) = kernel32.VirtualAlloc
|
||||
//sys VirtualFree(address uintptr, size uintptr, freetype uint32) (err error) = kernel32.VirtualFree
|
||||
//sys VirtualProtect(address uintptr, size uintptr, newprotect uint32, oldprotect *uint32) (err error) = kernel32.VirtualProtect
|
||||
//sys VirtualProtectEx(process Handle, address uintptr, size uintptr, newProtect uint32, oldProtect *uint32) (err error) = kernel32.VirtualProtectEx
|
||||
//sys VirtualQuery(address uintptr, buffer *MemoryBasicInformation, length uintptr) (err error) = kernel32.VirtualQuery
|
||||
//sys VirtualQueryEx(process Handle, address uintptr, buffer *MemoryBasicInformation, length uintptr) (err error) = kernel32.VirtualQueryEx
|
||||
//sys ReadProcessMemory(process Handle, baseAddress uintptr, buffer *byte, size uintptr, numberOfBytesRead *uintptr) (err error) = kernel32.ReadProcessMemory
|
||||
//sys WriteProcessMemory(process Handle, baseAddress uintptr, buffer *byte, size uintptr, numberOfBytesWritten *uintptr) (err error) = kernel32.WriteProcessMemory
|
||||
//sys TransmitFile(s Handle, handle Handle, bytesToWrite uint32, bytsPerSend uint32, overlapped *Overlapped, transmitFileBuf *TransmitFileBuffers, flags uint32) (err error) = mswsock.TransmitFile
|
||||
//sys ReadDirectoryChanges(handle Handle, buf *byte, buflen uint32, watchSubTree bool, mask uint32, retlen *uint32, overlapped *Overlapped, completionRoutine uintptr) (err error) = kernel32.ReadDirectoryChangesW
|
||||
//sys FindFirstChangeNotification(path string, watchSubtree bool, notifyFilter uint32) (handle Handle, err error) [failretval==InvalidHandle] = kernel32.FindFirstChangeNotificationW
|
||||
|
64
vendor/golang.org/x/sys/windows/types_windows.go
generated
vendored
64
vendor/golang.org/x/sys/windows/types_windows.go
generated
vendored
@ -66,9 +66,21 @@ var signals = [...]string{
|
||||
}
|
||||
|
||||
const (
|
||||
FILE_LIST_DIRECTORY = 0x00000001
|
||||
FILE_APPEND_DATA = 0x00000004
|
||||
FILE_READ_DATA = 0x00000001
|
||||
FILE_READ_ATTRIBUTES = 0x00000080
|
||||
FILE_READ_EA = 0x00000008
|
||||
FILE_WRITE_DATA = 0x00000002
|
||||
FILE_WRITE_ATTRIBUTES = 0x00000100
|
||||
FILE_WRITE_EA = 0x00000010
|
||||
FILE_APPEND_DATA = 0x00000004
|
||||
FILE_EXECUTE = 0x00000020
|
||||
|
||||
FILE_GENERIC_READ = STANDARD_RIGHTS_READ | FILE_READ_DATA | FILE_READ_ATTRIBUTES | FILE_READ_EA | SYNCHRONIZE
|
||||
FILE_GENERIC_WRITE = STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | FILE_APPEND_DATA | SYNCHRONIZE
|
||||
FILE_GENERIC_EXECUTE = STANDARD_RIGHTS_EXECUTE | FILE_READ_ATTRIBUTES | FILE_EXECUTE | SYNCHRONIZE
|
||||
|
||||
FILE_LIST_DIRECTORY = 0x00000001
|
||||
FILE_TRAVERSE = 0x00000020
|
||||
|
||||
FILE_SHARE_READ = 0x00000001
|
||||
FILE_SHARE_WRITE = 0x00000002
|
||||
@ -1789,7 +1801,53 @@ type reparseDataBuffer struct {
|
||||
}
|
||||
|
||||
const (
|
||||
FSCTL_GET_REPARSE_POINT = 0x900A8
|
||||
FSCTL_CREATE_OR_GET_OBJECT_ID = 0x0900C0
|
||||
FSCTL_DELETE_OBJECT_ID = 0x0900A0
|
||||
FSCTL_DELETE_REPARSE_POINT = 0x0900AC
|
||||
FSCTL_DUPLICATE_EXTENTS_TO_FILE = 0x098344
|
||||
FSCTL_DUPLICATE_EXTENTS_TO_FILE_EX = 0x0983E8
|
||||
FSCTL_FILESYSTEM_GET_STATISTICS = 0x090060
|
||||
FSCTL_FILE_LEVEL_TRIM = 0x098208
|
||||
FSCTL_FIND_FILES_BY_SID = 0x09008F
|
||||
FSCTL_GET_COMPRESSION = 0x09003C
|
||||
FSCTL_GET_INTEGRITY_INFORMATION = 0x09027C
|
||||
FSCTL_GET_NTFS_VOLUME_DATA = 0x090064
|
||||
FSCTL_GET_REFS_VOLUME_DATA = 0x0902D8
|
||||
FSCTL_GET_OBJECT_ID = 0x09009C
|
||||
FSCTL_GET_REPARSE_POINT = 0x0900A8
|
||||
FSCTL_GET_RETRIEVAL_POINTER_COUNT = 0x09042B
|
||||
FSCTL_GET_RETRIEVAL_POINTERS = 0x090073
|
||||
FSCTL_GET_RETRIEVAL_POINTERS_AND_REFCOUNT = 0x0903D3
|
||||
FSCTL_IS_PATHNAME_VALID = 0x09002C
|
||||
FSCTL_LMR_SET_LINK_TRACKING_INFORMATION = 0x1400EC
|
||||
FSCTL_MARK_HANDLE = 0x0900FC
|
||||
FSCTL_OFFLOAD_READ = 0x094264
|
||||
FSCTL_OFFLOAD_WRITE = 0x098268
|
||||
FSCTL_PIPE_PEEK = 0x11400C
|
||||
FSCTL_PIPE_TRANSCEIVE = 0x11C017
|
||||
FSCTL_PIPE_WAIT = 0x110018
|
||||
FSCTL_QUERY_ALLOCATED_RANGES = 0x0940CF
|
||||
FSCTL_QUERY_FAT_BPB = 0x090058
|
||||
FSCTL_QUERY_FILE_REGIONS = 0x090284
|
||||
FSCTL_QUERY_ON_DISK_VOLUME_INFO = 0x09013C
|
||||
FSCTL_QUERY_SPARING_INFO = 0x090138
|
||||
FSCTL_READ_FILE_USN_DATA = 0x0900EB
|
||||
FSCTL_RECALL_FILE = 0x090117
|
||||
FSCTL_REFS_STREAM_SNAPSHOT_MANAGEMENT = 0x090440
|
||||
FSCTL_SET_COMPRESSION = 0x09C040
|
||||
FSCTL_SET_DEFECT_MANAGEMENT = 0x098134
|
||||
FSCTL_SET_ENCRYPTION = 0x0900D7
|
||||
FSCTL_SET_INTEGRITY_INFORMATION = 0x09C280
|
||||
FSCTL_SET_INTEGRITY_INFORMATION_EX = 0x090380
|
||||
FSCTL_SET_OBJECT_ID = 0x090098
|
||||
FSCTL_SET_OBJECT_ID_EXTENDED = 0x0900BC
|
||||
FSCTL_SET_REPARSE_POINT = 0x0900A4
|
||||
FSCTL_SET_SPARSE = 0x0900C4
|
||||
FSCTL_SET_ZERO_DATA = 0x0980C8
|
||||
FSCTL_SET_ZERO_ON_DEALLOCATION = 0x090194
|
||||
FSCTL_SIS_COPYFILE = 0x090100
|
||||
FSCTL_WRITE_USN_CLOSE_RECORD = 0x0900EF
|
||||
|
||||
MAXIMUM_REPARSE_DATA_BUFFER_SIZE = 16 * 1024
|
||||
IO_REPARSE_TAG_MOUNT_POINT = 0xA0000003
|
||||
IO_REPARSE_TAG_SYMLINK = 0xA000000C
|
||||
|
45
vendor/golang.org/x/sys/windows/zsyscall_windows.go
generated
vendored
45
vendor/golang.org/x/sys/windows/zsyscall_windows.go
generated
vendored
@ -303,6 +303,7 @@ var (
|
||||
procReadConsoleW = modkernel32.NewProc("ReadConsoleW")
|
||||
procReadDirectoryChangesW = modkernel32.NewProc("ReadDirectoryChangesW")
|
||||
procReadFile = modkernel32.NewProc("ReadFile")
|
||||
procReadProcessMemory = modkernel32.NewProc("ReadProcessMemory")
|
||||
procReleaseMutex = modkernel32.NewProc("ReleaseMutex")
|
||||
procRemoveDirectoryW = modkernel32.NewProc("RemoveDirectoryW")
|
||||
procResetEvent = modkernel32.NewProc("ResetEvent")
|
||||
@ -345,12 +346,16 @@ var (
|
||||
procVirtualFree = modkernel32.NewProc("VirtualFree")
|
||||
procVirtualLock = modkernel32.NewProc("VirtualLock")
|
||||
procVirtualProtect = modkernel32.NewProc("VirtualProtect")
|
||||
procVirtualProtectEx = modkernel32.NewProc("VirtualProtectEx")
|
||||
procVirtualQuery = modkernel32.NewProc("VirtualQuery")
|
||||
procVirtualQueryEx = modkernel32.NewProc("VirtualQueryEx")
|
||||
procVirtualUnlock = modkernel32.NewProc("VirtualUnlock")
|
||||
procWTSGetActiveConsoleSessionId = modkernel32.NewProc("WTSGetActiveConsoleSessionId")
|
||||
procWaitForMultipleObjects = modkernel32.NewProc("WaitForMultipleObjects")
|
||||
procWaitForSingleObject = modkernel32.NewProc("WaitForSingleObject")
|
||||
procWriteConsoleW = modkernel32.NewProc("WriteConsoleW")
|
||||
procWriteFile = modkernel32.NewProc("WriteFile")
|
||||
procWriteProcessMemory = modkernel32.NewProc("WriteProcessMemory")
|
||||
procAcceptEx = modmswsock.NewProc("AcceptEx")
|
||||
procGetAcceptExSockaddrs = modmswsock.NewProc("GetAcceptExSockaddrs")
|
||||
procTransmitFile = modmswsock.NewProc("TransmitFile")
|
||||
@ -2636,6 +2641,14 @@ func ReadFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped) (
|
||||
return
|
||||
}
|
||||
|
||||
func ReadProcessMemory(process Handle, baseAddress uintptr, buffer *byte, size uintptr, numberOfBytesRead *uintptr) (err error) {
|
||||
r1, _, e1 := syscall.Syscall6(procReadProcessMemory.Addr(), 5, uintptr(process), uintptr(baseAddress), uintptr(unsafe.Pointer(buffer)), uintptr(size), uintptr(unsafe.Pointer(numberOfBytesRead)), 0)
|
||||
if r1 == 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func ReleaseMutex(mutex Handle) (err error) {
|
||||
r1, _, e1 := syscall.Syscall(procReleaseMutex.Addr(), 1, uintptr(mutex), 0, 0)
|
||||
if r1 == 0 {
|
||||
@ -2990,6 +3003,30 @@ func VirtualProtect(address uintptr, size uintptr, newprotect uint32, oldprotect
|
||||
return
|
||||
}
|
||||
|
||||
func VirtualProtectEx(process Handle, address uintptr, size uintptr, newProtect uint32, oldProtect *uint32) (err error) {
|
||||
r1, _, e1 := syscall.Syscall6(procVirtualProtectEx.Addr(), 5, uintptr(process), uintptr(address), uintptr(size), uintptr(newProtect), uintptr(unsafe.Pointer(oldProtect)), 0)
|
||||
if r1 == 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func VirtualQuery(address uintptr, buffer *MemoryBasicInformation, length uintptr) (err error) {
|
||||
r1, _, e1 := syscall.Syscall(procVirtualQuery.Addr(), 3, uintptr(address), uintptr(unsafe.Pointer(buffer)), uintptr(length))
|
||||
if r1 == 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func VirtualQueryEx(process Handle, address uintptr, buffer *MemoryBasicInformation, length uintptr) (err error) {
|
||||
r1, _, e1 := syscall.Syscall6(procVirtualQueryEx.Addr(), 4, uintptr(process), uintptr(address), uintptr(unsafe.Pointer(buffer)), uintptr(length), 0, 0)
|
||||
if r1 == 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func VirtualUnlock(addr uintptr, length uintptr) (err error) {
|
||||
r1, _, e1 := syscall.Syscall(procVirtualUnlock.Addr(), 2, uintptr(addr), uintptr(length), 0)
|
||||
if r1 == 0 {
|
||||
@ -3046,6 +3083,14 @@ func WriteFile(handle Handle, buf []byte, done *uint32, overlapped *Overlapped)
|
||||
return
|
||||
}
|
||||
|
||||
func WriteProcessMemory(process Handle, baseAddress uintptr, buffer *byte, size uintptr, numberOfBytesWritten *uintptr) (err error) {
|
||||
r1, _, e1 := syscall.Syscall6(procWriteProcessMemory.Addr(), 5, uintptr(process), uintptr(baseAddress), uintptr(unsafe.Pointer(buffer)), uintptr(size), uintptr(unsafe.Pointer(numberOfBytesWritten)), 0)
|
||||
if r1 == 0 {
|
||||
err = errnoErr(e1)
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
func AcceptEx(ls Handle, as Handle, buf *byte, rxdatalen uint32, laddrlen uint32, raddrlen uint32, recvd *uint32, overlapped *Overlapped) (err error) {
|
||||
r1, _, e1 := syscall.Syscall9(procAcceptEx.Addr(), 8, uintptr(ls), uintptr(as), uintptr(unsafe.Pointer(buf)), uintptr(rxdatalen), uintptr(laddrlen), uintptr(raddrlen), uintptr(unsafe.Pointer(recvd)), uintptr(unsafe.Pointer(overlapped)), 0)
|
||||
if r1 == 0 {
|
||||
|
1
vendor/golang.org/x/term/codereview.cfg
generated
vendored
Normal file
1
vendor/golang.org/x/term/codereview.cfg
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
issuerepo: golang/go
|
11
vendor/modules.txt
vendored
11
vendor/modules.txt
vendored
@ -34,7 +34,6 @@ github.com/fsnotify/fsnotify
|
||||
# github.com/gdamore/encoding v1.0.0
|
||||
github.com/gdamore/encoding
|
||||
# github.com/gdamore/tcell/v2 v2.4.0
|
||||
## explicit
|
||||
github.com/gdamore/tcell/v2
|
||||
github.com/gdamore/tcell/v2/terminfo
|
||||
github.com/gdamore/tcell/v2/terminfo/a/aixterm
|
||||
@ -74,7 +73,7 @@ github.com/gdamore/tcell/v2/terminfo/x/xfce
|
||||
github.com/gdamore/tcell/v2/terminfo/x/xterm
|
||||
github.com/gdamore/tcell/v2/terminfo/x/xterm_kitty
|
||||
github.com/gdamore/tcell/v2/terminfo/x/xterm_termite
|
||||
# github.com/go-errors/errors v1.4.0
|
||||
# github.com/go-errors/errors v1.4.1
|
||||
## explicit
|
||||
github.com/go-errors/errors
|
||||
# github.com/go-git/gcfg v1.5.0
|
||||
@ -153,7 +152,7 @@ github.com/jesseduffield/go-git/v5/utils/merkletrie/filesystem
|
||||
github.com/jesseduffield/go-git/v5/utils/merkletrie/index
|
||||
github.com/jesseduffield/go-git/v5/utils/merkletrie/internal/frame
|
||||
github.com/jesseduffield/go-git/v5/utils/merkletrie/noder
|
||||
# github.com/jesseduffield/gocui v0.3.1-0.20210927094955-aa62b56c153a
|
||||
# github.com/jesseduffield/gocui v0.3.1-0.20211017041119-0ec562dfd23b
|
||||
## explicit
|
||||
github.com/jesseduffield/gocui
|
||||
# github.com/jesseduffield/yaml v2.1.0+incompatible
|
||||
@ -209,7 +208,7 @@ github.com/sirupsen/logrus
|
||||
# github.com/spkg/bom v0.0.0-20160624110644-59b7046e48ad
|
||||
## explicit
|
||||
github.com/spkg/bom
|
||||
# github.com/stretchr/testify v1.6.1
|
||||
# github.com/stretchr/testify v1.7.0
|
||||
## explicit
|
||||
github.com/stretchr/testify/assert
|
||||
# github.com/xanzy/ssh-agent v0.2.1
|
||||
@ -242,14 +241,14 @@ golang.org/x/crypto/ssh/knownhosts
|
||||
golang.org/x/net/context
|
||||
golang.org/x/net/internal/socks
|
||||
golang.org/x/net/proxy
|
||||
# golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6
|
||||
# golang.org/x/sys v0.0.0-20211015200801-69063c4bb744
|
||||
## explicit
|
||||
golang.org/x/sys/cpu
|
||||
golang.org/x/sys/internal/unsafeheader
|
||||
golang.org/x/sys/plan9
|
||||
golang.org/x/sys/unix
|
||||
golang.org/x/sys/windows
|
||||
# golang.org/x/term v0.0.0-20210916214954-140adaaadfaf
|
||||
# golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
|
||||
## explicit
|
||||
golang.org/x/term
|
||||
# golang.org/x/text v0.3.7
|
||||
|
Loading…
x
Reference in New Issue
Block a user