rbcurse-core 0.0.4 → 0.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/VERSION +1 -1
- data/lib/rbcurse/core/include/listscrollable.rb +7 -1
- data/lib/rbcurse/core/system/window.rb +7 -5
- data/lib/rbcurse/core/widgets/rlist.rb +9 -5
- data/lib/rbcurse/core/widgets/rtextarea.rb +4 -2
- data/lib/rbcurse/core/widgets/rwidget.rb +4 -4
- data/lib/rbcurse/core/widgets/tabularwidget.rb +9 -6
- data/lib/rbcurse/core/widgets/textpad.rb +13 -5
- data/lib/rbcurse.rb +1 -1
- data/rbcurse-core.gemspec +1 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.5
|
@@ -178,7 +178,13 @@ module ListScrollable
|
|
178
178
|
$log.debug " scroll_right mult:#{$multiplier} , hscrollcols #{hscrollcols}, pcol #{@pcol} w: #{@width} ll:#{@longest_line} "
|
179
179
|
#blen = @buffer.rstrip.length
|
180
180
|
blen = @longest_line
|
181
|
-
|
181
|
+
if @pcol + @width < blen
|
182
|
+
@pcol += hscrollcols if @pcol + @width < blen
|
183
|
+
else
|
184
|
+
# due to some change somewhere, sometimes width = longest which is not true
|
185
|
+
hscrollcols = $multiplier > 0 ? $multiplier : 1
|
186
|
+
@pcol += hscrollcols
|
187
|
+
end
|
182
188
|
@repaint_required = true
|
183
189
|
end
|
184
190
|
def scroll_left
|
@@ -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:
|
7
|
+
# Last update: 2013-03-05 20:56
|
8
8
|
#
|
9
9
|
# == CHANGED
|
10
10
|
# removed Pad and Subwin to lib/ver/rpad.rb - hopefully I've seen the last of both
|
@@ -600,7 +600,7 @@ module VER
|
|
600
600
|
def destroy
|
601
601
|
# typically the ensure block should have this
|
602
602
|
|
603
|
-
|
603
|
+
#$log.debug "win destroy start"
|
604
604
|
|
605
605
|
Ncurses::Panel.del_panel(@panel.pointer) if @panel
|
606
606
|
delwin() if @window
|
@@ -611,7 +611,7 @@ module VER
|
|
611
611
|
FFI::NCurses.delwin(pad) if pad
|
612
612
|
pad = nil
|
613
613
|
} if @pads
|
614
|
-
|
614
|
+
#$log.debug "win destroy end"
|
615
615
|
end
|
616
616
|
|
617
617
|
#
|
@@ -619,10 +619,12 @@ module VER
|
|
619
619
|
# Widgets can get window to create a pad for them. This way when the window
|
620
620
|
# is destroyed, it will delete all the pads. A widget wold not be able to do this.
|
621
621
|
# The destroy method of the widget will be called.
|
622
|
-
def get_pad
|
622
|
+
def get_pad content_rows, content_cols
|
623
623
|
pad = FFI::NCurses.newpad(content_rows, content_cols)
|
624
624
|
@pads ||= []
|
625
625
|
@pads << pad
|
626
|
+
## added 2013-03-05 - 19:21 without next line how was pad being returned
|
627
|
+
return pad
|
626
628
|
end
|
627
629
|
|
628
630
|
#
|
@@ -790,7 +792,7 @@ module VER
|
|
790
792
|
raise "width needs to be supplied." if width.nil?
|
791
793
|
att ||= Ncurses::A_NORMAL
|
792
794
|
|
793
|
-
|
795
|
+
#$log.debug " inside window print_border r #{row} c #{col} h #{height} w #{width} "
|
794
796
|
|
795
797
|
# 2009-11-02 00:45 made att nil for blanking out
|
796
798
|
# FIXME - in tabbedpanes this clears one previous line ??? XXX when using a textarea/view
|
@@ -548,13 +548,17 @@ module RubyCurses
|
|
548
548
|
return
|
549
549
|
end
|
550
550
|
if !content.nil?
|
551
|
-
|
552
|
-
|
551
|
+
cl = content.length
|
552
|
+
if cl > maxlen # only show maxlen
|
553
|
+
@longest_line = cl if cl > @longest_line
|
553
554
|
#content = content[@pcol..@pcol+maxlen-1]
|
554
|
-
|
555
|
+
## taking care of when scrolling is needed but longest_line is misreported
|
556
|
+
# So we scroll always and need to check 2013-03-06 - 00:09
|
557
|
+
content.replace(content[@pcol..@pcol+maxlen-1] || " ")
|
555
558
|
else
|
556
|
-
|
557
|
-
|
559
|
+
## taking care of when scrolling is needed but longest_line is misreported
|
560
|
+
# So we scroll always and need to check 2013-03-06 - 00:09
|
561
|
+
content.replace(content[@pcol..-1]||" ") if @pcol > 0
|
558
562
|
end
|
559
563
|
end
|
560
564
|
content
|
@@ -862,9 +862,11 @@ module RubyCurses
|
|
862
862
|
if !content.nil?
|
863
863
|
if content.length > _maxlen # only show _maxlen
|
864
864
|
@longest_line = content.length if content.length > @longest_line
|
865
|
-
|
865
|
+
## added nil check since we are allowing scrolling in listscrollable anyway 2013-03-06 - 00:14
|
866
|
+
content = content[@pcol..@pcol+_maxlen-1] || " "
|
866
867
|
else
|
867
|
-
|
868
|
+
## added nil check since we are allowing scrolling in listscrollable anyway
|
869
|
+
content = content[@pcol..-1] || " "
|
868
870
|
end
|
869
871
|
end
|
870
872
|
#renderer = get_default_cell_renderer_for_class content.class.to_s
|
@@ -9,7 +9,7 @@
|
|
9
9
|
* Author: rkumar (arunachalesha)
|
10
10
|
* Date: 2008-11-19 12:49
|
11
11
|
* License: Same as Ruby's License (http://www.ruby-lang.org/LICENSE.txt)
|
12
|
-
* Last update:
|
12
|
+
* Last update: 2013-03-05 19:50
|
13
13
|
|
14
14
|
== CHANGES
|
15
15
|
* 2011-10-2 Added PropertyVetoException to rollback changes to property
|
@@ -566,14 +566,14 @@ module RubyCurses
|
|
566
566
|
$log.debug " process_key: found block for #{keycode} , #{ch} "
|
567
567
|
blk = blk1
|
568
568
|
end
|
569
|
-
#$log.debug "called process_key #{object}, kc: #{keycode}, args #{@key_args[keycode]}"
|
570
569
|
if blk.is_a? Symbol
|
571
|
-
#$log.debug "SYMBOL #{blk.to_s} " if $log.debug?
|
572
570
|
if respond_to? blk
|
573
|
-
#$log.debug "SYMBOL calling #{blk.to_s} " if $log.debug?
|
574
571
|
return send(blk, *@key_args[keycode])
|
575
572
|
else
|
573
|
+
## 2013-03-05 - 19:50 why the hell is there an alert here, nowhere else
|
576
574
|
alert "This ( #{self.class} ) does not respond to #{blk.to_s} "
|
575
|
+
# added 2013-03-05 - 19:50 so called can know
|
576
|
+
return :UNHANDLED
|
577
577
|
end
|
578
578
|
else
|
579
579
|
$log.debug "rwidget BLOCK called _process_key " if $log.debug?
|
@@ -685,13 +685,16 @@ module RubyCurses
|
|
685
685
|
_maxlen = @width-@internal_width if _maxlen > @width-@internal_width
|
686
686
|
_maxlen -= @left_margin
|
687
687
|
if !content.nil?
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
688
|
+
cl = content.length
|
689
|
+
if cl > _maxlen # only show maxlen
|
690
|
+
@longest_line = cl if cl > @longest_line
|
691
|
+
## taking care of when scrolling is needed but longest_line is misreported
|
692
|
+
# So we scroll always and need to check 2013-03-06 - 00:09
|
693
|
+
#content.replace content[@pcol..@pcol+_maxlen-1]
|
694
|
+
content.replace(content[@pcol..@pcol+maxlen-1] || " ")
|
692
695
|
else
|
693
|
-
#
|
694
|
-
content.replace
|
696
|
+
#content.replace content[@pcol..-1] if @pcol > 0
|
697
|
+
content.replace(content[@pcol..-1]||" ") if @pcol > 0
|
695
698
|
end
|
696
699
|
end
|
697
700
|
content
|
@@ -7,7 +7,7 @@
|
|
7
7
|
# Author: rkumar http://github.com/rkumar/rbcurse/
|
8
8
|
# Date: 2011-11-09 - 16:59
|
9
9
|
# License: Same as Ruby's License (http://www.ruby-lang.org/LICENSE.txt)
|
10
|
-
# Last update:
|
10
|
+
# Last update: 2013-03-05 19:55
|
11
11
|
#
|
12
12
|
# == CHANGES
|
13
13
|
# == TODO
|
@@ -224,9 +224,10 @@ module RubyCurses
|
|
224
224
|
@formatted_text = nil
|
225
225
|
end
|
226
226
|
|
227
|
+
## moved this line up or else create_p was crashing
|
228
|
+
@window ||= @graphic
|
227
229
|
populate_pad if @_populate_needed
|
228
230
|
#HERE we need to populate once so user can pass a renderer
|
229
|
-
@window ||= @graphic
|
230
231
|
unless @suppress_border
|
231
232
|
if @repaint_all
|
232
233
|
@window.print_border_only @top, @left, @height-1, @width, $datacolor
|
@@ -252,7 +253,7 @@ module RubyCurses
|
|
252
253
|
bind_keys([?j,KEY_DOWN]){ down }
|
253
254
|
bind_key(?\C-e){ scroll_window_down }
|
254
255
|
bind_key(?\C-y){ scroll_window_up }
|
255
|
-
bind_keys([32,338]){ scroll_forward }
|
256
|
+
bind_keys([32,338, ?\C-d]){ scroll_forward }
|
256
257
|
bind_keys([?\C-b,339]){ scroll_backward }
|
257
258
|
bind_key([?',?']){ goto_last_position } # vim , goto last row position (not column)
|
258
259
|
#bind_key(?/, :ask_search)
|
@@ -363,10 +364,12 @@ module RubyCurses
|
|
363
364
|
begin
|
364
365
|
case ch
|
365
366
|
when key(?l)
|
367
|
+
# TODO take multipler
|
366
368
|
@pcol += 1
|
367
369
|
when key(?$)
|
368
370
|
@pcol = @maxcol - 1
|
369
371
|
when key(?h)
|
372
|
+
# TODO take multipler
|
370
373
|
if @pcol > 0
|
371
374
|
@pcol -= 1
|
372
375
|
end
|
@@ -389,8 +392,11 @@ module RubyCurses
|
|
389
392
|
# check for bindings, these cannot override above keys since placed at end
|
390
393
|
begin
|
391
394
|
ret = process_key ch, self
|
395
|
+
## If i press C-x > i get an alert from rwidgets which blacks the screen
|
396
|
+
# if i put a padrefresh here it becomes okay but only for one pad,
|
397
|
+
# i still need to do it for all pads.
|
392
398
|
rescue => err
|
393
|
-
$log.error " TEXTPAD ERROR #{err} "
|
399
|
+
$log.error " TEXTPAD ERROR INS #{err} "
|
394
400
|
$log.debug(err.backtrace.join("\n"))
|
395
401
|
textdialog ["Error in TextPad: #{err} ", *err.backtrace], :title => "Exception"
|
396
402
|
# FIXME why does this result in a blank spot on screen till its refreshed again
|
@@ -400,6 +406,7 @@ module RubyCurses
|
|
400
406
|
end
|
401
407
|
bounds_check
|
402
408
|
rescue => err
|
409
|
+
$log.error " TEXTPAD ERROR 111 #{err} "
|
403
410
|
$log.debug( err) if err
|
404
411
|
$log.debug(err.backtrace.join("\n")) if err
|
405
412
|
textdialog ["Error in TextPad: #{err} ", *err.backtrace], :title => "Exception"
|
@@ -505,8 +512,9 @@ if __FILE__ == $PROGRAM_NAME
|
|
505
512
|
App.new do
|
506
513
|
w = 50
|
507
514
|
w2 = FFI::NCurses.COLS-w-1
|
515
|
+
## create two side by side pads on for ansi and one for ruby
|
508
516
|
p = RubyCurses::TextPad.new @form, :height => FFI::NCurses.LINES, :width => w, :row => 0, :col => 0 , :title => " ansi "
|
509
|
-
fn = "
|
517
|
+
fn = "../../../../examples/data/color.2"
|
510
518
|
text = File.open(fn,"r").readlines
|
511
519
|
p.formatted_text(text, :ansi)
|
512
520
|
RubyCurses::TextPad.new @form, :filename => "textpad.rb", :height => FFI::NCurses.LINES, :width => w2, :row => 0, :col => w+1 , :title => " ruby "
|
data/lib/rbcurse.rb
CHANGED
data/rbcurse-core.gemspec
CHANGED