Module: Diakonos
- Defined in:
- lib/diakonos/installation.rb,
lib/diakonos.rb,
lib/diakonos/ctag.rb,
lib/diakonos/grep.rb,
lib/diakonos/help.rb,
lib/diakonos/list.rb,
lib/diakonos/mode.rb,
lib/diakonos/about.rb,
lib/diakonos/hooks.rb,
lib/diakonos/mouse.rb,
lib/diakonos/range.rb,
lib/diakonos/buffer.rb,
lib/diakonos/config.rb,
lib/diakonos/cursor.rb,
lib/diakonos/keying.rb,
lib/diakonos/search.rb,
lib/diakonos/window.rb,
lib/diakonos/display.rb,
lib/diakonos/finding.rb,
lib/diakonos/key-map.rb,
lib/diakonos/logging.rb,
lib/diakonos/version.rb,
lib/diakonos/bookmark.rb,
lib/diakonos/readline.rb,
lib/diakonos/sessions.rb,
lib/diakonos/clipboard.rb,
lib/diakonos/extension.rb,
lib/diakonos/functions.rb,
lib/diakonos/text-mark.rb,
lib/diakonos/line-mover.rb,
lib/diakonos/buffer/file.rb,
lib/diakonos/buffer/undo.rb,
lib/diakonos/config-file.rb,
lib/diakonos/interaction.rb,
lib/diakonos/buffer/cursor.rb,
lib/diakonos/buffer/delete.rb,
lib/diakonos/clipboard-osx.rb,
lib/diakonos/extension-set.rb,
lib/diakonos/number-fitter.rb,
lib/diakonos/buffer/display.rb,
lib/diakonos/display/format.rb,
lib/diakonos/functions/tags.rb,
lib/diakonos/clipboard-xclip.rb,
lib/diakonos/functions/shell.rb,
lib/diakonos/buffer/searching.rb,
lib/diakonos/buffer/selection.rb,
lib/diakonos/functions/basics.rb,
lib/diakonos/functions/cursor.rb,
lib/diakonos/functions/search.rb,
lib/diakonos/buffer-management.rb,
lib/diakonos/clipboard-klipper.rb,
lib/diakonos/functions/buffers.rb,
lib/diakonos/buffer/bookmarking.rb,
lib/diakonos/buffer/indentation.rb,
lib/diakonos/functions/grepping.rb,
lib/diakonos/functions/readline.rb,
lib/diakonos/functions/sessions.rb,
lib/diakonos/readline/functions.rb,
lib/diakonos/functions/clipboard.rb,
lib/diakonos/functions/selection.rb,
lib/diakonos/interaction-handler.rb,
lib/diakonos/functions-deprecated.rb,
lib/diakonos/functions/bookmarking.rb,
lib/diakonos/functions/indentation.rb,
lib/diakonos/clipboard-klipper-dbus.rb,
lib/diakonos/functions/text-manipulation.rb
Overview
This file is completely overwritten by install.rb upon installation. This copy is here to permit the tests to execute.
Defined Under Namespace
Modules: ConfigFileDescription, Display, Functions, KeyMap, Keying, RangeDelegator Classes: Bookmark, Buffer, CTag, Clipboard, ClipboardKlipper, ClipboardKlipperDBus, ClipboardOSX, ClipboardXClip, ConfigFile, ConfigFileNull, ConfigFileUnreadable, Diakonos, Extension, ExtensionSet, Finding, InteractionHandler, LineMover, Mode, NumberFitter, Range, Readline, Session, TextMark, Window
Constant Summary collapse
- DONT_ADJUST_ROW =
false
- ADJUST_ROW =
true
- PROMPT_OVERWRITE =
true
- DONT_PROMPT_OVERWRITE =
false
- QUIET =
true
- NOISY =
false
- AFTER_CHAR =
true
- ON_CHAR =
false
- INCLUSIVE =
true
- NOT_INCLUSIVE =
false
- DEFAULT_TAB_SIZE =
8
- FORCE_REVERT =
true
- ASK_REVERT =
false
- ASK_REPLACEMENT =
true
- NO_REPLACEMENT =
nil
- CASE_SENSITIVE =
true
- CASE_INSENSITIVE =
false
- LANG_TEXT =
'text'
- BOL_ZERO =
0
- BOL_FIRST_CHAR =
1
- BOL_ALT_ZERO =
2
- BOL_ALT_FIRST_CHAR =
3
- EOL_END =
0
- EOL_LAST_CHAR =
1
- EOL_ALT_END =
2
- EOL_ALT_LAST_CHAR =
3
- DO_REDRAW =
true
- DONT_REDRAW =
false
- VERSION =
'0.9.12'
- LAST_MODIFIED =
'2024-06-20'
- DONT_COMPLETE =
false
- INSTALL_SETTINGS =
{ :prefix => root, :bin_dir => File.join(root, "bin"), :doc_dir => root, :help_dir => File.join(root, "help"), :conf_dir => root, :lib_dir => File.join(root, "lib"), :installed => { :files => [], :dirs => [], }, }
- CLEAR_STACK_POINTER =
true
- DONT_CLEAR_STACK_POINTER =
false
- DIFFERENT_FILE =
true
- NOT_DIFFERENT_FILE =
false
- TAB =
9
- ENTER =
13
- ESCAPE =
27
- BACKSPACE =
127
- CTRL_C =
3
- CTRL_D =
4
- CTRL_K =
11
- CTRL_Q =
17
- CTRL_H =
263
- CTRL_W =
23
- RESIZE2 =
4294967295
- CHOICE_NO =
TODO: Turn the CHOICE_* constants into one or more Hashes?
0
- CHOICE_YES =
1
- CHOICE_ALL =
2
- CHOICE_CANCEL =
3
- CHOICE_YES_TO_ALL =
4
- CHOICE_NO_TO_ALL =
5
- CHOICE_YES_AND_STOP =
6
- CHOICE_DELETE =
7
- CHOICE_WITHIN_SELECTION =
8
Class Method Summary collapse
- .check_ruby_version ⇒ Object
- .grep_array(regexp, array, lines_of_context, prefix, filepath) ⇒ Object
-
.parse_filename_and_line_number(s) ⇒ Array
The filename and line number parsed.
- .parse_version(s) ⇒ Object
Class Method Details
.check_ruby_version ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/diakonos/version.rb', line 11 def self.check_ruby_version ruby_version = parse_version( RUBY_VERSION ) if ruby_version < [ 2, 1 ] $stderr.puts "This version of Diakonos (#{Diakonos::VERSION}) requires Ruby 2.1 or higher." if ruby_version >= [ 2, 0 ] $stderr.puts "Version 0.9.5 is the last version of Diakonos which can run under Ruby 2.0." elsif ruby_version >= [ 1, 9 ] $stderr.puts "Version 0.9.2 is the last version of Diakonos which can run under Ruby 1.9." elsif ruby_version >= [ 1, 8 ] $stderr.puts "Version 0.8.9 is the last version of Diakonos which can run under Ruby 1.8." end exit 1 end end |
.grep_array(regexp, array, lines_of_context, prefix, filepath) ⇒ Object
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 |
# File 'lib/diakonos/grep.rb', line 2 def self.grep_array( regexp, array, lines_of_context, prefix, filepath ) num_lines = array.size line_numbers = [] array.each_with_index do |line,index| next if line !~ regexp start_index = [ 0, index - lines_of_context ].max end_index = [ index + lines_of_context, num_lines-1 ].min (start_index..end_index).each do |i| line_numbers << i end end line_numbers.uniq! results = [] last_i = line_numbers[ 0 ] one_result = [] line_numbers.each do |i| if i - last_i > 1 results << one_result.join( "\n" ) one_result = [] end one_result << ( "#{prefix}#{i+1}: " << ( "%-300s | #{filepath}:#{i+1}" % array[ i ] ) ) last_i = i end if ! one_result.empty? results << one_result.join( "\n" ) end results end |
.parse_filename_and_line_number(s) ⇒ Array
Returns the filename and line number parsed.
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 |
# File 'lib/diakonos.rb', line 126 def self.parse_filename_and_line_number( s ) if( # Ruby s =~ /from (.+):(\d+)/ || # Python s =~ /File "(.+)", line (\d+)/ || # Perl s =~ /at (.+) line (\d+)/ || # generic s =~ /^(.+):(\d+)/ ) [ $1, ( $2.to_i - 1 ) ] else [ s, nil ] end end |
.parse_version(s) ⇒ Object
5 6 7 8 9 |
# File 'lib/diakonos/version.rb', line 5 def self.parse_version( s ) if s s.split( '.' ).map { |part| part.to_i }.extend( Comparable ) end end |