Skip to content
Browse files

Fixed open_file bug caused by empty input. Thank you to AxeZn for rep…

…orting the bug.
  • Loading branch information...
1 parent 8f54deb commit f4ac4ce5587660553b1f6650c17002b0dd20ba6e @Pistos committed
Showing with 14 additions and 3 deletions.
  1. +1 −0 CHANGELOG
  2. +2 −1 lib/diakonos/functions/buffers.rb
  3. +3 −1 lib/diakonos/readline.rb
  4. +1 −1 lib/diakonos/version.rb
  5. +7 −0 spec/functions/buffer.rb
View
1 CHANGELOG
@@ -7,6 +7,7 @@ Diakonos Changelog
- Fixed -m switch (open matching files).
- Fixed breakage of grepping through all buffers when some buffers are unnamed.
- Fixed bug that prevented type_character from working in macros.
+- Fixed open_file bug caused by empty input.
- Fixed several display bugs.
0.9.0
View
3 lib/diakonos/functions/buffers.rb
@@ -310,6 +310,7 @@ def open_file_ask
open_list_buffer
}
end
+
file = get_user_input(
"Filename: ",
history: @rlh_files,
@@ -317,7 +318,7 @@ def open_file_ask
&finder_block
)
- if file
+ if file && ! file.empty?
open_file file
update_status_line
update_context_line
View
4 lib/diakonos/readline.rb
@@ -36,7 +36,9 @@ def initialize( diakonos, window, start_pos, options = {}, &block )
@icurx = @window.curx
@icury = @window.cury
@view_y = 0
- @window.addstr @initial_text
+ if ! @diakonos.testing
+ @window.addstr @initial_text
+ end
@input_cursor = @initial_text.length
@opened_list_file = false
View
2 lib/diakonos/version.rb
@@ -1,6 +1,6 @@
module Diakonos
VERSION = '0.9.1'
- LAST_MODIFIED = 'August 13, 2011'
+ LAST_MODIFIED = 'August 15, 2011'
def self.parse_version( s )
if s
View
7 spec/functions/buffer.rb
@@ -25,6 +25,13 @@
@d.buffers.map(&:name).should.not.include name
end
+ it 'see nothing untoward happen after attempting to open ""' do
+ $keystrokes = [ Diakonos::ENTER ]
+ lambda {
+ @d.open_file_ask
+ }.should.not.raise Exception
+ end
+
it 'open a file at a specific line number' do
@b = @d.open_file( "#{SAMPLE_FILE_LONGER}:45" )
cursor_should_be_at 44, 0

0 comments on commit f4ac4ce

Please sign in to comment.
Something went wrong with that request. Please try again.