Make some helpers for views navigate#70
Conversation
|
Thanks for the pr! Ill test your code tomorrow, so far it looks good! |
Ok!) |
|
Okay so i havent gotten around to it... I'm a bit busy right now so ill try to get around to it. Maybe @mjarkk can take a look at it |
fixed delete of rune when navigating with the mouse
|
When i run your example, on [3] the cursor value changes, but the cursor does not move. Is this the intended behaviour? |
Yes, this is an example with a wrap line that allows you to correctly display in view "props". The cursor has moved to a new line in the view array, but it is on the same line in the buffer array. |
|
I mean that would of course be the expected result, however I fear that the tools that rely on Gocui are now expecting it to work wrong and would be confused if suddenly it worked right I have been less active in the dev world since I'm very busy with university right now, so replies can take longer than expected |
|
@sinkevichmm thank you for this PR. @glvr182 any progress on the review? |
|
Going to ask @mjarkk to take this |
mjarkk
left a comment
There was a problem hiding this comment.
Ah was gone for a while but here i am :)
Have a few questions and suggested changes.
Also can you fix the merge conflict
|
|
||
| // SetViewLineUp sets the cursor position of the view at the one line up | ||
| func (v *View) SetViewLineUp() { | ||
| if v.cy > 0 { |
There was a problem hiding this comment.
Should'd we add an extra v.Editable check here?
| func (v *View) SetViewLineDown() { | ||
| _, maxY := v.Size() | ||
| if v.cy+v.oy < v.ViewLinesHeight()-1 { | ||
| if v.cy >= maxY-1 { |
There was a problem hiding this comment.
Should'd we add an extra v.Editable check here?
| // SetViewLineDown sets the cursor position of the view at the one line down | ||
| func (v *View) SetViewLineDown() { | ||
| _, maxY := v.Size() | ||
| if v.cy+v.oy < v.ViewLinesHeight()-1 { |
There was a problem hiding this comment.
Can you change this code to be like this, so we don't have nested ifs:
| if v.cy+v.oy < v.ViewLinesHeight()-1 { | |
| if v.cy+v.oy >= v.ViewLinesHeight()-1 { | |
| return | |
| } |
| } | ||
|
|
||
| } | ||
| v.lines[y] = append(v.lines[y][:x], v.lines[y][x+1:]...) |
There was a problem hiding this comment.
Have you tested this with half width characters?
For example:
半角
added functions BufferLinePosition, SetViewLineUp, SetViewLineDown and example.