diakonos 0.8.3 → 0.8.4
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG +18 -0
- data/README +12 -11
- data/diakonos.conf +102 -39
- data/lib/diakonos.rb +119 -38
- data/lib/diakonos/array.rb +6 -1
- data/lib/diakonos/buffer.rb +89 -16
- data/lib/diakonos/readline.rb +40 -13
- data/lib/diakonos/string.rb +20 -19
- metadata +62 -55
data/CHANGELOG
CHANGED
@@ -1,6 +1,24 @@
|
|
1
1
|
Diakonos Changelog
|
2
2
|
------------------
|
3
3
|
|
4
|
+
0.8.5
|
5
|
+
|
6
|
+
- Added 256 colour support.
|
7
|
+
|
8
|
+
0.8.4
|
9
|
+
|
10
|
+
- Added joinLines function.
|
11
|
+
- Added "yes and (s)top" as a find-and-replace option.
|
12
|
+
- Added '-h' to be synonymous with '--help'.
|
13
|
+
- Added "Ctrl-Q to quit" to opening message.
|
14
|
+
- Added close_code feature.
|
15
|
+
- Added list selection.
|
16
|
+
- Added buffer selection.
|
17
|
+
- Added delete_newline_on_delete_to_eol option.
|
18
|
+
- Added select_block command.
|
19
|
+
- Slight (8%) display performance improvement.
|
20
|
+
- Moved source code from svn to github.com.
|
21
|
+
|
4
22
|
0.8.3
|
5
23
|
|
6
24
|
- Extended ASCII characters (128 to 254) are now typeable.
|
data/README
CHANGED
@@ -7,20 +7,18 @@ INSTALLATION
|
|
7
7
|
============
|
8
8
|
|
9
9
|
There are three ways to install Ruby:
|
10
|
-
|
11
|
-
|
12
|
-
|
10
|
+
* by rubygems (recommended)
|
11
|
+
* from the tarball using setup.rb
|
12
|
+
* manual file copy
|
13
13
|
|
14
|
-
Installing via Rubygems
|
15
|
-
-----------------------
|
14
|
+
=== Installing via Rubygems ===
|
16
15
|
|
17
16
|
Since version 0.8.3, this is the recommended way of installing Diakonos.
|
18
17
|
Run the following command as a user with appropriate permissions:
|
19
18
|
|
20
19
|
gem install diakonos
|
21
|
-
|
22
|
-
|
23
|
-
------------------------
|
20
|
+
|
21
|
+
=== Installing from tarball using setup.rb ===
|
24
22
|
|
25
23
|
First obtain the diakonos tarball. This can be found at
|
26
24
|
http://purepistos.net/diakonos . Unpack the tarball somewhere.
|
@@ -39,8 +37,7 @@ such as /usr/bin; and copies lib/* into the system-wide ruby library path,
|
|
39
37
|
such as /usr/lib/ruby/site_ruby/1.8 . You may need root priveleges on the
|
40
38
|
system in order to install to system-wide places like /usr/bin .
|
41
39
|
|
42
|
-
Installing by
|
43
|
-
-------------------------
|
40
|
+
=== Installing from tarball by manual copy ===
|
44
41
|
|
45
42
|
First obtain the diakonos tarball. This can be found at
|
46
43
|
http://purepistos.net/diakonos .
|
@@ -68,8 +65,12 @@ For a quick introduction, see
|
|
68
65
|
|
69
66
|
http://wiki.purepistos.net/doku.php?id=Diakonos:Getting-Started
|
70
67
|
|
68
|
+
----------------------------------------------------------------
|
69
|
+
|
70
|
+
The source code repository is at http://github.com/Pistos/diakonos/tree/master .
|
71
|
+
|
71
72
|
Send comments, feedback and tech support requests to
|
72
|
-
irc.freenode.net:6667#mathetes or http://purepistos.net
|
73
|
+
irc.freenode.net:6667#mathetes or http://linis.purepistos.net .
|
73
74
|
|
74
75
|
Pistos
|
75
76
|
http://purepistos.net/diakonos
|
data/diakonos.conf
CHANGED
@@ -30,6 +30,8 @@ bol_behaviour alternating-first-char
|
|
30
30
|
# Ensures saved files end with a newline character by adding it if necessary.
|
31
31
|
eof_newline false
|
32
32
|
|
33
|
+
delete_newline_on_delete_to_eol false
|
34
|
+
|
33
35
|
# Specifies whether the cursor should be at the end (false) of found text, or the
|
34
36
|
# beginning (true).
|
35
37
|
found_cursor_start false
|
@@ -38,7 +40,7 @@ max_clips 30
|
|
38
40
|
|
39
41
|
# The maximum number of undo lines held in memory per file
|
40
42
|
# Smaller files will be able to have more undo levels.
|
41
|
-
max_undo_lines
|
43
|
+
max_undo_lines 16384
|
42
44
|
|
43
45
|
convert_tabs false
|
44
46
|
|
@@ -123,16 +125,20 @@ key home;cursorBOL
|
|
123
125
|
key esc O H;cursorBOL
|
124
126
|
key esc [ H;cursorBOL
|
125
127
|
key esc [ 1 ~ cursorBOL
|
128
|
+
key esc [ 7 ~ cursorBOL
|
126
129
|
key end;cursorEOL
|
127
130
|
key esc O F;cursorEOL
|
128
131
|
key esc [ F;cursorEOL
|
129
132
|
key esc [ 4 ~;cursorEOL
|
133
|
+
key esc [ 8 ~;cursorEOL
|
130
134
|
key pageup;pageUp
|
131
135
|
key pagedown;pageDown
|
132
136
|
key ctrl+a;cursorBOL
|
133
137
|
key ctrl+e;cursorEOL
|
134
138
|
key alt+<;cursorBOF
|
139
|
+
key esc [ 1 ; 5 H cursorBOF
|
135
140
|
key alt+>;cursorEOF
|
141
|
+
key esc [ 1 ; 5 F cursorEOF
|
136
142
|
key alt+,;cursorTOV
|
137
143
|
key alt+.;cursorBOV
|
138
144
|
key ctrl+j;cursorReturn
|
@@ -151,10 +157,12 @@ key esc right;seek /(?:^|\W)(\w)|\w(\W|$)/
|
|
151
157
|
key esc [ 1 ; 3 C seek /\w(\W|$)|(?:^|\W)(\w)/
|
152
158
|
key esc [ 1 ; 5 C seek /\w(\W|$)|(?:^|\W)(\w)/
|
153
159
|
key keycode517 seek /\w(\W|$)|(?:^|\W)(\w)/
|
160
|
+
key keycode518 seek /\w(\W|$)|(?:^|\W)(\w)/
|
154
161
|
key esc left;seek /\w(\W|$)|(?:^|\W)(\w)/, "up"
|
155
162
|
key esc [ 1 ; 3 D seek /\w(\W|$)|(?:^|\W)(\w)/, "up"
|
156
163
|
key esc [ 1 ; 5 D seek /\w(\W|$)|(?:^|\W)(\w)/, "up"
|
157
164
|
key keycode515 seek /\w(\W|$)|(?:^|\W)(\w)/, "up"
|
165
|
+
key keycode516 seek /\w(\W|$)|(?:^|\W)(\w)/, "up"
|
158
166
|
|
159
167
|
key ctrl+g;goToLineAsk
|
160
168
|
key alt+b alt+b;toggleBookmark
|
@@ -192,10 +200,12 @@ key tab;parsedIndent
|
|
192
200
|
key alt+i;indent
|
193
201
|
key esc i;indent
|
194
202
|
key esc I;unindent
|
203
|
+
key esc [ Z unindent
|
195
204
|
key keycode353 unindent
|
196
205
|
#key tab;insertSpaces 4
|
197
206
|
#key tab;insertTab
|
198
207
|
key ctrl+t;insertTab
|
208
|
+
key alt+j joinLines
|
199
209
|
|
200
210
|
key f1 help
|
201
211
|
key esc O P help
|
@@ -233,12 +243,19 @@ key alt+9;switchToBufferNumber 9
|
|
233
243
|
key alt+0;switchToBufferNumber 10
|
234
244
|
key alt+-;switchToPreviousBuffer
|
235
245
|
key alt+=;switchToNextBuffer
|
246
|
+
key ctrl+alt+b list_buffers
|
236
247
|
|
237
248
|
key ctrl+space;anchorSelection
|
238
249
|
#key ctrl+space;toggleSelection
|
239
250
|
key ctrl+c;copySelection
|
240
251
|
key ctrl+x;cutSelection
|
241
252
|
key alt+u;removeSelection
|
253
|
+
key ctrl+b select_block
|
254
|
+
# Select file diff in a patch
|
255
|
+
key ctrl+alt+d f select_block /^Index: /, /^(Index: |$)/, false
|
256
|
+
# Select a diff hunk in a patch
|
257
|
+
key ctrl+alt+d h select_block /^@@ /, /^(@@ |$)/, false
|
258
|
+
|
242
259
|
key ctrl+alt+v;showClips
|
243
260
|
key ctrl+v;paste
|
244
261
|
key ctrl+y;unundo
|
@@ -262,6 +279,7 @@ key esc [ 2 8 ~ findAgain "up"
|
|
262
279
|
key esc O 2 R;findAgain "up"
|
263
280
|
key ctrl+r;searchAndReplace
|
264
281
|
key ctrl+alt+u;clearMatches
|
282
|
+
key alt+c;close_code
|
265
283
|
|
266
284
|
key f2 shell
|
267
285
|
key esc O Q shell
|
@@ -276,7 +294,6 @@ key f14 evaluate
|
|
276
294
|
key esc O 2 Q evaluate
|
277
295
|
esc [ 2 6 ~ evaluate
|
278
296
|
key ctrl+alt+c;shell "ruby -c $f"
|
279
|
-
key ctrl+alt+d;shell "php -l $f"
|
280
297
|
|
281
298
|
# To use the following:
|
282
299
|
# 1) Copy to the clipboard some Ruby code which operates on stdin text and outputs to stdout.
|
@@ -302,7 +319,10 @@ key f6;repeatLast
|
|
302
319
|
key esc [ 1 7 ~;repeatLast
|
303
320
|
key f7;operateOnEachLine
|
304
321
|
key f19;operateOnString
|
305
|
-
key esc
|
322
|
+
key esc [ 1 8 ; 2 ~ operateOnString
|
323
|
+
key esc f7 operateOnLines
|
324
|
+
key esc [ 1 8 ; 3 ~ operateOnLines
|
325
|
+
key keycode319 operateOnLines
|
306
326
|
|
307
327
|
# Emacs-like keychains
|
308
328
|
|
@@ -318,8 +338,9 @@ key esc f7;operateOnLines
|
|
318
338
|
#
|
319
339
|
# For a list of colour names, see the list of format codes in the
|
320
340
|
# Language Definitions section, below.
|
321
|
-
#
|
322
|
-
# colour than the
|
341
|
+
#
|
342
|
+
# With this colour command you can set a different background colour than the
|
343
|
+
# terminal default.
|
323
344
|
#
|
324
345
|
# color is a synonym for colour.
|
325
346
|
colour 8 white blue
|
@@ -364,12 +385,14 @@ lang.text.indent.roundup false
|
|
364
385
|
#lang.text.indent.using_tabs true
|
365
386
|
lang.text.tabsize 8
|
366
387
|
|
367
|
-
|
388
|
+
# XML
|
389
|
+
|
390
|
+
lang.xml.filemask \.(xml|xsl|rdl|aiml|xhtml)$
|
368
391
|
lang.xml.format.default white
|
369
392
|
lang.xml.format.selection inverse
|
370
393
|
lang.xml.format.found yellow inverse
|
371
394
|
lang.xml.tabsize 8
|
372
|
-
lang.xml.indent.size
|
395
|
+
lang.xml.indent.size 2
|
373
396
|
lang.xml.indent.auto true
|
374
397
|
lang.xml.indent.roundup true
|
375
398
|
#lang.xml.indent.using_tabs true
|
@@ -387,11 +410,13 @@ lang.xml.tokens.template.open \[@--
|
|
387
410
|
lang.xml.tokens.template.close --@\]
|
388
411
|
lang.xml.tokens.template.format brown
|
389
412
|
lang.xml.tokens.template.change_to perl
|
413
|
+
lang.xml.closers.tag.regexp <([^/> ]*)
|
414
|
+
lang.xml.closers.tag.closer { |m| "</" + m[ 1 ] + ">" }
|
390
415
|
lang.xml_tag.format.default white bold
|
391
416
|
lang.xml_tag.format.selection inverse
|
392
417
|
lang.xml_tag.format.found yellow inverse
|
393
418
|
lang.xml_tag.tabsize 8
|
394
|
-
lang.xml_tag.indent.size
|
419
|
+
lang.xml_tag.indent.size 2
|
395
420
|
lang.xml_tag.indent.auto true
|
396
421
|
lang.xml_tag.indent.roundup true
|
397
422
|
#lang.xml_tag.indent.using_tabs true
|
@@ -399,23 +424,25 @@ lang.xml_tag.tokens.doublequoted_strings (\".*?[^\\]\")
|
|
399
424
|
lang.xml_tag.tokens.doublequoted_strings.format green bold
|
400
425
|
lang.xml_tag.tokens.singlequoted_strings ('.*?[^\\]')
|
401
426
|
lang.xml_tag.tokens.singlequoted_strings.format green bold
|
402
|
-
lang.xml_tag.tokens.
|
403
|
-
lang.xml_tag.tokens.
|
427
|
+
lang.xml_tag.tokens.non_alphanum ([@!#$%^&*()\[\]{}/?=+\-\\|,<.>;:])
|
428
|
+
lang.xml_tag.tokens.non_alphanum.format white
|
429
|
+
lang.xml_tag.tokens.namespaces ([a-zA-Z_-]+):
|
430
|
+
lang.xml_tag.tokens.namespaces.format yellow bold
|
404
431
|
lang.xml_comment.format.default 8
|
405
432
|
lang.xml_comment.format.selection inverse
|
406
433
|
lang.xml_comment.format.found yellow inverse
|
407
434
|
lang.xml_comment.tabsize 8
|
408
|
-
lang.xml_comment.indent.size
|
435
|
+
lang.xml_comment.indent.size 2
|
409
436
|
lang.xml_comment.indent.auto true
|
410
437
|
lang.xml_comment.indent.roundup true
|
411
438
|
#lang.xml_comment.indent.using_tabs true
|
412
439
|
|
413
|
-
lang.html.filemask \.(
|
440
|
+
lang.html.filemask \.([rx]?html?|php|asp)$
|
414
441
|
lang.html.format.default white
|
415
442
|
lang.html.format.selection inverse
|
416
443
|
lang.html.format.found yellow inverse
|
417
444
|
lang.html.tabsize 8
|
418
|
-
lang.html.indent.size
|
445
|
+
lang.html.indent.size 2
|
419
446
|
lang.html.indent.auto true
|
420
447
|
lang.html.indent.roundup true
|
421
448
|
#lang.html.indent.using_tabs true
|
@@ -429,6 +456,14 @@ lang.html.tokens.eruby.open <%
|
|
429
456
|
lang.html.tokens.eruby.close %>
|
430
457
|
lang.html.tokens.eruby.format 9 bold
|
431
458
|
lang.html.tokens.eruby.change_to ruby
|
459
|
+
lang.html.tokens.ezamar.open <\?r
|
460
|
+
lang.html.tokens.ezamar.close \?>
|
461
|
+
lang.html.tokens.ezamar.format 9 bold
|
462
|
+
lang.html.tokens.ezamar.change_to ruby
|
463
|
+
lang.html.tokens.ezamar-value.open \#\{
|
464
|
+
lang.html.tokens.ezamar-value.close \}
|
465
|
+
lang.html.tokens.ezamar-value.format 9 bold
|
466
|
+
lang.html.tokens.ezamar-value.change_to ruby
|
432
467
|
lang.html.tokens.php.open <\?(?:php)?
|
433
468
|
lang.html.tokens.php.close \?>
|
434
469
|
lang.html.tokens.php.format 10 bold
|
@@ -437,6 +472,8 @@ lang.html.tokens.comments.open (<!--)
|
|
437
472
|
lang.html.tokens.comments.close (-->)
|
438
473
|
lang.html.tokens.comments.format 8
|
439
474
|
lang.html.tokens.comments.change_to html_comment
|
475
|
+
lang.html.closers.tag.regexp <([^/> ]*)
|
476
|
+
lang.html.closers.tag.closer { |m| "</" + m[ 1 ] + ">" }
|
440
477
|
lang.html_tag.format.default white bold
|
441
478
|
lang.html_tag.format.selection inverse
|
442
479
|
lang.html_tag.format.found yellow inverse
|
@@ -455,8 +492,8 @@ lang.html_tag.tokens.doublequoted_strings (\".*?[^\\]\")
|
|
455
492
|
lang.html_tag.tokens.doublequoted_strings.format green bold
|
456
493
|
lang.html_tag.tokens.singlequoted_strings ('.*?[^\\]')
|
457
494
|
lang.html_tag.tokens.singlequoted_strings.format green bold
|
458
|
-
lang.html_tag.tokens.
|
459
|
-
lang.html_tag.tokens.
|
495
|
+
lang.html_tag.tokens.non_alphanum ([@!#$%^&*()\[\]{}/?=+\-\\|,<.>;:])
|
496
|
+
lang.html_tag.tokens.non_alphanum.format white
|
460
497
|
lang.html_comment.format.default 8
|
461
498
|
lang.html_comment.format.selection inverse
|
462
499
|
lang.html_comment.format.found yellow inverse
|
@@ -480,7 +517,7 @@ lang.css.indent.roundup true
|
|
480
517
|
lang.css.indent.indenters (\{)
|
481
518
|
lang.css.indent.unindenters (\})
|
482
519
|
lang.css.indent.preventers (\".+?[^\\]\")|('.+?[^\\]')|(\/\/.*)
|
483
|
-
lang.css.tokens.properties \b(azimuth|background-attachment|background-color|background-image|background-position|background-repeat|background|border-collapse|border-color|border-spacing|border-style|border-top|border-bottom|border-right|border-left|border-top-color|border-top-style|border-top-width|border-width|border|bottom|caption-side|clear|clip|color|content|counter-increment|counter-reset|cue-after|cue-before|cue|cursor|direction|display|elevation|empty-cells|float|font-family|font-size|font-style|font-variant|font-weight|font|height|left|letter-spacing|line-height|list-style-image|list-style-position|list-style-type|list-style|margin-right|margin-top|margin-left|margin-bottom|margin|max-height|max-width|min-height|min-width|orphans|outline-color|outline-style|outline-width|outline|overflow|padding-top|padding-left|padding-right|padding-bottom|padding|page-break-after|page-break-before|page-break-inside|pause-after|pause-before|pause|pitch-range|pitch|play-during|position|quotes|richness|right|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|table-layout|text-align|text-decoration|text-indent|text-transform|top|unicode-bidi|vertical-align|visibility|voice-family|volume|white-space|widows|width|word-spacing|z-index)
|
520
|
+
lang.css.tokens.properties \b(azimuth|background-attachment|background-color|background-image|background-position|background-repeat|background|border-collapse|border-color|border-spacing|border-style|border-top|border-bottom|border-right|border-left|border-top-color|border-top-style|border-top-width|border-width|border|bottom|caption-side|clear|clip|color|content|counter-increment|counter-reset|cue-after|cue-before|cue|cursor|direction|display|elevation|empty-cells|float|font-family|font-size|font-style|font-variant|font-weight|font|height|left|letter-spacing|line-height|list-style-image|list-style-position|list-style-type|list-style|margin-right|margin-top|margin-left|margin-bottom|margin|max-height|max-width|min-height|min-width|orphans|outline-color|outline-style|outline-width|outline|overflow|padding-top|padding-left|padding-right|padding-bottom|padding|page-break-after|page-break-before|page-break-inside|pause-after|pause-before|pause|pitch-range|pitch|play-during|position|quotes|richness|right|speak-header|speak-numeral|speak-punctuation|speak|speech-rate|stress|table-layout|text-align|text-decoration|text-indent|text-transform|top|unicode-bidi|vertical-align|visibility|voice-family|volume|white-space|widows|width|word-spacing|z-index)\s*:
|
484
521
|
lang.css.tokens.properties.format white bold
|
485
522
|
lang.css.tokens.colours #[A-Fa-f0-9]{6}|\b(?:aqua|black|blue|fuchsia|gray|green|lime|maroon|navy|olive|orange|purple|red|silver|teal|white|yellow)\b
|
486
523
|
lang.css.tokens.colours.format yellow bold
|
@@ -507,10 +544,12 @@ lang.ruby.tokens.reserved_words \b(__FILE__|and|def|end|in|or|self|unless|__LINE
|
|
507
544
|
lang.ruby.tokens.reserved_words.format white
|
508
545
|
lang.ruby.tokens.constants \b([A-Z_]+|[A-Z_][A-Z0-9_]+)\b
|
509
546
|
lang.ruby.tokens.constants.format yellow bold
|
510
|
-
lang.ruby.tokens.symbols
|
511
|
-
lang.ruby.tokens.symbols.format white
|
512
|
-
lang.ruby.tokens.
|
513
|
-
lang.ruby.tokens.
|
547
|
+
lang.ruby.tokens.symbols (:[a-z_][a-z_0-9]*)
|
548
|
+
lang.ruby.tokens.symbols.format white bold
|
549
|
+
lang.ruby.tokens.non_alphanum [@!#$%^&*()\[\]{}/?=+\-\\|,<.>;~]
|
550
|
+
lang.ruby.tokens.non_alphanum.format white
|
551
|
+
lang.ruby.tokens.instance_variables (@[A-Za-z_][A-Za-z_0-9]*)
|
552
|
+
lang.ruby.tokens.instance_variables.format white bold
|
514
553
|
lang.ruby.tokens.comments (#.*)
|
515
554
|
lang.ruby.tokens.comments.format 8 bold
|
516
555
|
lang.ruby.tokens.regular_expressions (\/.+?[^\\]\/)
|
@@ -519,10 +558,28 @@ lang.ruby.tokens.regular_expressions2 (%r\{.+?[^\}]\})
|
|
519
558
|
lang.ruby.tokens.regular_expressions2.format red bold
|
520
559
|
lang.ruby.tokens.doublequoted_strings (\".*?[^\\]\"|\"\")
|
521
560
|
lang.ruby.tokens.doublequoted_strings.format green bold
|
561
|
+
lang.ruby.tokens.interpolated_string.open (%Q?\{)
|
562
|
+
lang.ruby.tokens.interpolated_string.close (\})
|
563
|
+
lang.ruby.tokens.interpolated_string.format green bold
|
564
|
+
lang.ruby.tokens.interpolated_string.change_to interpolated_ruby
|
565
|
+
lang.interpolated_ruby.format.default green bold
|
566
|
+
lang.interpolated_ruby.tokens.interpolation.open (#\{)
|
567
|
+
lang.interpolated_ruby.tokens.interpolation.close (\})
|
568
|
+
lang.interpolated_ruby.tokens.interpolation.format 12 bold
|
569
|
+
lang.interpolated_ruby.tokens.interpolation.change_to ruby
|
522
570
|
lang.ruby.tokens.singlequoted_strings ('.*?[^\\]'|'')
|
523
571
|
lang.ruby.tokens.singlequoted_strings.format green bold
|
524
572
|
lang.ruby.tokens.backquoted_strings (`.*?[^\\]`|``)
|
525
573
|
lang.ruby.tokens.backquoted_strings.format red bold
|
574
|
+
lang.ruby.tokens.interpolated_exec_string.open (%x\{)
|
575
|
+
lang.ruby.tokens.interpolated_exec_string.close (\})
|
576
|
+
lang.ruby.tokens.interpolated_exec_string.format red bold
|
577
|
+
lang.ruby.tokens.interpolated_exec_string.change_to interpolated_exec_ruby
|
578
|
+
lang.interpolated_exec_ruby.format.default red bold
|
579
|
+
lang.interpolated_exec_ruby.tokens.interpolation.open (#\{)
|
580
|
+
lang.interpolated_exec_ruby.tokens.interpolation.close (\})
|
581
|
+
lang.interpolated_exec_ruby.tokens.interpolation.format 9 bold
|
582
|
+
lang.interpolated_exec_ruby.tokens.interpolation.change_to ruby
|
526
583
|
lang.ruby.tokens.character_codes \W(\?\S)
|
527
584
|
lang.ruby.tokens.character_codes.format magenta bold
|
528
585
|
lang.ruby.tokens.long_comments.open ^=begin
|
@@ -532,12 +589,13 @@ lang.ruby.tokens.sql_string.open (<<-EOSQL)
|
|
532
589
|
lang.ruby.tokens.sql_string.close (EOSQL)
|
533
590
|
lang.ruby.tokens.sql_string.format 1
|
534
591
|
lang.ruby.tokens.sql_string.change_to sql
|
535
|
-
lang.ruby.indent.size
|
592
|
+
lang.ruby.indent.size 2
|
536
593
|
lang.ruby.indent.auto true
|
537
594
|
lang.ruby.indent.roundup true
|
538
595
|
#lang.ruby.indent.using_tabs true
|
539
|
-
lang.ruby.
|
540
|
-
lang.ruby.indent.
|
596
|
+
lang.ruby.tabsize 2
|
597
|
+
lang.ruby.indent.indenters ^\s*(case|def|begin|ensure|when|else|ensure|for|while|elsif|if|class|module|rescue)\b|([{\[(]$|\{\s*\|[\w\s,]*\|\s*$)|\b(do)\b
|
598
|
+
lang.ruby.indent.unindenters ^\s*(end|else|elsif|ensure|when|rescue)\b|(^\s+[\]})])
|
541
599
|
lang.ruby.indent.preventers (\".+?[^\\]\")|('.+?[^\\]')|(`.+?[^\\]`)|(\/.+?[^\\]\/)|(^\s*#.*)|\S\s+if
|
542
600
|
lang.ruby.indent.ignore ^\s*$
|
543
601
|
lang.ruby.context.ignore ^=(begin|end)$
|
@@ -561,8 +619,8 @@ lang.php.tokens.comments (\/\/.*)
|
|
561
619
|
lang.php.tokens.comments.format 8 bold
|
562
620
|
lang.php.tokens.preprocessor (^\s*#.*)
|
563
621
|
lang.php.tokens.preprocessor.format yellow bold
|
564
|
-
lang.php.tokens.
|
565
|
-
lang.php.tokens.
|
622
|
+
lang.php.tokens.non_alphanum ([!@#$%\^&*()\[\]{}/?=+\-\\|,<.>;:])
|
623
|
+
lang.php.tokens.non_alphanum.format white
|
566
624
|
lang.php.tokens.long_comments.open \/\*
|
567
625
|
lang.php.tokens.long_comments.close \*\/
|
568
626
|
lang.php.tokens.long_comments.format 8 bold
|
@@ -595,8 +653,8 @@ lang.perl.tokens.comments (#.*)
|
|
595
653
|
lang.perl.tokens.comments.format 8 bold
|
596
654
|
lang.perl.tokens.constants \b([A-Z_]+|[A-Z_][A-Z0-9_]+)\b
|
597
655
|
lang.perl.tokens.constants.format yellow bold
|
598
|
-
lang.perl.tokens.
|
599
|
-
lang.perl.tokens.
|
656
|
+
lang.perl.tokens.non_alphanum [!#^&*()\[\]{}/?=+\-\\|,<.>;:~]
|
657
|
+
lang.perl.tokens.non_alphanum.format white
|
600
658
|
lang.perl.tokens.regular_expressions (\/.+?[^\\]\/)
|
601
659
|
lang.perl.tokens.regular_expressions.format red bold
|
602
660
|
lang.perl.tokens.doublequoted_strings (\".*?[^\\]\")
|
@@ -634,8 +692,8 @@ lang.python.format.selection inverse
|
|
634
692
|
lang.python.format.found yellow inverse
|
635
693
|
lang.python.tokens.constants \b([A-Z_]+|[A-Z_][A-Z0-9_]+)\b
|
636
694
|
lang.python.tokens.constants.format yellow bold
|
637
|
-
lang.python.tokens.
|
638
|
-
lang.python.tokens.
|
695
|
+
lang.python.tokens.non_alphanum [@!#$%^&*()\[\]{}/?=+\-\\|,<.>;:~]
|
696
|
+
lang.python.tokens.non_alphanum.format white
|
639
697
|
lang.python.tokens.comments (#.*)
|
640
698
|
lang.python.tokens.comments.format 8 bold
|
641
699
|
lang.python.tokens.doublequoted_strings (\".*?[^\\]\")
|
@@ -658,7 +716,7 @@ lang.python.indent.ignore ^\s*$
|
|
658
716
|
|
659
717
|
# Java
|
660
718
|
|
661
|
-
lang.java.filemask \.java$
|
719
|
+
lang.java.filemask \.(?:java|js)$
|
662
720
|
lang.java.format.default white bold
|
663
721
|
lang.java.format.selection inverse
|
664
722
|
lang.java.format.found yellow inverse
|
@@ -672,11 +730,13 @@ lang.java.tokens.constants \b([A-Z_]+|[A-Z_][A-Z0-9_]+)\b
|
|
672
730
|
lang.java.tokens.constants.format yellow bold
|
673
731
|
lang.java.tokens.comments (\/\/.*)
|
674
732
|
lang.java.tokens.comments.format 8 bold
|
675
|
-
lang.java.tokens.
|
676
|
-
lang.java.tokens.
|
733
|
+
lang.java.tokens.non_alphanum ([!@#$%\^&*()\[\]{}/?=+\-\\|,<.>;:])
|
734
|
+
lang.java.tokens.non_alphanum.format white
|
677
735
|
lang.java.tokens.long_comments.open \/\*
|
678
736
|
lang.java.tokens.long_comments.close \*\/
|
679
737
|
lang.java.tokens.long_comments.format 8 bold
|
738
|
+
lang.java.tokens.regular_expressions (\/.+?[^\\]\/)
|
739
|
+
lang.java.tokens.regular_expressions.format red bold
|
680
740
|
lang.java.indent.size 4
|
681
741
|
lang.java.indent.auto true
|
682
742
|
lang.java.indent.roundup false
|
@@ -705,8 +765,8 @@ lang.c.tokens.comments (\/\/.*)
|
|
705
765
|
lang.c.tokens.comments.format 8 bold
|
706
766
|
lang.c.tokens.preprocessor (^\s*#.*)
|
707
767
|
lang.c.tokens.preprocessor.format yellow bold
|
708
|
-
lang.c.tokens.
|
709
|
-
lang.c.tokens.
|
768
|
+
lang.c.tokens.non_alphanum ([!@#$%\^&*()\[\]{}/?=+\-\\|,<.>;:])
|
769
|
+
lang.c.tokens.non_alphanum.format white
|
710
770
|
lang.c.tokens.long_comments.open \/\*
|
711
771
|
lang.c.tokens.long_comments.close \*\/
|
712
772
|
lang.c.tokens.long_comments.format 8 bold
|
@@ -787,8 +847,8 @@ lang.sql.tokens.comments (--.*)
|
|
787
847
|
lang.sql.tokens.comments.format 8 bold
|
788
848
|
lang.sql.tokens.singlequoted_strings ('.*?[^\\]')
|
789
849
|
lang.sql.tokens.singlequoted_strings.format green bold
|
790
|
-
lang.sql.tokens.
|
791
|
-
lang.sql.tokens.
|
850
|
+
lang.sql.tokens.non_alphanum ([!@#$%\^&*()\[\]{}/?=+\-\\|,<.>;:])
|
851
|
+
lang.sql.tokens.non_alphanum.format white
|
792
852
|
lang.sql.tokens.typos (==)
|
793
853
|
lang.sql.tokens.typos.format 15 bold
|
794
854
|
lang.sql.indent.indenters ((?:\(|BEGIN|DECLARE|FROM|LOOP|ORDER BY|SELECT|SET|WHERE)$)
|
@@ -837,8 +897,8 @@ lang.tcl.tokens.comments (^\s*#.*)
|
|
837
897
|
lang.tcl.tokens.comments.format 8 bold
|
838
898
|
lang.tcl.tokens.reserved_words \b(encoding|incr|pid|tcl_endOfWord|Tcl|eof|info|tcl_findLibrary|after|error|interp|pkg_mkIndex|tcl_startOfNextWord|append|eval|join|proc|tcl_startOfPreviousWord|array|exec|lappend|puts|tcl_wordBreakAfter|auto_execok|exit|lassign|pwd|tcl_wordBreakBefore|auto_import|expr|lindex|re_syntax|tcltest|auto_load|fblocked|linsert|read|tclvars|auto_mkindex|fconfigure|list|regexp|tell|auto_mkindex_old|fcopy|llength|registry|time|auto_qualify|file|load|regsub|trace|auto_reset|fileevent|lrange|rename|unknown|bgerror|filename|lrepeat|resource|unload|binary|flush|lreplace|return|unset|break|for|lsearch|scan|update|catch|foreach|lset|seek|uplevel|cd|format|lsort|set|upvar|clock|gets|memory|socket|variable|close|glob|msgcat|source|vwait|concat|global|namespace|split|while|continue|history|open|string|dde|http|package|subst|dict|if|parray|switch)\b
|
839
899
|
lang.tcl.tokens.reserved_words.format white
|
840
|
-
lang.tcl.tokens.
|
841
|
-
lang.tcl.tokens.
|
900
|
+
lang.tcl.tokens.non_alphanum ([!@#$%\^&*()\[\]{}/?=+\-\\|,<.>;:])
|
901
|
+
lang.tcl.tokens.non_alphanum.format white
|
842
902
|
lang.tcl.tokens.variables (\$[A-Za-z_][A-Za-z_0-9]*)\b
|
843
903
|
lang.tcl.tokens.variables.format yellow bold
|
844
904
|
lang.tcl.tokens.doublequoted_strings (\".*?[^\\]\")
|
@@ -957,4 +1017,7 @@ lang.haml.tokens.line_joiner.format 12 bold
|
|
957
1017
|
# If a setting is specified again, it overrides the previous setting given
|
958
1018
|
# higher up in the configuration file(s).
|
959
1019
|
|
960
|
-
include ~/.diakonos/
|
1020
|
+
include ~/.diakonos/pistos.conf
|
1021
|
+
|
1022
|
+
# Uncomment this line if your terminal supports 256 colours.
|
1023
|
+
#include ~/.diakonos/diakonos-256-colour.conf
|
data/lib/diakonos.rb
CHANGED
@@ -55,8 +55,8 @@ require 'diakonos/readline'
|
|
55
55
|
|
56
56
|
module Diakonos
|
57
57
|
|
58
|
-
VERSION = '0.8.
|
59
|
-
LAST_MODIFIED = '
|
58
|
+
VERSION = '0.8.4'
|
59
|
+
LAST_MODIFIED = 'May 23, 2008'
|
60
60
|
|
61
61
|
DONT_ADJUST_ROW = false
|
62
62
|
ADJUST_ROW = true
|
@@ -84,15 +84,17 @@ module Diakonos
|
|
84
84
|
CHOICE_CANCEL = 3
|
85
85
|
CHOICE_YES_TO_ALL = 4
|
86
86
|
CHOICE_NO_TO_ALL = 5
|
87
|
+
CHOICE_YES_AND_STOP = 6
|
87
88
|
CHOICE_KEYS = [
|
88
89
|
[ ?n, ?N ],
|
89
90
|
[ ?y, ?Y ],
|
90
91
|
[ ?a, ?A ],
|
91
92
|
[ ?c, ?C, ESCAPE, CTRL_C, CTRL_D, CTRL_Q ],
|
92
93
|
[ ?e ],
|
93
|
-
[ ?o ]
|
94
|
+
[ ?o ],
|
95
|
+
[ ?s ],
|
94
96
|
]
|
95
|
-
CHOICE_STRINGS = [ '(n)o', '(y)es', '(a)ll', '(c)ancel', 'y(e)s to all', 'n(o) to all' ]
|
97
|
+
CHOICE_STRINGS = [ '(n)o', '(y)es', '(a)ll', '(c)ancel', 'y(e)s to all', 'n(o) to all', 'yes and (s)top' ]
|
96
98
|
|
97
99
|
BOL_ZERO = 0
|
98
100
|
BOL_FIRST_CHAR = 1
|
@@ -116,6 +118,7 @@ module Diakonos
|
|
116
118
|
'clearMatches',
|
117
119
|
'closeFile',
|
118
120
|
'collapseWhitespace',
|
121
|
+
'close_code',
|
119
122
|
'copySelection',
|
120
123
|
'cursorBOF',
|
121
124
|
'cursorBOL',
|
@@ -149,6 +152,8 @@ module Diakonos
|
|
149
152
|
'indent',
|
150
153
|
'insertSpaces',
|
151
154
|
'insertTab',
|
155
|
+
'joinLines',
|
156
|
+
'list_buffers',
|
152
157
|
'loadConfiguration',
|
153
158
|
'loadScript',
|
154
159
|
'newFile',
|
@@ -173,6 +178,7 @@ module Diakonos
|
|
173
178
|
'revert',
|
174
179
|
'saveFile',
|
175
180
|
'saveFileAs',
|
181
|
+
'select_block',
|
176
182
|
'scrollDown',
|
177
183
|
'scrollUp',
|
178
184
|
'searchAndReplace',
|
@@ -200,7 +206,7 @@ module Diakonos
|
|
200
206
|
class Diakonos
|
201
207
|
attr_reader :win_main, :settings, :token_regexps, :close_token_regexps,
|
202
208
|
:token_formats, :diakonos_home, :script_dir, :diakonos_conf, :display_mutex,
|
203
|
-
:indenters, :unindenters, :clipboard, :do_display,
|
209
|
+
:indenters, :unindenters, :closers, :clipboard, :do_display,
|
204
210
|
:current_buffer, :list_filename, :hooks, :last_commands, :there_was_non_movement
|
205
211
|
|
206
212
|
|
@@ -268,7 +274,7 @@ class Diakonos
|
|
268
274
|
while argv.length > 0
|
269
275
|
arg = argv.shift
|
270
276
|
case arg
|
271
|
-
when '--help'
|
277
|
+
when '-h', '--help'
|
272
278
|
printUsage
|
273
279
|
exit 1
|
274
280
|
when '-ro'
|
@@ -372,26 +378,26 @@ class Diakonos
|
|
372
378
|
end
|
373
379
|
end
|
374
380
|
|
375
|
-
def fetch_conf( location = "
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
|
380
|
-
|
381
|
-
|
382
|
-
|
383
|
-
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
|
392
|
-
|
393
|
-
|
394
|
-
|
381
|
+
def fetch_conf( location = "v#{VERSION}" )
|
382
|
+
require 'open-uri'
|
383
|
+
found = false
|
384
|
+
puts "Fetching configuration from #{location}..."
|
385
|
+
|
386
|
+
begin
|
387
|
+
open( "http://github.com/Pistos/diakonos/tree/#{location}/diakonos.conf?raw=true" ) do |http|
|
388
|
+
text = http.read
|
389
|
+
if text =~ /key/ and text =~ /colour/ and text =~ /lang/
|
390
|
+
found = true
|
391
|
+
File.open( @diakonos_conf, 'w' ) do |f|
|
392
|
+
f.puts text
|
393
|
+
end
|
394
|
+
end
|
395
|
+
end
|
396
|
+
rescue OpenURI::HTTPError => e
|
397
|
+
$stderr.puts "Failed to fetch from #{location}."
|
398
|
+
end
|
399
|
+
|
400
|
+
return found
|
395
401
|
end
|
396
402
|
|
397
403
|
def loadConfiguration
|
@@ -429,7 +435,7 @@ class Diakonos
|
|
429
435
|
case answer
|
430
436
|
when /^y/i
|
431
437
|
if not fetch_conf
|
432
|
-
fetch_conf '
|
438
|
+
fetch_conf 'master'
|
433
439
|
end
|
434
440
|
end
|
435
441
|
|
@@ -448,6 +454,7 @@ class Diakonos
|
|
448
454
|
@unindenters = Hash.new
|
449
455
|
@filemasks = Hash.new
|
450
456
|
@bangmasks = Hash.new
|
457
|
+
@closers = Hash.new
|
451
458
|
|
452
459
|
@settings = Hash.new
|
453
460
|
# Setup some defaults
|
@@ -573,9 +580,27 @@ class Diakonos
|
|
573
580
|
@filemasks[ $1 ] = Regexp.new arg
|
574
581
|
when /^lang\.(.+?)\.bangmask$/
|
575
582
|
@bangmasks[ $1 ] = Regexp.new arg
|
583
|
+
when /^lang\.(.+?)\.closers\.(.+?)\.(.+?)$/
|
584
|
+
@closers[ $1 ] ||= Hash.new
|
585
|
+
@closers[ $1 ][ $2 ] ||= Hash.new
|
586
|
+
@closers[ $1 ][ $2 ][ $3.to_sym ] = case $3
|
587
|
+
when 'regexp'
|
588
|
+
Regexp.new arg
|
589
|
+
when 'closer'
|
590
|
+
begin
|
591
|
+
eval( "Proc.new " + arg )
|
592
|
+
rescue Exception => e
|
593
|
+
showException(
|
594
|
+
e,
|
595
|
+
[
|
596
|
+
"Failed to process Proc for #{command}.",
|
597
|
+
]
|
598
|
+
)
|
599
|
+
end
|
600
|
+
end
|
576
601
|
when "context.visible", "context.combined", "eof_newline", "view.nonfilelines.visible",
|
577
602
|
/^lang\.(.+?)\.indent\.(?:auto|roundup|using_tabs)$/,
|
578
|
-
"found_cursor_start", "convert_tabs"
|
603
|
+
"found_cursor_start", "convert_tabs", 'delete_newline_on_delete_to_eol'
|
579
604
|
@settings[ command ] = arg.to_b
|
580
605
|
when "context.format", "context.separator.format", "status.format"
|
581
606
|
@settings[ command ] = arg.toFormatting
|
@@ -697,7 +722,7 @@ class Diakonos
|
|
697
722
|
hook.sort { |a,b| a[ :priority ] <=> b[ :priority ] }
|
698
723
|
end
|
699
724
|
|
700
|
-
setILine "Diakonos #{VERSION} (#{LAST_MODIFIED}) F1 for help F12 to configure"
|
725
|
+
setILine "Diakonos #{VERSION} (#{LAST_MODIFIED}) F1 for help F12 to configure Ctrl-Q to quit"
|
701
726
|
|
702
727
|
num_opened = 0
|
703
728
|
if @files.length == 0 and @read_only_files.length == 0
|
@@ -770,7 +795,6 @@ class Diakonos
|
|
770
795
|
|
771
796
|
if context.empty?
|
772
797
|
if c > 31 and c < 255 and c != BACKSPACE
|
773
|
-
debugLog "char: #{c}"
|
774
798
|
if @macro_history != nil
|
775
799
|
@macro_history.push "typeCharacter #{c}"
|
776
800
|
end
|
@@ -837,7 +861,6 @@ class Diakonos
|
|
837
861
|
clip_filename = @diakonos_home + "/clips.txt"
|
838
862
|
File.open( clip_filename, "w" ) do |f|
|
839
863
|
@clipboard.each do |clip|
|
840
|
-
log clip
|
841
864
|
f.puts clip
|
842
865
|
f.puts "---------------------------"
|
843
866
|
end
|
@@ -1053,7 +1076,7 @@ class Diakonos
|
|
1053
1076
|
f.puts
|
1054
1077
|
f.puts "----------------------------------------------------"
|
1055
1078
|
f.puts "If you can reproduce this error, please report it at"
|
1056
|
-
f.puts "http://
|
1079
|
+
f.puts "http://linis.purepistos.net/ticket/list/Diakonos !"
|
1057
1080
|
f.puts "----------------------------------------------------"
|
1058
1081
|
f.puts e.backtrace
|
1059
1082
|
end
|
@@ -1329,6 +1352,34 @@ class Diakonos
|
|
1329
1352
|
|
1330
1353
|
def closeListBuffer
|
1331
1354
|
closeFile( @list_buffer )
|
1355
|
+
@list_buffer = nil
|
1356
|
+
end
|
1357
|
+
def showing_list?
|
1358
|
+
@list_buffer
|
1359
|
+
end
|
1360
|
+
def current_list_item
|
1361
|
+
if @list_buffer
|
1362
|
+
@list_buffer.select_current_line
|
1363
|
+
end
|
1364
|
+
end
|
1365
|
+
def select_list_item
|
1366
|
+
if @list_buffer
|
1367
|
+
line = @list_buffer.select_current_line
|
1368
|
+
@list_buffer.display
|
1369
|
+
line
|
1370
|
+
end
|
1371
|
+
end
|
1372
|
+
def previous_list_item
|
1373
|
+
if @list_buffer
|
1374
|
+
cursorUp
|
1375
|
+
@list_buffer[ @list_buffer.currentRow ]
|
1376
|
+
end
|
1377
|
+
end
|
1378
|
+
def next_list_item
|
1379
|
+
if @list_buffer
|
1380
|
+
cursorDown
|
1381
|
+
@list_buffer[ @list_buffer.currentRow ]
|
1382
|
+
end
|
1332
1383
|
end
|
1333
1384
|
|
1334
1385
|
def runHookProcs( hook_id, *args )
|
@@ -1396,6 +1447,10 @@ class Diakonos
|
|
1396
1447
|
def clearMatches
|
1397
1448
|
@current_buffer.clearMatches Buffer::DO_DISPLAY
|
1398
1449
|
end
|
1450
|
+
|
1451
|
+
def close_code
|
1452
|
+
@current_buffer.close_code
|
1453
|
+
end
|
1399
1454
|
|
1400
1455
|
# Returns the choice the user made, or nil if the user was not prompted to choose.
|
1401
1456
|
def closeFile( buffer = @current_buffer, to_all = nil )
|
@@ -1806,11 +1861,11 @@ class Diakonos
|
|
1806
1861
|
else
|
1807
1862
|
end_row = mark.end_row - 1
|
1808
1863
|
end
|
1809
|
-
(mark.start_row
|
1864
|
+
(mark.start_row..end_row).each do |row|
|
1810
1865
|
@current_buffer.indent row, Buffer::DONT_DISPLAY
|
1811
1866
|
end
|
1812
1867
|
@do_display = true
|
1813
|
-
@current_buffer.
|
1868
|
+
@current_buffer.display
|
1814
1869
|
else
|
1815
1870
|
@current_buffer.indent
|
1816
1871
|
end
|
@@ -1827,7 +1882,23 @@ class Diakonos
|
|
1827
1882
|
def insertTab
|
1828
1883
|
typeCharacter( TAB )
|
1829
1884
|
end
|
1885
|
+
|
1886
|
+
def joinLines
|
1887
|
+
@current_buffer.joinLines( @current_buffer.currentRow, Buffer::STRIP_LINE )
|
1888
|
+
end
|
1830
1889
|
|
1890
|
+
def list_buffers
|
1891
|
+
File.open( @list_filename, "w" ) do |f|
|
1892
|
+
f.puts @buffers.keys.map { |name| "#{name}\n" }.sort
|
1893
|
+
end
|
1894
|
+
openListBuffer
|
1895
|
+
filename = getUserInput( "Switch to buffer: " )
|
1896
|
+
buffer = @buffers[ filename ]
|
1897
|
+
if buffer
|
1898
|
+
switchTo buffer
|
1899
|
+
end
|
1900
|
+
end
|
1901
|
+
|
1831
1902
|
def loadScript( name_ = nil )
|
1832
1903
|
if name_ == nil
|
1833
1904
|
name = getUserInput( "File to load as script: ", @rlh_files )
|
@@ -2013,11 +2084,11 @@ class Diakonos
|
|
2013
2084
|
if( @current_buffer.changing_selection )
|
2014
2085
|
@do_display = false
|
2015
2086
|
mark = @current_buffer.selection_mark
|
2016
|
-
(mark.start_row
|
2087
|
+
(mark.start_row..mark.end_row).each do |row|
|
2017
2088
|
@current_buffer.parsedIndent row, Buffer::DONT_DISPLAY
|
2018
2089
|
end
|
2019
2090
|
@do_display = true
|
2020
|
-
@current_buffer.
|
2091
|
+
@current_buffer.display
|
2021
2092
|
else
|
2022
2093
|
@current_buffer.parsedIndent
|
2023
2094
|
end
|
@@ -2151,6 +2222,16 @@ class Diakonos
|
|
2151
2222
|
#end
|
2152
2223
|
end
|
2153
2224
|
end
|
2225
|
+
|
2226
|
+
def select_block( beginning = nil, ending = nil, including_ending = true )
|
2227
|
+
if beginning.nil?
|
2228
|
+
beginning = Regexp.new( getUserInput( "Start at regexp: " ) )
|
2229
|
+
end
|
2230
|
+
if ending.nil?
|
2231
|
+
ending = Regexp.new( getUserInput( "End before regexp: " ) )
|
2232
|
+
end
|
2233
|
+
@current_buffer.select( beginning, ending, including_ending )
|
2234
|
+
end
|
2154
2235
|
|
2155
2236
|
def scrollDown
|
2156
2237
|
@current_buffer.pitchView( @settings[ "view.scroll_amount" ] || 1 )
|
@@ -2374,11 +2455,11 @@ class Diakonos
|
|
2374
2455
|
else
|
2375
2456
|
end_row = mark.end_row - 1
|
2376
2457
|
end
|
2377
|
-
(mark.start_row
|
2458
|
+
(mark.start_row..end_row).each do |row|
|
2378
2459
|
@current_buffer.unindent row, Buffer::DONT_DISPLAY
|
2379
2460
|
end
|
2380
2461
|
@do_display = true
|
2381
|
-
@current_buffer.
|
2462
|
+
@current_buffer.display
|
2382
2463
|
else
|
2383
2464
|
@current_buffer.unindent
|
2384
2465
|
end
|
data/lib/diakonos/array.rb
CHANGED
data/lib/diakonos/buffer.rb
CHANGED
@@ -25,6 +25,8 @@ class Buffer
|
|
25
25
|
DONT_PITCH_CURSOR = false
|
26
26
|
CLEAR_STACK_POINTER = true
|
27
27
|
DONT_CLEAR_STACK_POINTER = false
|
28
|
+
STRIP_LINE = true
|
29
|
+
DONT_STRIP_LINE = false
|
28
30
|
|
29
31
|
# Set name to nil to create a buffer that is not associated with a file.
|
30
32
|
def initialize( diakonos, name, read_only = false )
|
@@ -121,6 +123,7 @@ class Buffer
|
|
121
123
|
@indenters = @diakonos.indenters[ @language ]
|
122
124
|
@unindenters = @diakonos.unindenters[ @language ]
|
123
125
|
@preventers = @settings[ "lang.#{@language}.indent.preventers" ]
|
126
|
+
@closers = @diakonos.closers[ @language ] || Hash.new
|
124
127
|
@auto_indent = @settings[ "lang.#{@language}.indent.auto" ]
|
125
128
|
@indent_size = ( @settings[ "lang.#{@language}.indent.size" ] or 4 )
|
126
129
|
@indent_roundup = ( @settings[ "lang.#{@language}.indent.roundup" ] or true )
|
@@ -209,7 +212,7 @@ class Buffer
|
|
209
212
|
linestr[ 0 ] = ( @settings[ "view.nonfilelines.character" ] or "~" )
|
210
213
|
end
|
211
214
|
|
212
|
-
@win_main.
|
215
|
+
@win_main.addstr linestr
|
213
216
|
end
|
214
217
|
|
215
218
|
@win_main.setpos( @last_screen_y , @last_screen_x )
|
@@ -221,9 +224,9 @@ class Buffer
|
|
221
224
|
|
222
225
|
Curses::curs_set 1
|
223
226
|
rescue Exception => e
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
+
@diakonos.log( "Display Exception:" )
|
228
|
+
@diakonos.log( e.message )
|
229
|
+
@diakonos.log( e.backtrace.join( "\n" ) )
|
227
230
|
showException e
|
228
231
|
end
|
229
232
|
@diakonos.display_mutex.unlock
|
@@ -343,6 +346,45 @@ class Buffer
|
|
343
346
|
def selection_mark
|
344
347
|
return @text_marks[ SELECTION ]
|
345
348
|
end
|
349
|
+
|
350
|
+
def select_current_line
|
351
|
+
@text_marks[ SELECTION ] = TextMark.new(
|
352
|
+
@last_row,
|
353
|
+
0,
|
354
|
+
@last_row,
|
355
|
+
@lines[ @last_row ].size,
|
356
|
+
@selection_formatting
|
357
|
+
)
|
358
|
+
@lines[ @last_row ]
|
359
|
+
end
|
360
|
+
|
361
|
+
def select( from_regexp, to_regexp, include_ending = true )
|
362
|
+
start_row = nil
|
363
|
+
|
364
|
+
@lines[ 0..@last_row ].reverse.each_with_index do |line,index|
|
365
|
+
if line =~ from_regexp
|
366
|
+
start_row = @last_row - index
|
367
|
+
break
|
368
|
+
end
|
369
|
+
end
|
370
|
+
if start_row
|
371
|
+
end_row = nil
|
372
|
+
@lines[ start_row..-1 ].each_with_index do |line,index|
|
373
|
+
if line =~ to_regexp
|
374
|
+
end_row = start_row + index
|
375
|
+
break
|
376
|
+
end
|
377
|
+
end
|
378
|
+
if end_row
|
379
|
+
if include_ending
|
380
|
+
end_row += 1
|
381
|
+
end
|
382
|
+
anchorSelection( start_row, 0, DONT_DISPLAY )
|
383
|
+
cursorTo( end_row, 0 )
|
384
|
+
display
|
385
|
+
end
|
386
|
+
end
|
387
|
+
end
|
346
388
|
|
347
389
|
# Prints text to the screen, truncating where necessary.
|
348
390
|
# Returns nil if the string is completely off-screen.
|
@@ -392,7 +434,7 @@ class Buffer
|
|
392
434
|
@win_main.attrset text_mark.formatting
|
393
435
|
if ( (text_mark.start_row + 1) .. (text_mark.end_row - 1) ) === row
|
394
436
|
@win_main.setpos( cury, curx )
|
395
|
-
@win_main.
|
437
|
+
@win_main.addstr string
|
396
438
|
elsif row == text_mark.start_row and row == text_mark.end_row
|
397
439
|
expanded_col = tabExpandedColumn( text_mark.start_col, row )
|
398
440
|
if expanded_col < @left_column + Curses::cols
|
@@ -400,7 +442,7 @@ class Buffer
|
|
400
442
|
right = tabExpandedColumn( text_mark.end_col, row ) - @left_column
|
401
443
|
if left < right
|
402
444
|
@win_main.setpos( cury, curx + left )
|
403
|
-
@win_main.
|
445
|
+
@win_main.addstr string[ left...right ]
|
404
446
|
end
|
405
447
|
end
|
406
448
|
elsif row == text_mark.start_row
|
@@ -408,12 +450,12 @@ class Buffer
|
|
408
450
|
if expanded_col < @left_column + Curses::cols
|
409
451
|
left = [ expanded_col - @left_column, 0 ].max
|
410
452
|
@win_main.setpos( cury, curx + left )
|
411
|
-
@win_main.
|
453
|
+
@win_main.addstr string[ left..-1 ]
|
412
454
|
end
|
413
455
|
elsif row == text_mark.end_row
|
414
456
|
right = tabExpandedColumn( text_mark.end_col, row ) - @left_column
|
415
457
|
@win_main.setpos( cury, curx )
|
416
|
-
@win_main.
|
458
|
+
@win_main.addstr string[ 0...right ]
|
417
459
|
else
|
418
460
|
# This row not in selection.
|
419
461
|
end
|
@@ -426,7 +468,7 @@ class Buffer
|
|
426
468
|
return if string == nil
|
427
469
|
|
428
470
|
@win_main.attrset formatting
|
429
|
-
@win_main.
|
471
|
+
@win_main.addstr string
|
430
472
|
end
|
431
473
|
|
432
474
|
# This method assumes that the cursor has been setup already at
|
@@ -644,10 +686,8 @@ class Buffer
|
|
644
686
|
if col == line.length
|
645
687
|
if row < @lines.length - 1
|
646
688
|
# Delete newline, and concat next line
|
647
|
-
|
648
|
-
@lines[ row ] << @lines.delete_at( row + 1 )
|
689
|
+
joinLines( row )
|
649
690
|
cursorTo( @last_row, @last_col )
|
650
|
-
setModified
|
651
691
|
end
|
652
692
|
else
|
653
693
|
takeSnapshot( TYPING )
|
@@ -658,6 +698,29 @@ class Buffer
|
|
658
698
|
end
|
659
699
|
end
|
660
700
|
|
701
|
+
def joinLines( row = @last_row, strip = DONT_STRIP_LINE )
|
702
|
+
takeSnapshot( TYPING )
|
703
|
+
next_line = @lines.delete_at( row + 1 )
|
704
|
+
if strip
|
705
|
+
next_line = ' ' + next_line.strip
|
706
|
+
end
|
707
|
+
@lines[ row ] << next_line
|
708
|
+
setModified
|
709
|
+
end
|
710
|
+
|
711
|
+
def close_code
|
712
|
+
line = @lines[ @last_row ]
|
713
|
+
@closers.each_value do |h|
|
714
|
+
h[ :regexp ] =~ line
|
715
|
+
lm = Regexp.last_match
|
716
|
+
if lm
|
717
|
+
insertString h[ :closer ].call( lm ).to_s
|
718
|
+
else
|
719
|
+
@diakonos.log h[ :regexp ].inspect + " does not match '#{line}'"
|
720
|
+
end
|
721
|
+
end
|
722
|
+
end
|
723
|
+
|
661
724
|
def collapseWhitespace
|
662
725
|
removeSelection( DONT_DISPLAY ) if selection_mark != nil
|
663
726
|
|
@@ -698,12 +761,19 @@ class Buffer
|
|
698
761
|
|
699
762
|
row = @last_row
|
700
763
|
col = @last_col
|
764
|
+
|
701
765
|
takeSnapshot
|
702
|
-
|
703
|
-
|
766
|
+
if @settings[ 'delete_newline_on_delete_to_eol' ] and col == @lines[ row ].size
|
767
|
+
next_line = @lines.delete_at( row + 1 )
|
768
|
+
@lines[ row ] << next_line
|
769
|
+
retval = ''
|
770
|
+
else
|
771
|
+
retval = [ @lines[ row ][ col..-1 ] ]
|
772
|
+
@lines[ row ] = @lines[ row ][ 0...col ]
|
773
|
+
end
|
704
774
|
setModified
|
705
775
|
|
706
|
-
|
776
|
+
retval
|
707
777
|
end
|
708
778
|
|
709
779
|
def carriageReturn
|
@@ -1374,7 +1444,7 @@ class Buffer
|
|
1374
1444
|
if replacement != nil
|
1375
1445
|
choice = @diakonos.getChoice(
|
1376
1446
|
"Replace?",
|
1377
|
-
[ CHOICE_YES, CHOICE_NO, CHOICE_ALL, CHOICE_CANCEL ],
|
1447
|
+
[ CHOICE_YES, CHOICE_NO, CHOICE_ALL, CHOICE_CANCEL, CHOICE_YES_AND_STOP ],
|
1378
1448
|
CHOICE_YES
|
1379
1449
|
)
|
1380
1450
|
case choice
|
@@ -1387,6 +1457,9 @@ class Buffer
|
|
1387
1457
|
find( regexps, direction, replacement )
|
1388
1458
|
when CHOICE_CANCEL
|
1389
1459
|
# Do nothing further.
|
1460
|
+
when CHOICE_YES_AND_STOP
|
1461
|
+
paste [ replacement ]
|
1462
|
+
# Do nothing further.
|
1390
1463
|
end
|
1391
1464
|
end
|
1392
1465
|
else
|
data/lib/diakonos/readline.rb
CHANGED
@@ -46,7 +46,12 @@ class Readline
|
|
46
46
|
end
|
47
47
|
end
|
48
48
|
when ENTER
|
49
|
+
item = @diakonos.current_list_item
|
50
|
+
if item and File.directory? item
|
51
|
+
completeInput
|
52
|
+
else
|
49
53
|
break
|
54
|
+
end
|
50
55
|
when ESCAPE, CTRL_C, CTRL_D, CTRL_Q
|
51
56
|
@input = nil
|
52
57
|
break
|
@@ -70,22 +75,38 @@ class Readline
|
|
70
75
|
completeInput
|
71
76
|
when Curses::KEY_NPAGE
|
72
77
|
@diakonos.pageDown
|
78
|
+
line = @diakonos.select_list_item
|
79
|
+
if line
|
80
|
+
@input = line
|
81
|
+
cursorWriteInput
|
82
|
+
end
|
73
83
|
when Curses::KEY_PPAGE
|
74
84
|
@diakonos.pageUp
|
75
|
-
|
76
|
-
if
|
77
|
-
|
78
|
-
|
79
|
-
@input = @history[ @history_index ]
|
80
|
-
cursorWriteInput
|
85
|
+
line = @diakonos.select_list_item
|
86
|
+
if line
|
87
|
+
@input = line
|
88
|
+
cursorWriteInput
|
81
89
|
end
|
90
|
+
when Curses::KEY_UP
|
91
|
+
if @diakonos.showing_list?
|
92
|
+
@input = @diakonos.previous_list_item
|
93
|
+
@diakonos.select_list_item
|
94
|
+
elsif @history_index > 0
|
95
|
+
@history[ @history_index ] = @input
|
96
|
+
@history_index -= 1
|
97
|
+
@input = @history[ @history_index ]
|
98
|
+
end
|
99
|
+
cursorWriteInput
|
82
100
|
when Curses::KEY_DOWN
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
101
|
+
if @diakonos.showing_list?
|
102
|
+
@input = @diakonos.next_list_item
|
103
|
+
@diakonos.select_list_item
|
104
|
+
elsif @history_index < @history.length - 1
|
105
|
+
@history[ @history_index ] = @input
|
106
|
+
@history_index += 1
|
107
|
+
@input = @history[ @history_index ]
|
108
|
+
end
|
109
|
+
cursorWriteInput
|
89
110
|
when CTRL_K
|
90
111
|
@input = ""
|
91
112
|
cursorWriteInput
|
@@ -156,7 +177,13 @@ class Readline
|
|
156
177
|
File.open( @list_filename, "w" ) do |f|
|
157
178
|
i = nil
|
158
179
|
matches.each do |match|
|
159
|
-
f.
|
180
|
+
f.print match
|
181
|
+
if FileTest.directory?( match )
|
182
|
+
f.print '/'
|
183
|
+
else
|
184
|
+
@diakonos.log "'#{match}' is not a directory"
|
185
|
+
end
|
186
|
+
f.puts
|
160
187
|
|
161
188
|
if match[ 0 ] != common[ 0 ]
|
162
189
|
common = nil
|
data/lib/diakonos/string.rb
CHANGED
@@ -119,25 +119,26 @@ class String
|
|
119
119
|
end
|
120
120
|
|
121
121
|
def toColourConstant
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
122
|
+
case downcase
|
123
|
+
when "black", "0"
|
124
|
+
Curses::COLOR_BLACK
|
125
|
+
when "red", "1"
|
126
|
+
Curses::COLOR_RED
|
127
|
+
when "green", "2"
|
128
|
+
Curses::COLOR_GREEN
|
129
|
+
when "yellow", "brown", "3"
|
130
|
+
Curses::COLOR_YELLOW
|
131
|
+
when "blue", "4"
|
132
|
+
Curses::COLOR_BLUE
|
133
|
+
when "magenta", "purple", "5"
|
134
|
+
Curses::COLOR_MAGENTA
|
135
|
+
when "cyan", "6"
|
136
|
+
Curses::COLOR_CYAN
|
137
|
+
when "white", "7"
|
138
|
+
Curses::COLOR_WHITE
|
139
|
+
else
|
140
|
+
to_i
|
141
|
+
end
|
141
142
|
end
|
142
143
|
|
143
144
|
def toDirection( default = :down )
|
metadata
CHANGED
@@ -1,33 +1,27 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
|
-
rubygems_version: 0.9.0
|
3
|
-
specification_version: 1
|
4
2
|
name: diakonos
|
5
3
|
version: !ruby/object:Gem::Version
|
6
|
-
version: 0.8.
|
7
|
-
|
8
|
-
summary: A usable console-based text editor.
|
9
|
-
require_paths:
|
10
|
-
- lib
|
11
|
-
email: pistos at purepistos dot net
|
12
|
-
homepage: http://purepistos.net/diakonos
|
13
|
-
rubyforge_project: diakonos
|
14
|
-
description: Diakonos is a customizable, usable console-based text editor.
|
15
|
-
autorequire:
|
16
|
-
default_executable:
|
17
|
-
bindir: bin
|
18
|
-
has_rdoc: false
|
19
|
-
required_ruby_version: !ruby/object:Gem::Version::Requirement
|
20
|
-
requirements:
|
21
|
-
- - ">"
|
22
|
-
- !ruby/object:Gem::Version
|
23
|
-
version: 0.0.0
|
24
|
-
version:
|
25
|
-
platform: ruby
|
26
|
-
signing_key:
|
27
|
-
cert_chain:
|
28
|
-
post_install_message:
|
4
|
+
version: 0.8.4
|
5
|
+
platform: ""
|
29
6
|
authors:
|
30
7
|
- Pistos
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2008-05-26 00:00:00 -04:00
|
13
|
+
default_executable:
|
14
|
+
dependencies: []
|
15
|
+
|
16
|
+
description: Diakonos is a customizable, usable console-based text editor.
|
17
|
+
email: pistos at purepistos dot net
|
18
|
+
executables:
|
19
|
+
- diakonos
|
20
|
+
extensions: []
|
21
|
+
|
22
|
+
extra_rdoc_files:
|
23
|
+
- README
|
24
|
+
- CHANGELOG
|
31
25
|
files:
|
32
26
|
- CHANGELOG
|
33
27
|
- README
|
@@ -35,43 +29,56 @@ files:
|
|
35
29
|
- diakonos.conf
|
36
30
|
- bin/diakonos
|
37
31
|
- lib/diakonos.rb
|
38
|
-
- lib/diakonos/finding.rb
|
39
|
-
- lib/diakonos/ctag.rb
|
40
|
-
- lib/diakonos/array.rb
|
41
|
-
- lib/diakonos/enumerable.rb
|
42
32
|
- lib/diakonos/bignum.rb
|
43
|
-
- lib/diakonos/
|
44
|
-
- lib/diakonos/keycode.rb
|
45
|
-
- lib/diakonos/hash.rb
|
46
|
-
- lib/diakonos/sized-array.rb
|
47
|
-
- lib/diakonos/regexp.rb
|
33
|
+
- lib/diakonos/bookmark.rb
|
48
34
|
- lib/diakonos/buffer-hash.rb
|
49
35
|
- lib/diakonos/clipboard.rb
|
50
|
-
- lib/diakonos/
|
51
|
-
- lib/diakonos/
|
36
|
+
- lib/diakonos/ctag.rb
|
37
|
+
- lib/diakonos/enumerable.rb
|
38
|
+
- lib/diakonos/finding.rb
|
52
39
|
- lib/diakonos/fixnum.rb
|
53
|
-
- lib/diakonos/
|
40
|
+
- lib/diakonos/hash.rb
|
41
|
+
- lib/diakonos/keycode.rb
|
42
|
+
- lib/diakonos/object.rb
|
43
|
+
- lib/diakonos/regexp.rb
|
44
|
+
- lib/diakonos/sized-array.rb
|
45
|
+
- lib/diakonos/text-mark.rb
|
54
46
|
- lib/diakonos/window.rb
|
47
|
+
- lib/diakonos/array.rb
|
48
|
+
- lib/diakonos/readline.rb
|
55
49
|
- lib/diakonos/buffer.rb
|
56
|
-
- lib/diakonos/
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
- test/diakonos-test.rb
|
61
|
-
- test/buffer-test.rb
|
62
|
-
- test/regexp-test.rb
|
63
|
-
- test/sizedarray-test.rb
|
64
|
-
- test/clipboard-test.rb
|
50
|
+
- lib/diakonos/string.rb
|
51
|
+
has_rdoc: false
|
52
|
+
homepage: http://purepistos.net/diakonos
|
53
|
+
post_install_message:
|
65
54
|
rdoc_options: []
|
66
55
|
|
67
|
-
|
68
|
-
-
|
69
|
-
|
70
|
-
|
71
|
-
-
|
72
|
-
|
73
|
-
|
56
|
+
require_paths:
|
57
|
+
- lib
|
58
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: "0"
|
63
|
+
version:
|
64
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: "0"
|
69
|
+
version:
|
74
70
|
requirements:
|
75
71
|
- curses library for Ruby (not in default Ruby install on Debian or FreeBSD; not sufficiently implemented on Windows)
|
76
|
-
|
77
|
-
|
72
|
+
rubyforge_project: diakonos
|
73
|
+
rubygems_version: 0.9.5
|
74
|
+
signing_key:
|
75
|
+
specification_version: 2
|
76
|
+
summary: A usable console-based text editor.
|
77
|
+
test_files:
|
78
|
+
- test/buffer-test.rb
|
79
|
+
- test/clipboard-test.rb
|
80
|
+
- test/diakonos-test.rb
|
81
|
+
- test/hash-test.rb
|
82
|
+
- test/regexp-test.rb
|
83
|
+
- test/sizedarray-test.rb
|
84
|
+
- test/string-test.rb
|