This commit is contained in:
Luke I. Wilson 2021-03-18 19:52:34 -05:00
parent e1ebc29ac1
commit 1d77aae277
2 changed files with 4 additions and 4 deletions

View File

@ -170,7 +170,7 @@ func main() {
if tabContainer.GetTabCount() > 0 { if tabContainer.GetTabCount() > 0 {
tab := tabContainer.GetTab(tabContainer.GetSelectedTabIdx()) tab := tabContainer.GetTab(tabContainer.GetSelectedTabIdx())
te := tab.Child.(*ui.TextEdit) te := tab.Child.(*ui.TextEdit)
contents, err := ClipRead() contents, err := ClipRead()
if err != nil { if err != nil {
panic(err) panic(err)

View File

@ -174,7 +174,7 @@ func (t *TextEdit) Delete(forwards bool) {
func (t *TextEdit) Insert(contents string) { func (t *TextEdit) Insert(contents string) {
if t.selectMode { // If there is a selection... if t.selectMode { // If there is a selection...
// Go to and delete the selection // Go to and delete the selection
t.Delete(true) // The parameter doesn't matter with selection t.Delete(true) // The parameter doesn't matter with selection
} }
runes := []rune(contents) runes := []rune(contents)
@ -387,7 +387,7 @@ func (t *TextEdit) GetSelectedString() string {
lastLine := lines[len(lines)-1] lastLine := lines[len(lines)-1]
if t.selection.EndCol >= len(lastLine) { // If the line delimiter of the last line is selected... if t.selection.EndCol >= len(lastLine) { // If the line delimiter of the last line is selected...
// Don't access out-of-bounds and include the line delimiter // Don't access out-of-bounds and include the line delimiter
lastLine = string([]rune(lastLine)[:t.selection.EndCol]) + t.GetLineDelimiter() lastLine = string([]rune(lastLine)[:t.selection.EndCol]) + t.GetLineDelimiter()
} else { // Normal access } else { // Normal access
lastLine = string([]rune(lastLine)[:t.selection.EndCol+1]) lastLine = string([]rune(lastLine)[:t.selection.EndCol+1])
} }
@ -463,7 +463,7 @@ func (t *TextEdit) Draw(s tcell.Screen) {
currentStyle = textEditStyle // reset style currentStyle = textEditStyle // reset style
} }
r := ' ' // Rune to draw r := ' ' // Rune to draw
if i < len(lineRunes) { // While we're drawing the line if i < len(lineRunes) { // While we're drawing the line
r = lineRunes[i] r = lineRunes[i]
} }