lib/repl.rb in runeblog-0.1.5 vs lib/repl.rb in runeblog-0.1.6
- old
+ new
@@ -6,11 +6,11 @@
# make_exception(:EditorProblem, "Could not edit $1")
module RuneBlog::REPL
def edit_file(file)
- result = system("#{blog.editor} #{file}")
+ result = system("#{@blog.editor} #{file}")
raise EditorProblem(file) unless result
STDSCR.clear
end
def cmd_quit(arg)
@@ -117,19 +117,24 @@
def cmd_change_view(arg)
reset_output
# Simplify this
if arg.nil?
+ viewnames = @blog.views.map {|x| x.name }
+ n = viewnames.find_index(@blog.view.name)
+ k, name = RubyText.menu(c: 30, items: viewnames, curr: n)
+ @blog.view = name
output bold(@blog.view)
- return [true, @out]
+ puts "\n ", fx(name, :bold), "\n"
+ return [false, @out]
else
if @blog.view?(arg)
@blog.view = arg # reads config
output red("View: ") + bold(@blog.view.name.to_s) # FIXME?
end
end
- return [true, @out]
+ return [false, @out]
end
def cmd_new_view(arg)
reset_output
@blog.create_view(arg)
@@ -194,9 +199,10 @@
def cmd_list_views(arg)
reset_output("\n")
check_empty(arg)
puts
@blog.views.each do |v|
+ debug "v = #{v.inspect}"
v = v.to_s
v = fx(v, :bold) if v == @blog.view.name
print " "
puts v
end