wok diff tpp/stuff/ruby19.patch @ rev 25076

Up marlin (886)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Jun 14 08:17:07 2022 +0000 (2022-06-14)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/tpp/stuff/ruby19.patch	Tue Jun 14 08:17:07 2022 +0000
     1.3 @@ -0,0 +1,294 @@
     1.4 +Description: make key events work on ruby 1.9 
     1.5 +Author: Chad Fowler <chad@chadfowler.com>
     1.6 +Debian-Bug: 671530
     1.7 +
     1.8 +Index: tpp/tpp.rb
     1.9 +===================================================================
    1.10 +--- tpp.orig/tpp.rb	2013-06-12 18:13:40.000000000 +0200
    1.11 ++++ tpp/tpp.rb	2013-06-12 21:05:55.000000000 +0200
    1.12 +@@ -44,7 +44,7 @@
    1.13 +                "blue" => 5,
    1.14 +                "cyan" => 6,
    1.15 +                "magenta" => 7,
    1.16 +-               "black" => 8, 
    1.17 ++               "black" => 8,
    1.18 +                "default" =>-1}
    1.19 +     colors[color]
    1.20 +   end
    1.21 +@@ -95,7 +95,7 @@
    1.22 + end # class FileParser
    1.23 + 
    1.24 + 
    1.25 +-# Represents a page (aka `slide') in TPP. A page consists of a title and one or 
    1.26 ++# Represents a page (aka `slide') in TPP. A page consists of a title and one or
    1.27 + # more lines.
    1.28 + class Page
    1.29 + 
    1.30 +@@ -145,8 +145,8 @@
    1.31 + 
    1.32 + 
    1.33 + 
    1.34 +-# Implements a generic visualizer from which all other visualizers need to be 
    1.35 +-# derived. If Ruby supported abstract methods, all the do_* methods would be 
    1.36 ++# Implements a generic visualizer from which all other visualizers need to be
    1.37 ++# derived. If Ruby supported abstract methods, all the do_* methods would be
    1.38 + # abstract.
    1.39 + class TppVisualizer
    1.40 + 
    1.41 +@@ -154,8 +154,8 @@
    1.42 +     # nothing
    1.43 +   end
    1.44 + 
    1.45 +-  # Splits a line into several lines, where each of the result lines is at most 
    1.46 +-  # _width_ characters long, caring about word boundaries, and returns an array 
    1.47 ++  # Splits a line into several lines, where each of the result lines is at most
    1.48 ++  # _width_ characters long, caring about word boundaries, and returns an array
    1.49 +   # of strings.
    1.50 +   def split_lines(text,width)
    1.51 +     lines = []
    1.52 +@@ -190,13 +190,13 @@
    1.53 +     $stderr.puts "Error: TppVisualizer#do_footer has been called directly."
    1.54 +     Kernel.exit(1)
    1.55 +   end
    1.56 +-  
    1.57 ++
    1.58 +   def do_header(header_text)
    1.59 +     $stderr.puts "Error: TppVisualizer#do_header has been called directly."
    1.60 +     Kernel.exit(1)
    1.61 +   end
    1.62 + 
    1.63 +-    
    1.64 ++
    1.65 +   def do_refresh
    1.66 +     $stderr.puts "Error: TppVisualizer#do_refresh has been called directly."
    1.67 +     Kernel.exit(1)
    1.68 +@@ -316,7 +316,7 @@
    1.69 +     $stderr.puts "Error: TppVisualizer#do_command_prompt has been called directly."
    1.70 +     Kernel.exit(1)
    1.71 +   end
    1.72 +-  
    1.73 ++
    1.74 +   def do_beginslideright
    1.75 +     $stderr.puts "Error: TppVisualizer#do_beginslideright has been called directly."
    1.76 +     Kernel.exit(1)
    1.77 +@@ -377,7 +377,7 @@
    1.78 +     Kernel.exit(1)
    1.79 +   end
    1.80 + 
    1.81 +-  # Receives a _line_, parses it if necessary, and dispatches it 
    1.82 ++  # Receives a _line_, parses it if necessary, and dispatches it
    1.83 +   # to the correct method which then does the correct processing.
    1.84 +   # It returns whether the controller shall wait for input.
    1.85 +   def visualize(line,eop)
    1.86 +@@ -446,10 +446,10 @@
    1.87 +         do_huge(figlet_text)
    1.88 +       when /^--footer /
    1.89 +         @footer_txt = line.sub(/^--footer /,"")
    1.90 +-        do_footer(@footer_txt) 
    1.91 ++        do_footer(@footer_txt)
    1.92 +       when /^--header /
    1.93 +         @header_txt = line.sub(/^--header /,"")
    1.94 +-        do_header(@header_txt) 
    1.95 ++        do_header(@header_txt)
    1.96 +       when /^--title /
    1.97 +         title = line.sub(/^--title /,"")
    1.98 +         do_title(title)
    1.99 +@@ -547,7 +547,7 @@
   1.100 +     @withborder = true
   1.101 +     draw_border
   1.102 +   end
   1.103 +-  
   1.104 ++
   1.105 +   def do_command_prompt()
   1.106 +     message = "Press any key to continue :)"
   1.107 +     cursor_pos = 0
   1.108 +@@ -614,11 +614,11 @@
   1.109 +     (@termwidth-2).times { @screen.addstr("-") }; @screen.addstr("'")
   1.110 +     1.upto(@termheight-3) do |y|
   1.111 +       @screen.move(y,0)
   1.112 +-      @screen.addstr("|") 
   1.113 ++      @screen.addstr("|")
   1.114 +     end
   1.115 +     1.upto(@termheight-3) do |y|
   1.116 +       @screen.move(y,@termwidth-1)
   1.117 +-      @screen.addstr("|") 
   1.118 ++      @screen.addstr("|")
   1.119 +     end
   1.120 +   end
   1.121 + 
   1.122 +@@ -700,7 +700,7 @@
   1.123 +   end
   1.124 + 
   1.125 +   def show_help_page
   1.126 +-    help_text = [ "tpp help", 
   1.127 ++    help_text = [ "tpp help",
   1.128 +                   "",
   1.129 +                   "space bar ............................... display next entry within page",
   1.130 +                   "space bar, cursor-down, cursor-right .... display next page",
   1.131 +@@ -775,7 +775,7 @@
   1.132 +     @screen.move(@termheight - 3, (@termwidth - footer_txt.length)/2)
   1.133 +     @screen.addstr(footer_txt)
   1.134 +   end
   1.135 +- 
   1.136 ++
   1.137 +  def do_header(header_txt)
   1.138 +     @screen.move(@termheight - @termheight+1, (@termwidth - header_txt.length)/2)
   1.139 +     @screen.addstr(header_txt)
   1.140 +@@ -918,7 +918,7 @@
   1.141 +         time_to_sleep = 1.to_f / 20
   1.142 +         Kernel.sleep(time_to_sleep)
   1.143 +         xcount -= 1
   1.144 +-      end  
   1.145 ++      end
   1.146 +     when "right"
   1.147 +       (@termwidth - @indent).times do |pos|
   1.148 +         @screen.move(@cur_line,@termwidth - pos - 1)
   1.149 +@@ -991,7 +991,7 @@
   1.150 +       @screen.move(line,col*15 + 2)
   1.151 +       if current_page == i then
   1.152 +         @screen.printw("%2d %s <=",i+1,pages[i].title[0..80])
   1.153 +-      else  
   1.154 ++      else
   1.155 +         @screen.printw("%2d %s",i+1,pages[i].title[0..80])
   1.156 +       end
   1.157 +       line += 1
   1.158 +@@ -1092,7 +1092,7 @@
   1.159 + 
   1.160 +   def do_footer(footer_text)
   1.161 +   end
   1.162 +-  
   1.163 ++
   1.164 +   def do_header(header_text)
   1.165 +   end
   1.166 + 
   1.167 +@@ -1166,7 +1166,7 @@
   1.168 + 
   1.169 +   def do_revon
   1.170 +   end
   1.171 +- 
   1.172 ++
   1.173 +   def do_command_prompt
   1.174 +   end
   1.175 +   def do_revoff
   1.176 +@@ -1183,7 +1183,7 @@
   1.177 + 
   1.178 +   def do_endslide
   1.179 +   end
   1.180 +-  
   1.181 ++
   1.182 +   def do_beginslideright
   1.183 +   end
   1.184 + 
   1.185 +@@ -1349,7 +1349,7 @@
   1.186 + 
   1.187 + end
   1.188 + 
   1.189 +-# Implements an interactive controller which feeds the visualizer until it is 
   1.190 ++# Implements an interactive controller which feeds the visualizer until it is
   1.191 + # told to stop, and then reads a key press and executes the appropiate action.
   1.192 + class InteractiveController < TppController
   1.193 + 
   1.194 +@@ -1396,17 +1396,17 @@
   1.195 +       loop do
   1.196 +         ch = @vis.get_key
   1.197 +         case ch
   1.198 +-          when 'q'[0], 'Q'[0] # 'Q'uit
   1.199 ++          when ?q.ord, ?Q.ord # 'Q'uit
   1.200 +             return
   1.201 +-          when 'r'[0], 'R'[0] # 'R'edraw slide
   1.202 ++          when ?r.ord, ?R.ord # 'R'edraw slide
   1.203 +             changed_page = true # @todo: actually implement redraw
   1.204 +-          when 'e'[0], 'E'[0]
   1.205 ++          when ?e.ord, ?E.ord
   1.206 +             @cur_page = @pages.size - 1
   1.207 +             break
   1.208 +-          when 's'[0], 'S'[0]
   1.209 ++          when ?s.ord, ?S.ord
   1.210 +             @cur_page = 0
   1.211 +             break
   1.212 +-          when 'j'[0], 'J'[0] # 'J'ump to slide
   1.213 ++          when ?j.ord, ?J.ord # 'J'ump to slide
   1.214 +             screen = @vis.store_screen
   1.215 +             p = @vis.read_newpage(@pages,@cur_page)
   1.216 +             if p >= 0 and p < @pages.size
   1.217 +@@ -1417,28 +1417,28 @@
   1.218 +               @vis.restore_screen(screen)
   1.219 +             end
   1.220 +             break
   1.221 +-          when 'l'[0], 'L'[0] # re'l'oad current file
   1.222 ++          when ?l.ord, ?L.ord # re'l'oad current file
   1.223 +             @reload_file = true
   1.224 +             return
   1.225 +-          when 'c'[0], 'C'[0] # command prompt
   1.226 ++          when ?c.ord, ?C.ord # command prompt
   1.227 +             screen = @vis.store_screen
   1.228 +             @vis.do_command_prompt
   1.229 +             @vis.clear
   1.230 +             @vis.restore_screen(screen)
   1.231 +-          when '?'[0], 'h'[0]
   1.232 ++          when ??.ord, ?h.ord
   1.233 +             screen = @vis.store_screen
   1.234 +             @vis.show_help_page
   1.235 +             ch = @vis.get_key
   1.236 +             @vis.clear
   1.237 +             @vis.restore_screen(screen)
   1.238 +-          when :keyright, :keydown, ' '[0]
   1.239 ++          when :keyright, :keydown, ' '.ord
   1.240 +             if @cur_page + 1 < @pages.size and eop then
   1.241 +               @cur_page += 1
   1.242 +               @pages[@cur_page].reset_eop
   1.243 +               @vis.new_page
   1.244 +             end
   1.245 +             break
   1.246 +-          when 'b'[0], 'B'[0], :keyleft, :keyup
   1.247 ++          when ?b.ord, ?B.ord, :keyleft, :keyup
   1.248 +             if @cur_page > 0 then
   1.249 +               @cur_page -= 1
   1.250 +               @pages[@cur_page].reset_eop
   1.251 +@@ -1455,7 +1455,7 @@
   1.252 + end
   1.253 + 
   1.254 + 
   1.255 +-# Implements a visualizer which converts TPP source to a nicely formatted text 
   1.256 ++# Implements a visualizer which converts TPP source to a nicely formatted text
   1.257 + # file which can e.g. be used as handout.
   1.258 + class TextVisualizer < TppVisualizer
   1.259 + 
   1.260 +@@ -1475,7 +1475,7 @@
   1.261 + 
   1.262 +   def do_footer(footer_text)
   1.263 +   end
   1.264 +-  
   1.265 ++
   1.266 +   def do_header(header_text)
   1.267 +   end
   1.268 + 
   1.269 +@@ -1539,7 +1539,7 @@
   1.270 + 
   1.271 +   def do_revon
   1.272 +   end
   1.273 +- 
   1.274 ++
   1.275 +   def do_command_prompt
   1.276 +   end
   1.277 +   def do_revoff
   1.278 +@@ -1556,7 +1556,7 @@
   1.279 + 
   1.280 +   def do_endslide
   1.281 +   end
   1.282 +-  
   1.283 ++
   1.284 +   def do_beginslideright
   1.285 +   end
   1.286 + 
   1.287 +@@ -1650,8 +1650,8 @@
   1.288 + 
   1.289 + end
   1.290 + 
   1.291 +-# Implements a non-interactive controller to control non-interactive 
   1.292 +-# visualizers (i.e. those that are used for converting TPP source code into 
   1.293 ++# Implements a non-interactive controller to control non-interactive
   1.294 ++# visualizers (i.e. those that are used for converting TPP source code into
   1.295 + # another format)
   1.296 + class ConversionController < TppController
   1.297 +