mirror of https://github.com/liamg/aminal.git
#249 no newlines when copying
This commit is contained in:
parent
4710948cd1
commit
9683ac8c02
|
@ -215,7 +215,7 @@ func (buffer *Buffer) GetSelectedText(selectionRegionMode SelectionRegionMode) s
|
||||||
maxX := int(buffer.terminalState.viewWidth) - 1
|
maxX := int(buffer.terminalState.viewWidth) - 1
|
||||||
if row == start.Line {
|
if row == start.Line {
|
||||||
minX = start.Col
|
minX = start.Col
|
||||||
} else if !line.wrapped {
|
} else if !line.wrapped && !line.nobreak {
|
||||||
builder.WriteString("\n")
|
builder.WriteString("\n")
|
||||||
}
|
}
|
||||||
if row == end.Line {
|
if row == end.Line {
|
||||||
|
@ -695,6 +695,7 @@ func (buffer *Buffer) Write(runes ...rune) {
|
||||||
buffer.NewLineEx(true)
|
buffer.NewLineEx(true)
|
||||||
|
|
||||||
newLine := buffer.getCurrentLine()
|
newLine := buffer.getCurrentLine()
|
||||||
|
newLine.setNoBreak(true)
|
||||||
if len(newLine.cells) == 0 {
|
if len(newLine.cells) == 0 {
|
||||||
newLine.Append(buffer.terminalState.DefaultCell(true))
|
newLine.Append(buffer.terminalState.DefaultCell(true))
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,12 +6,14 @@ import (
|
||||||
|
|
||||||
type Line struct {
|
type Line struct {
|
||||||
wrapped bool // whether line was wrapped onto from the previous one
|
wrapped bool // whether line was wrapped onto from the previous one
|
||||||
|
nobreak bool // true if no line break at the beginning of the line
|
||||||
cells []Cell
|
cells []Cell
|
||||||
}
|
}
|
||||||
|
|
||||||
func newLine() Line {
|
func newLine() Line {
|
||||||
return Line{
|
return Line{
|
||||||
wrapped: false,
|
wrapped: false,
|
||||||
|
nobreak: false,
|
||||||
cells: []Cell{},
|
cells: []Cell{},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -45,6 +47,10 @@ func (line *Line) setWrapped(wrapped bool) {
|
||||||
line.wrapped = wrapped
|
line.wrapped = wrapped
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (line *Line) setNoBreak(nobreak bool) {
|
||||||
|
line.nobreak = nobreak
|
||||||
|
}
|
||||||
|
|
||||||
func (line *Line) String() string {
|
func (line *Line) String() string {
|
||||||
runes := []rune{}
|
runes := []rune{}
|
||||||
for _, cell := range line.cells {
|
for _, cell := range line.cells {
|
||||||
|
|
Loading…
Reference in New Issue