Archived
1
0
Fork 0

Set position relatively

This commit is contained in:
Braiden Vasco 2017-07-22 14:31:38 +00:00
parent db45c20724
commit 25198738df
7 changed files with 13 additions and 13 deletions

View file

@ -26,7 +26,7 @@ module Widgets
end
def setpos(x, y)
Curses.setpos y, x
Curses.setpos self.y + y, self.x + x
end
end
end

View file

@ -32,7 +32,7 @@ module Widgets
end
def draw_message(offset, time, name, text)
setpos x, y + offset
setpos 0, offset
info_length = time.length + 1 + name.length + 2
head_length = width - info_length
@ -58,7 +58,7 @@ module Widgets
lines = (tail_length / width.to_f).ceil
1.upto lines do |line|
setpos x, y + offset + line
setpos 0, offset + line
Curses.addstr tail[(width * (line - 1))...(width * line)]
end

View file

@ -13,7 +13,7 @@ module Widgets
end
def draw
setpos x, y
setpos 0, 0
Style.default.online_mark do
Curses.addstr '[Online]'
end
@ -22,7 +22,7 @@ module Widgets
Curses.addstr name
end
setpos x, y + 1
setpos 0, 1
Curses.addstr 'Public key: '
Curses.addstr public_key
end

View file

@ -17,17 +17,17 @@ module Widgets
def draw
@logo.draw
list_y = y + @logo.height
ITEMS.each_with_index do |item, index|
item_y = @logo.height + index * 4
Style.default.menu_item do
setpos 2, 0 + list_y + index * 4
setpos 2, item_y + 0
Curses.addstr ' ' * (width - 4)
setpos 2, 1 + list_y + index * 4
setpos 2, item_y + 1
Curses.addstr " #{item}".ljust width - 4
setpos 2, 2 + list_y + index * 4
setpos 2, item_y + 2
Curses.addstr ' ' * (width - 4)
end
end

View file

@ -22,7 +22,7 @@ module Widgets
def draw
Style.default.logo do
LOGO.each_with_index do |s, index|
setpos x, y + index
setpos 0, index
Curses.addstr s
end
end

View file

@ -23,7 +23,7 @@ module Widgets
items[top...(top + height)].each_with_index.each do |item, offset|
index = top + offset
setpos x, y + offset
setpos 0, offset
if item[:online]
Style.default.online_mark do

View file

@ -17,7 +17,7 @@ module Widgets
cut = text[start...start + total]
setpos x, y
setpos 0, 0
before_cursor = cut[0...cursor_pos]
under_cursor = cut[cursor_pos] || ' '