Skip to content

Development branch #101

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/mruby-zest/example/TextLine.qml
Original file line number Diff line number Diff line change
Expand Up @@ -72,17 +72,17 @@ Widget {
pos = @edit.pos if @edit
ll = self.label

cursor_row = @edit.calc_cursor_y
cursorrow = @edit.cursor_row
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

cursor_row instead of cursorrow

  • it's the same as in @edit.cursor_row, which reduces the mental load (we don't have to think whether to spell it one way or another)
  • using snake case seems standard in Ruby: https://namingconvention.org/ruby/


if(k.ord == 8)
pos -= 1
if(pos >= ll.length)
self.label = ll[0...-1]
elsif(pos >= 0)
self.label = ll.slice(0, pos+cursor_row) + ll.slice(pos+1+cursor_row, ll.length)
self.label = ll.slice(0, pos+cursorrow) + ll.slice(pos+1+cursorrow, ll.length)
end
else
self.label = ll.insert(pos+cursor_row, k)
self.label = ll.insert(pos+cursorrow, k)
end
ll = self.label
whenValue.call if whenValue
Expand Down
4 changes: 4 additions & 0 deletions src/mruby-zest/mrblib/util.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ def pad(scale, bb)
bb[3] = h;
end

def cursor_row()
return @cursor_row
end

class EditRegion
def initialize(vg, string, width, height)

Expand Down