all repos — h3rald @ v10

The sources of https://h3rald.com

contents/articles/rawline-020.html

 1
 2
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
-----
title: "New Release: RawLine 0.2.0"
content-type: article
timestamp: 1207107180
tags: "ruby|programming|opensource|rawline"
-----
<p><del>InLine</del> RawLine 0.2.0 is out!</p>
<p>*Raw*Line is the new name for InLine, in case you didn't guess. The name was changed to avoid name collision problems
	with the RubyInline project.</p>
<p>Here's what's new:</p>
<ul>
	<li>Added /examples and /test directory to gem.</li>
	<li>Escape codes can now be used in prompt.</li>
	<li>It is now possible to use bind(key, &amp;block) with a String as key, even if the corresponding escape sequence
		is not defined.</li>
	<li>Added Editor#write_line(string) to print a any string (and &#8220;hit return&#8221;).</li>
	<li>Library name changed to &#8220;RawLine&#8221; to avoid name collision issues (Bug <a
			href="http://rubyforge.org/tracker/?func=detail&amp;aid=18879&amp;group_id=5622&amp;atid=21788">18879</a>).
	</li>
	<li>Provided alternative implementation for left and right arrows if terminal<br />
		supports escape sequences (on Windows, it requires the Win32Console gem).</li>
</ul>
<p>In particular, I decided to provide an &#8220;optimized implementation&#8221; for the left and right arrows using
	escape sequences rather than shameful hacks. This is now possible because the Win32Console gem now enables <span
		class="caps">ANSI</span> escape sequences on Windows as well (weehee!).</p>
<p>So:</p>
<ul>
	<li>If you're on *nix all good, your terminal is smart and can understand escape sequences =&gt; the new
		implementation will be used.</li>
	<li>If you're on Windows and you installed Win32Console, your termnal is smart and can understand escape sequences
		=&gt; the new implementation will be used.</li>
	<li>If you're on Windows and you didn't install Win32Console, then your terminal is stupid and it doesn't understand
		escape sequences, so the old implementation will be used.</li>
</ul>
<p>The new implementation is significantly faster than the old one, on Windows at least, and the cursor now blinks
	properly when left or right arrows are pressed.</p>
<p>I re-emplemented only cursor movement because I'm still having some problems in getting the delete/insert escapes to
	work properly (or better: how I want them to work!).</p>