Skip to content

Commit

Permalink
Do not add tab in single-line mode (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucor authored and aarzilli committed Dec 2, 2018
1 parent 280c1ba commit aa087f1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions text.go
Original file line number Diff line number Diff line change
Expand Up @@ -667,6 +667,11 @@ func (edit *TextEditor) Text(text []rune) {
break
}

/* can't add tab in single-line mode */
if text[i] == '\t' && edit.SingleLine {
break
}

/* filter incoming text */
if edit.Filter != nil && !edit.Filter(text[i]) {
continue
Expand Down Expand Up @@ -1195,11 +1200,8 @@ func (edit *TextEditor) editDrawText(out *command.Buffer, style *nstyle.Edit, po
for index, glyph := range text {
switch glyph {
case '\t':
if edit.PasswordChar == 0 {
flushTab(index)
start = index + 1
}

flushTab(index)
start = index + 1
case '\n':
flushLine(index)
line_count++
Expand Down

0 comments on commit aa087f1

Please sign in to comment.