[macruby-changes] [4669] DietRB/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Fri Oct 8 03:56:59 PDT 2010
Revision: 4669
http://trac.macosforge.org/projects/ruby/changeset/4669
Author: eloy.de.enige at gmail.com
Date: 2010-10-08 03:56:58 -0700 (Fri, 08 Oct 2010)
Log Message:
-----------
Oops, don't include the history command itself in the output of history
From: Eloy Duran <eloy.de.enige at gmail.com>
Modified Paths:
--------------
DietRB/trunk/lib/irb/ext/history.rb
DietRB/trunk/spec/history_spec.rb
Modified: DietRB/trunk/lib/irb/ext/history.rb
===================================================================
--- DietRB/trunk/lib/irb/ext/history.rb 2010-10-08 10:56:48 UTC (rev 4668)
+++ DietRB/trunk/lib/irb/ext/history.rb 2010-10-08 10:56:58 UTC (rev 4669)
@@ -36,11 +36,12 @@
history_size = Readline::HISTORY.size
start_index = 0
+ # always remove one extra, because that's the `history' command itself
if history_size <= number_of_entries
- end_index = history_size - 1
+ end_index = history_size - 2
else
- end_index = history_size - 1
- start_index = history_size - number_of_entries
+ end_index = history_size - 2
+ start_index = history_size - number_of_entries - 1
end
start_index.upto(end_index) { |i| print_line(i) }
Modified: DietRB/trunk/spec/history_spec.rb
===================================================================
--- DietRB/trunk/spec/history_spec.rb 2010-10-08 10:56:48 UTC (rev 4668)
+++ DietRB/trunk/spec/history_spec.rb 2010-10-08 10:56:58 UTC (rev 4669)
@@ -91,6 +91,7 @@
" :ok",
" end",
"end",
+ "THIS LINE REPRESENTS THE ENTERED COMMAND AND SHOULD BE OMITTED!"
]
Readline::HISTORY.clear
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20101008/830de355/attachment.html>
More information about the macruby-changes
mailing list