rbcurse-core 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # rbcurse-core
2
2
 
3
- ** Working on 1.9.3 **
3
+ ** Works on 1.9.3 **
4
4
 
5
5
  Contains core widgets and infrastructure of rbcurse ncurses toolkit. rbcurse helps to easily build
6
6
  ncurses application for text terminals.
@@ -41,7 +41,7 @@ Core intends to be :
41
41
 
42
42
  ## Testing Status
43
43
 
44
- * Working on 1.9.3-p392 (environment is zsh 5.0.x, tmux, TERM=screen-256color, OSX ML)
44
+ * Works on 1.9.3-p392 (my environment is zsh 5.0.x, tmux, TERM=screen-256color, OSX ML)
45
45
 
46
46
  ## Other
47
47
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.6
1
+ 0.0.7
@@ -4,7 +4,7 @@
4
4
  # Author: rkumar http://github.com/rkumar/rbcurse/
5
5
  # Date: Around for a long time
6
6
  # License: Same as Ruby's License (http://www.ruby-lang.org/LICENSE.txt)
7
- # Last update: 2013-03-05 20:56
7
+ # Last update: 2013-03-08 17:27
8
8
  #
9
9
  # == CHANGED
10
10
  # removed Pad and Subwin to lib/ver/rpad.rb - hopefully I've seen the last of both
@@ -279,14 +279,28 @@ module VER
279
279
  # is 0
280
280
  # Previously this printed a chunk as a full line, I've modified it to print on
281
281
  # one line. This can be used for running text.
282
- def show_colored_chunks(chunks, defcolor = nil, defattr = nil)
282
+ # NOTE 2013-03-08 - 17:02 added width so we don't overflow
283
+ def show_colored_chunks(chunks, defcolor = nil, defattr = nil, wid = 999)
283
284
  return unless visible?
285
+ ww = 0
284
286
  chunks.each do |chunk| #|color, chunk, attrib|
285
287
  case chunk
286
288
  when Chunks::Chunk
287
289
  color = chunk.color
288
290
  attrib = chunk.attrib
289
291
  text = chunk.text
292
+ oldw = ww
293
+ ww += text.length
294
+ if ww > wid
295
+ # if we are exceeding the width then by howmuch
296
+ rem = wid - oldw
297
+ if rem > 0
298
+ # take only as much as we are allowed
299
+ text = text[0,rem]
300
+ else
301
+ break
302
+ end
303
+ end
290
304
  when Array
291
305
  # for earlier demos that used an array
292
306
  color = chunk[0]
@@ -638,6 +652,7 @@ module VER
638
652
  #$log.debug "XXX: using chunkline" # 2011-12-10 12:40:13
639
653
  wmove r, c
640
654
  a = get_attrib att
655
+ # please add width to avoid overflow
641
656
  show_colored_chunks content, color, a
642
657
  elsif content.is_a? Array
643
658
  # several chunks in one row - NOTE Very experimental may change
@@ -645,6 +660,7 @@ module VER
645
660
  $log.warn "XXX: WARNING outdated should send in a chunkline"
646
661
  wmove r, c
647
662
  a = get_attrib att
663
+ # please add width to avoid overflow
648
664
  show_colored_chunks content, color, a
649
665
  else
650
666
  # a single row chunk - NOTE Very experimental may change
@@ -515,14 +515,16 @@ module RubyCurses
515
515
  @graphic.printstring r+hh, c, "%-*s" % [@width-@internal_width,content],
516
516
  acolor, @attr
517
517
  elsif content.is_a? Chunks::ChunkLine
518
+ # clear the line first
518
519
  @graphic.printstring r+hh, c, " "* (@width-@internal_width),
519
520
  acolor, @attr
521
+ # move back
520
522
  @graphic.wmove r+hh, c
521
523
  # either we have to loop through and put in default color and attr
522
524
  # or pass it to show_col
523
525
  a = get_attrib @attrib
524
526
  # FIXME this does not clear till the eol
525
- @graphic.show_colored_chunks content, acolor, a
527
+ @graphic.show_colored_chunks content, acolor, a, @width-@internal_width
526
528
  elsif content.is_a? Chunks::Chunk
527
529
  raise "TODO chunk in textview"
528
530
  elsif content.is_a? Array
@@ -536,7 +538,9 @@ module RubyCurses
536
538
  # or pass it to show_col
537
539
  a = get_attrib @attrib
538
540
  # FIXME this does not clear till the eol
539
- @graphic.show_colored_chunks content, acolor, a
541
+ # # NOTE 2013-03-08 - 17:37 pls add width to avoid overflow
542
+ @graphic.show_colored_chunks content, acolor, a, @width-@internal_width
543
+ #@graphic.show_colored_chunks content, acolor, a
540
544
  else
541
545
  # a single row chunk - NOTE Very experimental may change
542
546
  text = content[1].dup
data/rbcurse-core.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "rbcurse-core"
8
- s.version = "0.0.6"
8
+ s.version = "0.0.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Rahul Kumar"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbcurse-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: