summaryrefslogtreecommitdiffstats
path: root/vendor
diff options
context:
space:
mode:
authorJesse Duffield <jessedduffield@gmail.com>2021-10-17 13:00:44 +1100
committergithub-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>2021-10-17 04:17:59 +0000
commit345c90ac05bffd6e4163be9dabc0386cd8918057 (patch)
treeed29b41dfe6354adba1f81c11d676519ebdf2daa /vendor
parent7564e506b525e0831a1fb88dfc70e9d27564d8a1 (diff)
fix editor
Diffstat (limited to 'vendor')
-rw-r--r--vendor/github.com/go-errors/errors/README.md1
-rw-r--r--vendor/github.com/go-errors/errors/cover.out89
-rw-r--r--vendor/github.com/jesseduffield/gocui/edit.go471
-rw-r--r--vendor/github.com/jesseduffield/gocui/go.mod5
-rw-r--r--vendor/github.com/jesseduffield/gocui/go.sum28
-rw-r--r--vendor/github.com/jesseduffield/gocui/text_area.go209
-rw-r--r--vendor/github.com/jesseduffield/gocui/view.go44
-rw-r--r--vendor/github.com/stretchr/testify/assert/assertion_compare.go172
-rw-r--r--vendor/github.com/stretchr/testify/assert/assertion_format.go97
-rw-r--r--vendor/github.com/stretchr/testify/assert/assertion_forward.go194
-rw-r--r--vendor/github.com/stretchr/testify/assert/assertion_order.go81
-rw-r--r--vendor/github.com/stretchr/testify/assert/assertions.go83
-rw-r--r--vendor/golang.org/x/sys/unix/mkerrors.sh7
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_darwin.go40
-rw-r--r--vendor/golang.org/x/sys/unix/syscall_linux.go9
-rw-r--r--vendor/golang.org/x/sys/unix/sysvshm_linux.go21
-rw-r--r--vendor/golang.org/x/sys/unix/sysvshm_unix.go61
-rw-r--r--vendor/golang.org/x/sys/unix/sysvshm_unix_other.go14
-rw-r--r--vendor/golang.org/x/sys/unix/zerrors_darwin_amd64.go3126
-rw-r--r--vendor/golang.org/x/sys/unix/zerrors_darwin_arm64.go3126
-rw-r--r--vendor/golang.org/x/sys/unix/zerrors_linux.go2
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go59
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s24
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go59
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s24
-rw-r--r--vendor/golang.org/x/sys/unix/zsyscall_linux.go43
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_darwin_amd64.go127
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_darwin_arm64.go127
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux.go20
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_386.go29
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_amd64.go26
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_arm.go29
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_arm64.go26
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_mips.go28
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_mips64.go26
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_mips64le.go26
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_mipsle.go28
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_ppc.go30
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_ppc64.go25
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_ppc64le.go25
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_riscv64.go26
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_s390x.go25
-rw-r--r--vendor/golang.org/x/sys/unix/ztypes_linux_sparc64.go25
-rw-r--r--vendor/golang.org/x/sys/windows/memory_windows.go11
-rw-r--r--vendor/golang.org/x/sys/windows/syscall_windows.go5
-rw-r--r--vendor/golang.org/x/sys/windows/types_windows.go64
-rw-r--r--vendor/golang.org/x/sys/windows/zsyscall_windows.go45
-rw-r--r--vendor/golang.org/x/term/codereview.cfg1
-rw-r--r--vendor/modules.txt11
49 files changed, 5177 insertions, 3697 deletions
diff --git a/vendor/github.com/go-errors/errors/README.md b/vendor/github.com/go-errors/errors/README.md
index d03882f1b..2ee13f117 100644
--- a/vendor/github.com/go-errors/errors/README.md
+++ b/vendor/github.com/go-errors/errors/README.md
@@ -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.
diff --git a/vendor/github.com/go-errors/errors/cover.out b/vendor/github.com/go-errors/errors/cover.out
deleted file mode 100644
index ab18b0519..000000000
--- a/vendor/github.com/go-errors/errors/cover.out
+++ /dev/null
@@ -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
diff --git a/vendor/github.com/jesseduffield/gocui/edit.go b/vendor/github.com/jesseduffield/gocui/edit.go
index a169e563b..243a59663 100644
--- a/vendor/github.com/jesseduffield/gocui/edit.go
+++ b/vendor/github.com/jesseduffield/gocui/edit.go
@@ -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 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 false
}
- 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, le