Added text readability check to openFile command.

This commit is contained in:
pistos 2004-08-25 14:22:51 +00:00
parent e69df4bc7a
commit ef09445989
4 changed files with 44 additions and 18 deletions

View file

@ -1,31 +1,36 @@
Diakonos Changelog
------------------
0.7.1
- The openFile command now uses /usr/bin/file (if available) to check if the
file is readable (text), prompting to confirm open if it isn't.
0.7.0
- Adjusted buffer management system so that, internally, absolute file paths
are used.
are used.
- Added limited (line-number-based) ctags support. Commands: goToTag,
goToTagUnderCursor, popTag.
goToTagUnderCursor, popTag.
- Fixed revert command bug.
- Added an evaluate command, which lets you run any Diakonos command.
- Fixed display bug where Diakonos errors (Ruby exceptions) would ruin the
curses display.
curses display.
- Malformed regular expressions given for regexp searching are now searched
for as literal text, instead of just throwing an error.
for as literal text, instead of just throwing an error.
- Keychains that have no assignment are now shown in full on the interaction
line.
line.
- Error message for some caught exceptions now includes a listing of probable
causes.
causes.
0.6.13
- Fixed the bug where searching backwards from the start of a line will cause
the search to start from the end of the line, instead of from the end of the
next line up.
the search to start from the end of the line, instead of from the end of the
next line up.
- Added a "seek" command, which is a sort of silent find. Used for
implementing features like go to next word and previous word.
implementing features like go to next word and previous word.
- Adjusted default conf file to include alternate ANSI sequences for function
keys.
keys.
- Context line truncation now omits the more proximate code, not the less
proximate code.
proximate code.

2
README
View file

@ -8,4 +8,4 @@ Send comments, feedback and tech support requests to irc.freenode.net:6667#geobo
or http://purepistos.net/forums .
Pistos
http://purepistos.net/diakonos
http://purepistos.net/diakonos

View file

@ -1928,8 +1928,8 @@ class Diakonos
attr_reader :win_main, :settings, :token_regexps, :close_token_regexps, :token_formats, :diakonos_home, :diakonos_conf, :display_mutex
attr_reader :indenters, :unindenters, :clipboard, :current_buffer
VERSION = "0.7.0"
LAST_MODIFIED = "August 23, 2004"
VERSION = "0.7.1"
LAST_MODIFIED = "August 25, 2004"
DONT_ADJUST_ROW = false
ADJUST_ROW = true
@ -3293,9 +3293,30 @@ class Diakonos
end
if do_open
buffer = Buffer.new( self, filename, read_only )
@buffers[ buffer_key ] = buffer
switchTo( buffer )
# Is file readable?
# Does the "file" utility exist?
if FileTest.exist? "/usr/bin/file" and filename != nil
file_type = `/usr/bin/file #{filename}`
if file_type !~ /text/
choice = getChoice(
"#{filename} doesn't appear readable. Open anyway?",
[ CHOICE_YES, CHOICE_NO ],
CHOICE_NO
)
case choice
when CHOICE_NO
do_open = false
end
end
end
if do_open
buffer = Buffer.new( self, filename, read_only )
@buffers[ buffer_key ] = buffer
switchTo( buffer )
end
end
return buffer

View file

@ -387,7 +387,7 @@ lang.ruby.context.ignore ^=(begin|end)$
# Perl
lang.perl.filemask \.pl$
lang.perl.filemask \.(?:pl|pm)$
lang.perl.bangmask perl
lang.perl.format.default white bold
lang.perl.format.selection inverse