canis 0.0.5 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -13,15 +13,23 @@ module Canis
13
13
  # @status_line.command {
14
14
  # "F1 Help | F2 Menu | F3 View | F4 Shell | F5 Sh | %20s" % [message_label.text]
15
15
  # }
16
+ #
17
+ # == Changes
18
+ # Earlier, the color of teh status line was REVERSED while printing which can be confusing
19
+ # and surprising. We should use normal, or use whatever attribute the user gives.
20
+ # Also, using the row as -3 is assuming that a dock is used, which may not be the case,
21
+ # so -1 should be used.
22
+ #
16
23
  class StatusLine < Widget
24
+ @@negative_offset = -1 # 2014-08-31 - 12:18 earlier -3
17
25
  #attr_accessor :row_relative # lets only advertise this when we've tested it out
18
26
 
19
27
  def initialize form, config={}, &block
20
- @row_relative = -3
28
+ @row_relative = @@negative_offset
21
29
  if form.window.height == 0
22
- @row = Ncurses.LINES-3 # fix, what about smaller windows, use window dimensions and watch out for 0,0
30
+ @row = Ncurses.LINES + @@negative_offset
23
31
  else
24
- @row = form.window.height-3 # fix, what about smaller windows, use window dimensions and watch out for 0,0
32
+ @row = form.window.height + @@negative_offset
25
33
  end
26
34
  # in root windows FIXME
27
35
  @col = 0
@@ -65,6 +73,8 @@ module Canis
65
73
  # rather whenever form.repaint is called.
66
74
  def repaint
67
75
  @color_pair ||= get_color($datacolor, @color, @bgcolor)
76
+ # earlier attrib defaulted to REVERSE which was surprising.
77
+ _attr = @attr || Ncurses::A_NORMAL
68
78
  len = @form.window.getmaxx # width does not change upon resizing so useless, fix or do something
69
79
  len = Ncurses.COLS if len == 0 || len > Ncurses.COLS
70
80
  # this should only happen if there's a change in window
@@ -73,7 +83,7 @@ module Canis
73
83
  end
74
84
 
75
85
  # first print dashes through
76
- @form.window.printstring @row, @col, "%s" % "-" * len, @color_pair, Ncurses::A_REVERSE
86
+ @form.window.printstring @row, @col, "%s" % "-" * len, @color_pair, _attr
77
87
 
78
88
  # now call the block to get current values
79
89
  if @command
@@ -87,19 +97,19 @@ module Canis
87
97
  # what if user wants to change attrib ?
88
98
  if ftext =~ /#\[/
89
99
  # hopefully color_pair does not clash with formatting
90
- @form.window.printstring_formatted @row, @col, ftext, @color_pair, Ncurses::A_REVERSE
100
+ @form.window.printstring_formatted @row, @col, ftext, @color_pair, _attr
91
101
  else
92
- @form.window.printstring @row, @col, ftext, @color_pair, Ncurses::A_REVERSE
102
+ @form.window.printstring @row, @col, ftext, @color_pair, _attr
93
103
  end
94
104
 
95
105
  if @right_text
96
106
  ftext = @right_text.call(self, @right_args)
97
107
  if ftext =~ /#\[/
98
108
  # hopefully color_pair does not clash with formatting
99
- @form.window.printstring_formatted_right @row, nil, ftext, @color_pair, Ncurses::A_REVERSE
109
+ @form.window.printstring_formatted_right @row, nil, ftext, @color_pair, _attr
100
110
  else
101
111
  c = len - ftext.length
102
- @form.window.printstring @row, c, ftext, @color_pair, Ncurses::A_REVERSE
112
+ @form.window.printstring @row, c, ftext, @color_pair, _attr
103
113
  end
104
114
  else
105
115
  t = Time.now
@@ -108,7 +118,7 @@ module Canis
108
118
  # somehow the bg defined here affects the bg in left text, if left does not define
109
119
  # a bg. The bgcolor defined of statusline is ignored in left or overriden by this
110
120
  #ftext = "#[fg=white,bg=blue] %-20s#[/end]" % [tt] # print a default
111
- @form.window.printstring_formatted_right @row, nil, tt, @color_pair, Ncurses::A_REVERSE
121
+ @form.window.printstring_formatted_right @row, nil, tt, @color_pair, _attr
112
122
  end
113
123
 
114
124
  @repaint_required = false
@@ -10,7 +10,7 @@
10
10
  # Author: jkepler http://github.com/mare-imbrium/mancurses/
11
11
  # Date: 2011-11-09 - 16:59
12
12
  # License: Same as Ruby's License (http://www.ruby-lang.org/LICENSE.txt)
13
- # Last update: 2014-07-08 13:04
13
+ # Last update: 2014-08-27 20:54
14
14
  #
15
15
  # == CHANGES
16
16
  # - changed @content to @list since all multirow widgets use that and so do utils etc
@@ -751,7 +751,7 @@ module Canis
751
751
  def clear
752
752
  return unless @list
753
753
  @list.clear
754
- @native_text.clear
754
+ @native_text.clear if @native_text # check this line, should it be removed 2014-08-27 - 20:54
755
755
  fire_dimension_changed :clear
756
756
  init_vars
757
757
  end
@@ -1,3 +1,3 @@
1
1
  module Canis
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.7"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: canis
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - kepler
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-18 00:00:00.000000000 Z
11
+ date: 2014-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler