Skip to content

Commit

Permalink
bugfix: up arrow at the top of a text editor won't scroll back
Browse files Browse the repository at this point in the history
  • Loading branch information
aarzilli committed Sep 28, 2017
1 parent 18fa92e commit 5a87d76
Showing 1 changed file with 8 additions and 10 deletions.
18 changes: 8 additions & 10 deletions text.go
Original file line number Diff line number Diff line change
Expand Up @@ -837,17 +837,15 @@ retry:

p := state.indexToCoord(state.Cursor, font, row_height)
p.Y -= row_height
if p.Y >= 0 {
if state.HasPreferredX {
p.X = state.PreferredX
} else {
state.HasPreferredX = true
state.PreferredX = p.X
}
state.Cursor = state.locateCoord(p, font, row_height)

state.clamp()
if state.HasPreferredX {
p.X = state.PreferredX
} else {
state.HasPreferredX = true
state.PreferredX = p.X
}
state.Cursor = state.locateCoord(p, font, row_height)

state.clamp()

case key.CodeDeleteForward:
if readOnly {
Expand Down

0 comments on commit 5a87d76

Please sign in to comment.