Module: Twterm::Tab::Base

Includes:
Curses
Included in:
KeyAssignmentsCheatsheet, New::List, New::Search, New::Start, New::User, Statuses::Base, UserTab, Users::Base
Defined in:
lib/twterm/tab/base.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#titleObject

Returns the value of attribute title.



7
8
9
# File 'lib/twterm/tab/base.rb', line 7

def title
  @title
end

#windowObject (readonly)

Returns the value of attribute window.



6
7
8
# File 'lib/twterm/tab/base.rb', line 6

def window
  @window
end

Instance Method Details

#==(other) ⇒ Object



9
10
11
# File 'lib/twterm/tab/base.rb', line 9

def ==(other)
  self.equal?(other)
end

#closeObject



13
14
15
# File 'lib/twterm/tab/base.rb', line 13

def close
  window.close
end

#initializeObject



17
18
19
# File 'lib/twterm/tab/base.rb', line 17

def initialize
  @window = stdscr.subwin(stdscr.maxy - 5, stdscr.maxx, 3, 0)
end

#refreshObject



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/twterm/tab/base.rb', line 21

def refresh
  Thread.new do
    refresh_mutex.synchronize do
      window.clear

      # avoid misalignment caused by some multibyte-characters
      window.with_color(:black, :transparent) do
        (0...window.maxy).each do |i|
          window.setpos(i, 0)
          window.addch(' ')
        end
      end

      update
      window.refresh
    end if refreshable?
  end
end

#resizeObject



40
41
42
43
# File 'lib/twterm/tab/base.rb', line 40

def resize
  window.resize(stdscr.maxy - 5, stdscr.maxx)
  window.move(3, 0)
end

#respond_to_key(_) ⇒ Object



45
46
47
# File 'lib/twterm/tab/base.rb', line 45

def respond_to_key(_)
  fail NotImplementedError, 'respond_to_key method must be implemented'
end