diakonos 0.8.11 → 0.9.8

Sign up to get free protection for your applications and to get access to all the features.
Files changed (111) hide show
  1. checksums.yaml +7 -0
  2. data/CHANGELOG +433 -0
  3. data/LICENCE.md +675 -0
  4. data/bin/diakonos +6 -0
  5. data/diakonos-256-colour.conf +220 -0
  6. data/diakonos.conf +1802 -0
  7. data/help/about-help.dhf +31 -0
  8. data/help/clipboard.dhf +45 -0
  9. data/help/close-file.dhf +6 -0
  10. data/help/code-block-navigation.dhf +16 -0
  11. data/help/column-markers.dhf +15 -0
  12. data/help/config.dhf +69 -0
  13. data/help/cursor-stack.dhf +19 -0
  14. data/help/delete.dhf +41 -0
  15. data/help/extensions.dhf +125 -0
  16. data/help/file-type.dhf +24 -0
  17. data/help/key-mapping.dhf +127 -0
  18. data/help/line-numbers.dhf +22 -0
  19. data/help/macros.dhf +27 -0
  20. data/help/new-file.dhf +6 -0
  21. data/help/open-file.dhf +21 -0
  22. data/help/quit.dhf +7 -0
  23. data/help/resizing.dhf +19 -0
  24. data/help/ruby.dhf +17 -0
  25. data/help/save-file.dhf +10 -0
  26. data/help/scripting.dhf +92 -0
  27. data/help/search.dhf +103 -0
  28. data/help/shell.dhf +60 -0
  29. data/help/speed.dhf +23 -0
  30. data/help/support.dhf +15 -0
  31. data/help/switch-buffers.dhf +15 -0
  32. data/help/tabs.dhf +36 -0
  33. data/help/undo.dhf +9 -0
  34. data/help/uninstall.dhf +18 -0
  35. data/help/welcome.dhf +32 -0
  36. data/help/word-wrap.dhf +17 -0
  37. data/lib/diakonos/about.rb +69 -0
  38. data/lib/diakonos/bookmark.rb +46 -0
  39. data/lib/diakonos/buffer/bookmarking.rb +47 -0
  40. data/lib/diakonos/buffer/cursor.rb +335 -0
  41. data/lib/diakonos/buffer/delete.rb +170 -0
  42. data/lib/diakonos/buffer/display.rb +356 -0
  43. data/lib/diakonos/buffer/file.rb +157 -0
  44. data/lib/diakonos/buffer/indentation.rb +175 -0
  45. data/lib/diakonos/buffer/searching.rb +552 -0
  46. data/lib/diakonos/buffer/selection.rb +360 -0
  47. data/lib/diakonos/buffer/undo.rb +73 -0
  48. data/lib/diakonos/buffer-hash.rb +60 -0
  49. data/lib/diakonos/buffer-management.rb +59 -0
  50. data/lib/diakonos/buffer.rb +698 -0
  51. data/lib/diakonos/clipboard-klipper-dbus.rb +62 -0
  52. data/lib/diakonos/clipboard-klipper.rb +62 -0
  53. data/lib/diakonos/clipboard-osx.rb +59 -0
  54. data/lib/diakonos/clipboard-xclip.rb +60 -0
  55. data/lib/diakonos/clipboard.rb +47 -0
  56. data/lib/diakonos/config-file.rb +67 -0
  57. data/lib/diakonos/config.rb +381 -0
  58. data/lib/diakonos/core-ext/enumerable.rb +15 -0
  59. data/lib/diakonos/core-ext/hash.rb +60 -0
  60. data/lib/diakonos/core-ext/object.rb +6 -0
  61. data/lib/diakonos/core-ext/regexp.rb +6 -0
  62. data/lib/diakonos/core-ext/string.rb +122 -0
  63. data/lib/diakonos/ctag.rb +28 -0
  64. data/lib/diakonos/cursor.rb +27 -0
  65. data/lib/diakonos/display/format.rb +75 -0
  66. data/lib/diakonos/display.rb +336 -0
  67. data/lib/diakonos/extension-set.rb +49 -0
  68. data/lib/diakonos/extension.rb +34 -0
  69. data/lib/diakonos/finding.rb +40 -0
  70. data/lib/diakonos/functions/basics.rb +34 -0
  71. data/lib/diakonos/functions/bookmarking.rb +61 -0
  72. data/lib/diakonos/functions/buffers.rb +489 -0
  73. data/lib/diakonos/functions/clipboard.rb +70 -0
  74. data/lib/diakonos/functions/cursor.rb +264 -0
  75. data/lib/diakonos/functions/grepping.rb +83 -0
  76. data/lib/diakonos/functions/indentation.rb +71 -0
  77. data/lib/diakonos/functions/readline.rb +93 -0
  78. data/lib/diakonos/functions/search.rb +179 -0
  79. data/lib/diakonos/functions/selection.rb +98 -0
  80. data/lib/diakonos/functions/sessions.rb +78 -0
  81. data/lib/diakonos/functions/shell.rb +250 -0
  82. data/lib/diakonos/functions/tags.rb +65 -0
  83. data/lib/diakonos/functions/text-manipulation.rb +196 -0
  84. data/lib/diakonos/functions-deprecated.rb +77 -0
  85. data/lib/diakonos/functions.rb +292 -0
  86. data/lib/diakonos/grep.rb +98 -0
  87. data/lib/diakonos/help.rb +47 -0
  88. data/lib/diakonos/hooks.rb +13 -0
  89. data/lib/diakonos/installation.rb +19 -0
  90. data/lib/diakonos/interaction-handler.rb +216 -0
  91. data/lib/diakonos/interaction.rb +52 -0
  92. data/lib/diakonos/key-map.rb +62 -0
  93. data/lib/diakonos/keying.rb +442 -0
  94. data/lib/diakonos/line-mover.rb +42 -0
  95. data/lib/diakonos/list.rb +59 -0
  96. data/lib/diakonos/logging.rb +27 -0
  97. data/lib/diakonos/mode.rb +17 -0
  98. data/lib/diakonos/mouse.rb +18 -0
  99. data/lib/diakonos/number-fitter.rb +11 -0
  100. data/lib/diakonos/range.rb +31 -0
  101. data/lib/diakonos/readline/functions.rb +82 -0
  102. data/lib/diakonos/readline.rb +222 -0
  103. data/lib/diakonos/search.rb +58 -0
  104. data/lib/diakonos/sessions.rb +257 -0
  105. data/lib/diakonos/sized-array.rb +48 -0
  106. data/lib/diakonos/text-mark.rb +19 -0
  107. data/lib/diakonos/vendor/fuzzy_file_finder.rb +365 -0
  108. data/lib/diakonos/version.rb +25 -0
  109. data/lib/diakonos/window.rb +43 -0
  110. data/lib/diakonos.rb +592 -0
  111. metadata +160 -68
@@ -0,0 +1,92 @@
1
+ # Scripting Diakonos
2
+
3
+ Diakonos has several features and mechanisms that allow you to manipulate it
4
+ using Ruby, a beautiful yet powerful programming language
5
+ (http://www.ruby-lang.org).
6
+
7
+ ## Working with Selected Text
8
+
9
+ Select the text you wish to operate on (by pressing <Ctrl-space> and moving
10
+ the cursor). You can then work with the text in one of three ways:
11
+
12
+ 1. as a contiguous string of characters
13
+ 2. iterating over each line
14
+ 3. as an array of lines
15
+
16
+ ### As a String
17
+
18
+ Press <Shift-F7> to work with the text as if it were one big string (multiple
19
+ for Ruby code that uses the variable "str". For example, entering
20
+
21
+ str.upcase
22
+
23
+ will convert the selected text to uppercase.
24
+
25
+ ### Iterating Over Each Line
26
+
27
+ Press <F7> to iterate over each line of selected text. You will be prompted
28
+ for Ruby code which will act as the body of a Ruby block which uses the
29
+ variable "line" and evaluates to a String. For example:
30
+
31
+ line.strip.squeeze( ' ' )
32
+
33
+ will strip off whitespace from the beginning and end of each line and then
34
+ collapse all consecutive sequences of spaces into single spaces.
35
+
36
+ ### As an Array of Lines
37
+
38
+ Press <Alt-F7> to work with the text as if it were an Array of lines. You
39
+ will be prompted for Ruby code which operates on the array variable "lines".
40
+ For example:
41
+
42
+ lines.find_all { |l| /foo/ === l }
43
+
44
+ will replace the selected lines with the lines that match the regular expression
45
+ /foo/.
46
+
47
+ lines.sort
48
+
49
+ will sort the selected lines.
50
+
51
+ ## Startup Scripts
52
+
53
+ Any file placed in ~/.diakonos/scripts/ will be require-d (as Ruby code) when
54
+ Diakonos starts up. Any valid Ruby code can be placed there. Advanced users
55
+ can even manipulate Diakonos itself by referencing the $diakonos global
56
+ variable.
57
+
58
+ After the startup scripts are require-d, Diakonos evaluates any Ruby code given
59
+ with the -e command line argument. Here is an example of using the -e argument
60
+ to initiate a search on startup:
61
+
62
+ diakonos -e 'find "search expression", case_sensitive: true' filename
63
+
64
+ See also the documentation on extensions.
65
+
66
+ ## Hooks
67
+
68
+ Diakonos provides a means for you to execute arbitrary Ruby code when certain
69
+ events occur. In other words, you can "hook" code onto the events. At
70
+ present, the following hooks are available:
71
+
72
+ :after_buffer_switch
73
+ :after_open
74
+ :after_save
75
+ :after_startup
76
+
77
+ To hook onto one of these events, place code into the ~/.diakonos/scripts/
78
+ directory. Example hook code can be seen at
79
+
80
+ http://github.com/Pistos/dk-git/blob/master/git-branch.rb
81
+
82
+ Your code should create a Proc object (possibly with a block parameter,
83
+ depending on the hook), and then register it with the following syntax:
84
+
85
+ $diakonos.register_proc( my_proc, :after_open )
86
+
87
+ The register_proc method takes an optional third parameter: an integer
88
+ indicating the relative priority for your Proc. Lower numbers are used for
89
+ greater priority (like the UNIX "niceness" level). Procs registered for the
90
+ same hook are executed in order of priority.
91
+
92
+ Tags: script scripts scripting program programming language ruby select selected text manipulate manipulating operate operating change changing work working line lines adjust adjusting hook hooks hooking proc procedure block trigger triggers method function functions start up startup
data/help/search.dhf ADDED
@@ -0,0 +1,103 @@
1
+ # Searching for and Replacing Text
2
+
3
+ ## Executive Summary
4
+
5
+ ### Searching
6
+
7
+ <Ctrl-F> Begin search
8
+ <F3> Find next
9
+ <Ctrl-R> Begin search and replace
10
+
11
+ <Ctrl-Alt-U> Clear match highlighting
12
+ <Alt-F> Begin case-sensitive search
13
+ <Ctrl-Alt-F> Begin upward search
14
+ <Shift-F3> Find next upwards
15
+
16
+ While typing search expression:
17
+
18
+ <Enter> Confirm search expression
19
+ <Esc> <Esc> Abort search
20
+
21
+ ### Grepping
22
+
23
+ <Alt-G> Grep current buffer
24
+ <Alt-Shift-G> Grep all buffers
25
+ <Ctrl-Alt-G> Grep a directory
26
+
27
+ While typing grep expression:
28
+
29
+ <Up>, <Down> Select a grep result to jump to
30
+ <Enter> Jump to selected grep result
31
+ <F5> Decrease context around matches
32
+ <F6> Increase context around matches
33
+ <Esc> <Esc> Abort grep
34
+
35
+
36
+ ## Searching for Text
37
+
38
+ Press <Ctrl-F> to perform a case-insensitive search for text. You will be
39
+ prompted for what to search for. As you type your search expression,
40
+ matching text will be highlighted. You can try it right now as you read this
41
+ document! Press <Ctrl-F> and then type the word "text". Press <Esc> twice to
42
+ abort the search. If the find.return_on_abort setting is set to true, then the
43
+ cursor will return to where it was when the search began. Otherwise, it will
44
+ remain where the last search brought it.
45
+
46
+ What you type will be interpreted as a regular expression. (If you don't know
47
+ what a regular expression is, search the Internet, or read the Wikipedia
48
+ article: http://en.wikipedia.org/wiki/Regular_expression )
49
+
50
+ Press <Enter> to submit your search expression, and Diakonos will keep the
51
+ cursor on the first match it found and select it. That is, it selects the
52
+ closest match below the point where you initiated the search. Press <F3> to
53
+ move the cursor to the next match.
54
+
55
+ To clear the highlighting on matches, press <Ctrl-Alt-U>.
56
+
57
+ ### Advanced Searching
58
+
59
+ Use <Alt-F> to do a case-sensitive regular expression search. <Ctrl-Alt-F>
60
+ will search upwards (backwards), and <Shift-F3> will repeat a search upwards.
61
+
62
+ The findExact function will perform a search which does not consider the
63
+ search expression to be a regular expression, but rather a literal string.
64
+ There is no default key mapping for findExact; use <F12> to modify your
65
+ configuration. Alternatively, you can press <Shift-F2> and enter "findExact"
66
+ to execute the function directly.
67
+
68
+ If you select text before searching, the search will be restricted to the
69
+ selected text. Even repeated searches with <F3> will be restricted.
70
+
71
+ ## Replacing Text
72
+
73
+ Press <Ctrl-R> to replace text. As with searching, you will be prompted for
74
+ what to search for. Press <Enter> to submit your search expression, and then
75
+ you will be prompted for the replacement text. Press <Enter> to submit the
76
+ replacement text.
77
+
78
+ Diakonos will then highlight each individual match and ask whether or not you
79
+ wish to replace the selected text. You can also choose to replace all matches
80
+ throughout the file at once.
81
+
82
+ The search expression you provide is considered a regular expression. You can
83
+ also use parentheses to capture groups, and refer to those groups on your
84
+ replacement string with \1, \2, etc., which correspond to the first group, the
85
+ second group, etc.
86
+
87
+ ## Grepping
88
+
89
+ Press <Ctrl-Alt-G> to begin grepping files under a directory (recursively).
90
+ Specify the directory, then press <Enter>. Then begin typing a regular
91
+ expression. The display will update as you type according to the matches
92
+ found. If you see a match you'd like to jump to, use <Down> (and <Up>) to
93
+ select a match, and press <Enter> to view that line of that file. Press <Esc>
94
+ twice to abort the grep.
95
+
96
+ If you need to see more context around the matches, press <F6> during the grep.
97
+ <F5> reduces the context. The grep.context setting is used for the default
98
+ amount of context to show.
99
+
100
+ Use <Alt-Shift-G> to grep through all open buffers, <Alt-G> to grep only the
101
+ current buffer.
102
+
103
+ Tags: search searching replace replacing find finding text string regex regexp regular expression grep grepping dir dirs directory buffer buffers file files
data/help/shell.dhf ADDED
@@ -0,0 +1,60 @@
1
+ # External Programs
2
+
3
+ Diakonos has several functions available that you can map to keys in order to
4
+ execute external programs, scripts and applications: shell, execute and
5
+ pasteShellResult. Each one takes an optional string argument, which is the
6
+ shell command to execute. If no argument is given, the user is prompted for
7
+ the command to execute.
8
+
9
+ shell will run the command and show the results in a new buffer. execute will
10
+ run the command, and allow you to interact with it, but discard the results.
11
+ pasteShellResult will paste the command's results at the current cursor
12
+ location.
13
+
14
+ The shell command also takes an optional second parameter which lets you
15
+ specify the file to which the shell results are to be written.
16
+
17
+ Press <F2> to specify an arbitrary command to run with 'shell'.
18
+ Press <F8> to specify an arbitrary command to run with 'execute'.
19
+
20
+ ## Shell Variables
21
+
22
+ The command strings to these commands given can contain any of the following
23
+ variables:
24
+
25
+ $f the current buffer's filepath
26
+ $d the current buffer's directory
27
+ $F all current buffer filepaths, space-separated
28
+ $i a string obtained from user input
29
+ $c temp file containing current clipboard text
30
+ $k temp file containing current klipper (KDE clipboard) text
31
+ $s temp file containing currently selected text
32
+
33
+ ## Examples
34
+
35
+ The following examples are found in the default configuration file.
36
+
37
+
38
+ key ctrl+alt+c shell "ruby -c $f"
39
+
40
+ Press <Ctrl-Alt-C> to check the Ruby syntax of the current buffer.
41
+
42
+
43
+ key esc d shell "diff -U 5 -w -b $c $s", "clipboard.diff"
44
+
45
+ Press <Alt-D> to diff the current clipboard text against the currently selected
46
+ text, and write the result to a file named clipboard.diff.
47
+
48
+
49
+ key esc l execute "aspell check $f"
50
+
51
+ Press <Alt-L> to interactively spell check the current file with the aspell
52
+ program. (This keychord is not active in the default configuration.)
53
+
54
+
55
+ key f9 shell "cd $d; git diff --ignore-space-change -- $f", 'git.diff'
56
+
57
+ Press <F9> to see all changes made to the current buffer that have not been
58
+ committed to the git repository yet.
59
+
60
+ Tags: shell system exec execute spawn spawning executing shelling out external program programs application app apps applications variable variables substitute substitution spell spelling check git diff difference
data/help/speed.dhf ADDED
@@ -0,0 +1,23 @@
1
+ # Speeding Up Diakonos
2
+
3
+ Diakonos is known to run a little slower on some less-powerful systems. Here
4
+ are some of the things you can do to speed up Diakonos. Each one involves a
5
+ tradeoff between editor features and speed. You don't need to enact them all,
6
+ just do whatever you need or can sacrifice.
7
+
8
+ - Turn off the context line ("content.visible false" in the config file).
9
+
10
+ - After a successful find, unhighlight the found items, if you don't need to
11
+ see them any more (Ctrl-Alt-U by default).
12
+
13
+ - Turn off syntax highlighting by specifying a file type of "text"
14
+ (Alt-Shift-T to specify the type). Alternatively, just reduce the number or
15
+ complexity of highlight definitions in the language you are using. More
16
+ highlight definitions means more work for Diakonos during display.
17
+
18
+ - If you are using a graphical desktop (such as KDE or Gnome), change the size
19
+ of the window to something smaller, since this will mean fewer characters for
20
+ Diakonos to redraw. Equivalently, for raw console (TTY) users, try a larger
21
+ font size for a similar effect.
22
+
23
+ Tags: slow diakonos speed speed-up speedup fast faster draw redraw screen font context line quick quicker syntax highlight highlighting
data/help/support.dhf ADDED
@@ -0,0 +1,15 @@
1
+ # Support
2
+
3
+ You can chat about Diakonos in the ##pistos channel of the Libera IRC
4
+ network.
5
+
6
+ Go to the IRC channel for technical support, or to give feedback and commentary
7
+ about Diakonos. It's the place go for bug reports, feature requests and tech
8
+ support. Even if Pistos is not around, he will eventually read anything you
9
+ have to say.
10
+
11
+ If IRC is not your thing, you can file bug reports at the issue tracker:
12
+
13
+ https://github.com/Pistos/diakonos/issues
14
+
15
+ Tags: help support technical tech contact email e-mail info information chat irc channel pistos author creator
@@ -0,0 +1,15 @@
1
+ # Switching Buffers
2
+
3
+ To switch between buffers, press Alt-number, with the number corresponding to
4
+ the index of the buffer you wish to change to. For example, <Alt-1> will
5
+ switch to the first buffer, <Alt-3> will switch to the third buffer, and so on.
6
+
7
+ You can also browse through the buffers by pressing <Alt-minus> and <Alt-=>.
8
+
9
+ To bring up a list of the currently open files, press <Ctrl-Alt-B>. There are
10
+ two ways to select a buffer from this list: Either type the number or letter
11
+ shown in the left column corresponding to the file you wish to switch to, or
12
+ use the <Up> and <Down> arrow keys to select a buffer, and press <Enter> to
13
+ switch to it.
14
+
15
+ Tags: switch switching buffer buffers file files change between list current currently open
data/help/tabs.dhf ADDED
@@ -0,0 +1,36 @@
1
+ # Tab Characters
2
+
3
+ ## Indenting with tab characters instead of spaces
4
+
5
+ By default, Diakonos indents with spaces.
6
+
7
+ To insert a single tab character, press <Ctrl-T>.
8
+
9
+ To make Diakonos always indent with tab characters, look for the indent
10
+ settings for the language whose behaviour you wish to configure. For example,
11
+ to change the indentation of Ruby, add the following line to your configuration
12
+ file (<F12>):
13
+
14
+ lang.ruby.indent.using_tabs true
15
+
16
+ ## Changing the width of tab characters
17
+
18
+ The width of a tab character depends on the language of the file. To change
19
+ the width for a specific language, change the tabsize setting for the
20
+ language. For example, to change the tab size of Ruby files, open the
21
+ configuration file by pressing <F12>, and look for a line like this:
22
+
23
+ lang.ruby.tabsize 2
24
+
25
+ Then change the number 2 to whatever number you desire, such as 4.
26
+
27
+ ## Converting tab characters
28
+
29
+ Diakonos can convert tabs to spaces when files are opened. Set the
30
+ convert_tabs configuration option to true:
31
+
32
+ convert_tabs true
33
+
34
+ By default Diakonos does not do this.
35
+
36
+ Tags: tab tabs indent indenting indentation insert space spaces whitespace char character characters width size number
data/help/undo.dhf ADDED
@@ -0,0 +1,9 @@
1
+ # Undoing
2
+
3
+ Use <Ctrl-Z> to undo one or more of the most recent changes you've made to the
4
+ current file. Each file has its own undo history.
5
+
6
+ Use <Ctrl-Y> to redo one or more changes that you've undone.
7
+
8
+
9
+ Tags: undo undoing mistake back revert redo
@@ -0,0 +1,18 @@
1
+ # Uninstalling Diakonos
2
+
3
+ To uninstall Diakonos, simply run diakonos with an --uninstall switch:
4
+
5
+ diakonos --uninstall
6
+
7
+ Diakonos will list all the files and directories that will be removed from your
8
+ system, and prompt you for confirmation. Diakonos does not install hidden
9
+ files that are not shown to you.
10
+
11
+ The only other Diakonos-related files on your system will be under your home
12
+ directory, inside ~/.diakonos . These are not uninstalled, to allow you to
13
+ upgrade Diakonos and preserve your settings and customizations. The
14
+ ~/.diakonos directory can be removed manually, or even edited if you are an
15
+ advanced user.
16
+
17
+
18
+ Tags: install installing installation uninstall uninstalling uninstallation remove removal removing
data/help/welcome.dhf ADDED
@@ -0,0 +1,32 @@
1
+ # Welcome to Diakonos!
2
+
3
+ Hello, and welcome to Diakonos! My name is Pistos; I am the author of Diakonos,
4
+ and I would like to thank you for trying the Diakonos text editor.
5
+
6
+ I have crafted Diakonos with ease of use in mind, so I hope you find it the
7
+ most easy-to-use console text editor available for Linux. If you have any
8
+ suggestions, questions or comments, please share your thoughts in the ##pistos
9
+ channel of the Libera IRC network.
10
+
11
+ ## Getting Started
12
+
13
+ Press <F1> at any time to activate Diakonos' interactive help system.
14
+
15
+ ## Gnome Terminal
16
+
17
+ Gnome Terminal by default has several keyboard shortcuts which conflict with
18
+ Diakonos. For a smoother Diakonos experience, you should disable as many of
19
+ these as you are comfortable with. To edit Gnome Terminal's keyboard
20
+ shortcuts, go to the Edit menu, then select Keyboard Shortcuts. Double click
21
+ a shortcut and press Backspace to disable it; repeat for each shortcut you
22
+ wish to disable.
23
+
24
+ ## Removing the Welcome Message
25
+
26
+ To stop this welcome message from appearing, edit the configuration file (by
27
+ pressing <F12>), add the line "suppress_welcome true", and press <Ctrl-S> to
28
+ save your change.
29
+
30
+
31
+
32
+ Tags: diakonos welcome intro introduction getting started starting new newb newbie remove message
@@ -0,0 +1,17 @@
1
+ # Word Wrap
2
+
3
+ Press <Alt-W> and Diakonos will perform basic word wrapping of the paragraph
4
+ under the cursor. Paragraphs are considered to be delineated by empty lines
5
+ before and after.
6
+
7
+ The wrap_margin setting of a language controls the column at which word
8
+ wrapping will occur. For example, to change the margin for text files, set
9
+ this setting:
10
+
11
+ lang.text.wrap_margin 80
12
+
13
+ where 80 is the maximum line length allowed.
14
+
15
+ Diakonos does not have any facility to do soft wrapping.
16
+
17
+ Tags: word wrap wrapping hard soft cr carriage return paragraph format formatting margin margins column line length conf config configure configuring set setting settings
@@ -0,0 +1,69 @@
1
+ module Diakonos
2
+ class Diakonos
3
+
4
+ def about_write
5
+ File.open( @about_filename, "w" ) do |f|
6
+ inst = ::Diakonos::INSTALL_SETTINGS
7
+
8
+ configs = @configs.map(&:to_s).join("\n")
9
+
10
+ ext_loaded = @extensions.loaded_extensions.sort_by { |e|
11
+ e.name.downcase
12
+ }.map { |e|
13
+ %{
14
+ ### #{e.name} #{e.version}
15
+ #{e.description}
16
+ }.strip
17
+ }.join( "\n\n" )
18
+
19
+ ext_not_loaded = @extensions.not_loaded_extensions.sort.map { |e|
20
+ "### #{e} (NOT LOADED)"
21
+ }.join( "\n" )
22
+
23
+ installation_artifact = File.join(inst[:lib_dir], 'diakonos', 'installation.rb')
24
+ if File.exist?(installation_artifact)
25
+ install_time = File.mtime(installation_artifact)
26
+ else
27
+ install_time = "--"
28
+ end
29
+
30
+ f.puts %{
31
+ # About Diakonos
32
+
33
+ Licence: MIT Licence
34
+ Copyright: Copyright (c) 2004-#{ Time.now.year } Pistos
35
+
36
+ ## Version
37
+
38
+ Version: #{ ::Diakonos::VERSION }
39
+ Code Date: #{ ::Diakonos::LAST_MODIFIED }
40
+ Install Time: #{ install_time }
41
+ Ruby Version: #{ ::RUBY_VERSION }
42
+
43
+ ## Paths
44
+
45
+ Home dir: #{ @diakonos_home }
46
+
47
+ ### Installation
48
+
49
+ Prefix: #{ inst[ :prefix ] }
50
+ Executable dir: #{ inst[ :bin_dir ] }
51
+ Help dir: #{ inst[ :help_dir ] }
52
+ System config dir: #{ inst[ :conf_dir ] }
53
+ System library dir: #{ inst[ :lib_dir ] }
54
+
55
+ ### Configuration Files
56
+
57
+ #{ configs }
58
+
59
+ ## Extensions
60
+
61
+ #{ ext_loaded }
62
+
63
+ #{ ext_not_loaded }
64
+ }.strip
65
+ end
66
+ end
67
+
68
+ end
69
+ end
@@ -0,0 +1,46 @@
1
+ module Diakonos
2
+
3
+ class Bookmark
4
+
5
+ attr_reader :buffer, :row, :col, :name
6
+
7
+ def initialize( buffer, row, col, name = nil )
8
+ @buffer = buffer
9
+ @row = row
10
+ @col = col
11
+ @name = name
12
+ end
13
+
14
+ def == (other)
15
+ return false if other.nil?
16
+ ( @buffer == other.buffer && @row == other.row && @col == other.col )
17
+ end
18
+
19
+ def <=> (other)
20
+ return nil if other.nil?
21
+ comparison = ( $diakonos.buffer_to_number( @buffer ) <=> $diakonos.buffer_to_number( other.buffer ) )
22
+ return comparison if comparison != 0
23
+ comparison = ( @row <=> other.row )
24
+ return comparison if comparison != 0
25
+ @col <=> other.col
26
+ end
27
+
28
+ def < (other)
29
+ ( ( self <=> other ) < 0 )
30
+ end
31
+ def > (other)
32
+ ( ( self <=> other ) > 0 )
33
+ end
34
+
35
+ def shift( row_inc, col_inc )
36
+ row += row_inc
37
+ col += col_inc
38
+ end
39
+
40
+ def to_s
41
+ "[#{@name}|#{@buffer.name}:#{@row+1},#{@col+1}]"
42
+ end
43
+
44
+ end
45
+
46
+ end
@@ -0,0 +1,47 @@
1
+ module Diakonos
2
+
3
+ class Buffer
4
+
5
+ def go_to_next_bookmark
6
+ cur_pos = Bookmark.new( self, @last_row, @last_col )
7
+ next_bm = @bookmarks.find do |bm|
8
+ bm > cur_pos
9
+ end
10
+ if next_bm
11
+ cursor_to( next_bm.row, next_bm.col, DO_DISPLAY )
12
+ end
13
+ end
14
+
15
+ def go_to_previous_bookmark
16
+ cur_pos = Bookmark.new( self, @last_row, @last_col )
17
+ # There's no reverse_find method, so, we have to do this manually.
18
+ prev = nil
19
+ @bookmarks.reverse_each do |bm|
20
+ if bm < cur_pos
21
+ prev = bm
22
+ break
23
+ end
24
+ end
25
+ if prev
26
+ cursor_to( prev.row, prev.col, DO_DISPLAY )
27
+ end
28
+ end
29
+
30
+ def toggle_bookmark
31
+ bookmark = Bookmark.new( self, @last_row, @last_col )
32
+ existing = @bookmarks.find do |bm|
33
+ bm == bookmark
34
+ end
35
+ if existing
36
+ @bookmarks.delete existing
37
+ $diakonos.set_iline "Bookmark #{existing.to_s} deleted."
38
+ else
39
+ @bookmarks.push bookmark
40
+ @bookmarks.sort
41
+ $diakonos.set_iline "Bookmark #{bookmark.to_s} set."
42
+ end
43
+ end
44
+
45
+ end
46
+
47
+ end