ver 2009.11.29 → 2009.12.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (47) hide show
  1. data/AUTHORS +6 -0
  2. data/CHANGELOG +353 -1
  3. data/LICENSE +18 -0
  4. data/MANIFEST +11 -1
  5. data/Rakefile +2 -1
  6. data/bin/ver +3 -12
  7. data/config/detect.rb +1 -1
  8. data/config/keymap/diakonos.rb +181 -0
  9. data/config/keymap/emacs.rb +24 -24
  10. data/config/keymap/vim.rb +162 -127
  11. data/config/rc.rb +29 -14
  12. data/config/syntax/Nemerle.json +3 -3
  13. data/lib/ver.rb +88 -134
  14. data/lib/ver/entry.rb +5 -0
  15. data/lib/ver/exception_view.rb +97 -0
  16. data/lib/ver/hover_completion.rb +14 -7
  17. data/lib/ver/keymap.rb +30 -1
  18. data/lib/ver/layout.rb +20 -14
  19. data/lib/ver/methods.rb +6 -15
  20. data/lib/ver/methods/bookmark.rb +189 -0
  21. data/lib/ver/methods/completion.rb +2 -2
  22. data/lib/ver/methods/control.rb +109 -26
  23. data/lib/ver/methods/ctags.rb +28 -4
  24. data/lib/ver/methods/delete.rb +85 -4
  25. data/lib/ver/methods/insert.rb +73 -52
  26. data/lib/ver/methods/move.rb +122 -35
  27. data/lib/ver/methods/open.rb +4 -43
  28. data/lib/ver/methods/search.rb +46 -17
  29. data/lib/ver/methods/select.rb +121 -24
  30. data/lib/ver/methods/undo.rb +23 -0
  31. data/lib/ver/methods/views.rb +5 -0
  32. data/lib/ver/mode.rb +18 -17
  33. data/lib/ver/status.rb +2 -2
  34. data/lib/ver/status/context.rb +166 -0
  35. data/lib/ver/text.rb +43 -81
  36. data/lib/ver/text/index.rb +24 -7
  37. data/lib/ver/undo.rb +289 -0
  38. data/lib/ver/vendor/sized_array.rb +70 -0
  39. data/lib/ver/vendor/textpow.rb +6 -1
  40. data/lib/ver/version.rb +3 -0
  41. data/lib/ver/view.rb +11 -8
  42. data/lib/ver/view/list/grep.rb +15 -4
  43. data/lib/ver/view/term.rb +9 -3
  44. data/spec/helper.rb +94 -0
  45. data/ver.gemspec +9 -6
  46. metadata +25 -5
  47. data/spec/keymap.rb +0 -224
@@ -38,6 +38,8 @@ class VER::View::Terminal
38
38
 
39
39
  def destroy
40
40
  @text.destroy
41
+ rescue Errno::EIO, PTY::ChildExited
42
+ ensure
41
43
  @parent.focus
42
44
  end
43
45
 
@@ -55,9 +57,13 @@ class VER::View::Terminal
55
57
  end
56
58
  end
57
59
 
58
- loop do
59
- c = r_pty.sysread(1 << 15)
60
- on_chunk(c) if c
60
+ begin
61
+ loop do
62
+ c = r_pty.sysread(1 << 15)
63
+ on_chunk(c) if c
64
+ end
65
+ rescue Errno::EIO, PTY::ChildExited
66
+ destroy
61
67
  end
62
68
  end
63
69
  end
@@ -0,0 +1,94 @@
1
+ require 'bacon'
2
+ Bacon.summary_at_exit
3
+
4
+ require 'pathname'
5
+
6
+ # annoying fixes
7
+ class Pathname
8
+ alias / join
9
+
10
+ def cp(dest)
11
+ FileUtils.copy_file(expand_path.to_s, dest.to_s, preserve = true)
12
+ end
13
+
14
+ def =~(regexp)
15
+ to_s =~ regexp
16
+ end
17
+ end
18
+
19
+ require 'lib/ver'
20
+
21
+ VER.run fork: false do
22
+ Tk::After.idle do
23
+ describe 'startup' do
24
+ text = VER.layout.views.first.text
25
+
26
+ should 'start with welcome buffer' do
27
+ text.filename.to_s.should.end_with '.config/ver/welcome'
28
+ end
29
+
30
+ should 'be at start of buffer' do
31
+ text.index(:insert).to_s.should == "1.0"
32
+ end
33
+ end
34
+ end
35
+
36
+ Tk::After.idle do
37
+ describe VER::Methods::Move do
38
+ text = VER.layout.views.first.text
39
+
40
+ moving = lambda{|from, to, *args|
41
+ from, to = text.index(from), text.index(to)
42
+ $DEBUG = true
43
+ text.mark_set(:insert, from)
44
+ text.send(*args)
45
+ text.index(:insert).should == to
46
+ $DEBUG = false
47
+ }
48
+
49
+ should 'go a char forward' do
50
+ moving['1.0', '1.1', :forward_char]
51
+ moving['1.1', '1.2', :forward_char]
52
+ end
53
+
54
+ should 'go multiple chars forward' do
55
+ moving['1.0', '1.10', :forward_char, 10]
56
+ end
57
+
58
+ should 'go a char backward' do
59
+ moving['1.2', '1.1', :backward_char]
60
+ moving['1.1', '1.0', :backward_char]
61
+ end
62
+
63
+ should 'go multiple chars backward' do
64
+ moving['1.11', '1.1', :backward_char, 10]
65
+ end
66
+
67
+ should 'go to the beginning of a lines' do
68
+ moving['2.20', '2.0', :beginning_of_line]
69
+ end
70
+
71
+ should 'go to the end of a line' do
72
+ moving['2.0', '2.0 lineend', :end_of_line]
73
+ end
74
+
75
+ should 'go to a line number' do
76
+ moving['2.0', '10.0', :go_line, 10]
77
+ end
78
+
79
+ should 'go to the end of a file' do
80
+ moving['2.0', 'end - 1 chars', :end_of_file]
81
+ end
82
+
83
+ should 'go a page down' do
84
+ moving['2.0', '2.1', :page_down]
85
+ end
86
+
87
+ should 'go a page up' do
88
+ moving['2.0', '1.51', :page_up]
89
+ end
90
+ end
91
+
92
+ EM.stop
93
+ end
94
+ end
@@ -2,16 +2,16 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{ver}
5
- s.version = "2009.11.29"
5
+ s.version = "2009.12.14"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Michael 'manveru' Fellinger"]
9
- s.date = %q{2009-11-29}
9
+ s.date = %q{2009-12-14}
10
10
  s.default_executable = %q{ver}
11
11
  s.description = %q{An advanced text editor using tk and bringing world peace.}
12
12
  s.email = %q{m.fellinger@gmail.com}
13
13
  s.executables = ["ver"]
14
- s.files = ["CHANGELOG", "MANIFEST", "README.textile", "Rakefile", "TODO", "bin/ver", "config/detect.rb", "config/keymap/emacs.rb", "config/keymap/vim.rb", "config/preferences/ANTLR.json", "config/preferences/ASP vb.NET.json", "config/preferences/ASP.json", "config/preferences/ActionScript.json", "config/preferences/Active4D.json", "config/preferences/Ada.json", "config/preferences/Ant.json", "config/preferences/Apache.json", "config/preferences/AppleScript.json", "config/preferences/Bison.json", "config/preferences/Blogging.json", "config/preferences/C.json", "config/preferences/CMake.json", "config/preferences/CSS.json", "config/preferences/CTags.json", "config/preferences/CVS.json", "config/preferences/ColdFusion.json", "config/preferences/D.json", "config/preferences/Darcs.json", "config/preferences/Diff.json", "config/preferences/DokuWiki.json", "config/preferences/Doxygen.json", "config/preferences/Dylan.json", "config/preferences/Eiffel.json", "config/preferences/Erlang.json", "config/preferences/Experimental.json", "config/preferences/F-Script.json", "config/preferences/FXScript.json", "config/preferences/FileMerge.json", "config/preferences/Fortran.json", "config/preferences/GTD2.json", "config/preferences/GTDAlt.json", "config/preferences/GetBundle.json", "config/preferences/Gettext.json", "config/preferences/Graphviz.json", "config/preferences/Greasemonkey.json", "config/preferences/Gri.json", "config/preferences/HTML.json", "config/preferences/Haskell.json", "config/preferences/Hotkey.json", "config/preferences/ImageBrowser.json", "config/preferences/Inform.json", "config/preferences/Ini.json", "config/preferences/Installer.json", "config/preferences/Io.json", "config/preferences/JSON.json", "config/preferences/Java.json", "config/preferences/JavaDoc.json", "config/preferences/JavaScript.json", "config/preferences/LaTeX.json", "config/preferences/Lex/Flex.json", "config/preferences/Lighttpd.json", "config/preferences/LilyPond.json", "config/preferences/Lisp.json", "config/preferences/Logo.json", "config/preferences/Logtalk.json", "config/preferences/Lua.json", "config/preferences/MEL.json", "config/preferences/MIPS Assembler.json", "config/preferences/MacPorts.json", "config/preferences/Mail.json", "config/preferences/Make.json", "config/preferences/Markdown.json", "config/preferences/Math.json", "config/preferences/Matlab.json", "config/preferences/Maven.json", "config/preferences/Mediawiki.json", "config/preferences/Mercurial.json", "config/preferences/Modula.json", "config/preferences/MoinMoin.json", "config/preferences/Navigation.json", "config/preferences/Nemerle.json", "config/preferences/OCaml Code Completion.json", "config/preferences/OCaml.json", "config/preferences/ODCompletion.json", "config/preferences/Objective-C.json", "config/preferences/OpenGL.json", "config/preferences/Outlines.json", "config/preferences/Pascal.json", "config/preferences/Perforce.json", "config/preferences/Perl.json", "config/preferences/PmWiki.json", "config/preferences/Postscript.json", "config/preferences/Processing.json", "config/preferences/Prolog.json", "config/preferences/Propel.json", "config/preferences/Python.json", "config/preferences/Quake.json", "config/preferences/R.json", "config/preferences/Ragel.json", "config/preferences/Regular Expressions.json", "config/preferences/Remind.json", "config/preferences/Rez.json", "config/preferences/Ruby.json", "config/preferences/S5 Slide Show.json", "config/preferences/SCons.json", "config/preferences/SQL.json", "config/preferences/SSH Config.json", "config/preferences/SVK.json", "config/preferences/SWIG.json", "config/preferences/SWeave.json", "config/preferences/Scheme.json", "config/preferences/Scilab.json", "config/preferences/Setext.json", "config/preferences/Shell Script.json", "config/preferences/Slate.json", "config/preferences/Source.json", "config/preferences/Subversion.json", "config/preferences/TODO.json", "config/preferences/Tabular.json", "config/preferences/Tcl.json", "config/preferences/TerminalMate.json", "config/preferences/Text.json", "config/preferences/TextMate.json", "config/preferences/Textile.json", "config/preferences/Thrift.json", "config/preferences/Transmit.json", "config/preferences/Twiki.json", "config/preferences/Txt2tags.json", "config/preferences/Vectorscript.json", "config/preferences/XML.json", "config/preferences/Xcode.json", "config/preferences/YAML.json", "config/preferences/iCalendar.json", "config/preferences/iTerm.json", "config/preferences/reStructuredText.json", "config/rc.rb", "config/scratch", "config/syntax/ANTLR.json", "config/syntax/ASP vb.NET.json", "config/syntax/ASP.json", "config/syntax/ActionScript.json", "config/syntax/Active4D Config.json", "config/syntax/Active4D Library.json", "config/syntax/Active4D.json", "config/syntax/Ada.json", "config/syntax/Ant.json", "config/syntax/Apache.json", "config/syntax/AppleScript.json", "config/syntax/BibTeX.json", "config/syntax/Bison.json", "config/syntax/Blog - HTML.json", "config/syntax/Blog - Markdown.json", "config/syntax/Blog - Text.json", "config/syntax/Blog - Textile.json", "config/syntax/C++.json", "config/syntax/C.json", "config/syntax/CMake Listfile.json", "config/syntax/CSS.json", "config/syntax/CSV.json", "config/syntax/ColdFusion.json", "config/syntax/D.json", "config/syntax/Diff.json", "config/syntax/DokuWiki.json", "config/syntax/Doxygen.json", "config/syntax/Dylan.json", "config/syntax/Eiffel.json", "config/syntax/Erlang.json", "config/syntax/F-Script.json", "config/syntax/FXScript.json", "config/syntax/Fortran - Modern.json", "config/syntax/Fortran - Punchcard.json", "config/syntax/GTD.json", "config/syntax/GTDalt.json", "config/syntax/Gettext.json", "config/syntax/Go.json", "config/syntax/Graphviz (DOT).json", "config/syntax/Greasemonkey.json", "config/syntax/Gri.json", "config/syntax/HTML (ASP).json", "config/syntax/HTML (ASP.net).json", "config/syntax/HTML (Active4D).json", "config/syntax/HTML (Erlang).json", "config/syntax/HTML (Tcl).json", "config/syntax/HTML.json", "config/syntax/Haskell.json", "config/syntax/Inform.json", "config/syntax/Ini.json", "config/syntax/Installer Distribution Script.json", "config/syntax/Io.json", "config/syntax/JSON.json", "config/syntax/Java Properties.json", "config/syntax/Java Server Page (JSP).json", "config/syntax/Java.json", "config/syntax/JavaDoc.json", "config/syntax/JavaScript.json", "config/syntax/LaTeX Beamer.json", "config/syntax/LaTeX Log.json", "config/syntax/LaTeX Memoir.json", "config/syntax/LaTeX.json", "config/syntax/Lex-Flex.json", "config/syntax/Lighttpd.json", "config/syntax/LilyPond.json", "config/syntax/Lisp.json", "config/syntax/Literate Haskell.json", "config/syntax/Logo.json", "config/syntax/Logtalk.json", "config/syntax/Lua.json", "config/syntax/MATLAB.json", "config/syntax/MEL.json", "config/syntax/MIPS Assembler.json", "config/syntax/MacPorts Portfile.json", "config/syntax/Mail.json", "config/syntax/Makefile.json", "config/syntax/Markdown.json", "config/syntax/Maven POM.json", "config/syntax/Mediawiki.json", "config/syntax/Modula-3.json", "config/syntax/MoinMoin.json", "config/syntax/MultiMarkdown.json", "config/syntax/Nemerle.json", "config/syntax/OCaml.json", "config/syntax/OCamllex.json", "config/syntax/OCamlyacc.json", "config/syntax/Objective-C++.json", "config/syntax/Objective-C.json", "config/syntax/Octave.json", "config/syntax/OpenGL.json", "config/syntax/PHP.json", "config/syntax/Pascal.json", "config/syntax/Perl.json", "config/syntax/Plain Text.json", "config/syntax/PmWiki.json", "config/syntax/Postscript.json", "config/syntax/Processing.json", "config/syntax/Prolog.json", "config/syntax/Python.json", "config/syntax/Quake Style .cfg.json", "config/syntax/R.json", "config/syntax/Ragel.json", "config/syntax/Rd (R Documentation).json", "config/syntax/Regular Expressions (Oniguruma).json", "config/syntax/Regular Expressions (Python).json", "config/syntax/Release Notes.json", "config/syntax/Remind.json", "config/syntax/Rez.json", "config/syntax/Ruby Sass.json", "config/syntax/Ruby.json", "config/syntax/S5 Slide Show.json", "config/syntax/SQL.json", "config/syntax/SSH Config.json", "config/syntax/SWIG.json", "config/syntax/SWeave.json", "config/syntax/Scheme.json", "config/syntax/Scilab.json", "config/syntax/Setext.json", "config/syntax/Shell Script (Bash).json", "config/syntax/Slate.json", "config/syntax/Strings File.json", "config/syntax/TSV.json", "config/syntax/Tcl.json", "config/syntax/TeX Math.json", "config/syntax/TeX.json", "config/syntax/Textile.json", "config/syntax/Thrift.json", "config/syntax/Twiki.json", "config/syntax/Txt2tags.json", "config/syntax/Vectorscript.json", "config/syntax/XML strict.json", "config/syntax/XML.json", "config/syntax/XSL.json", "config/syntax/YAML.json", "config/syntax/camlp4.json", "config/syntax/iCalendar.json", "config/syntax/mod_perl.json", "config/syntax/reStructuredText.json", "config/syntax/svn-commit.tmp.json", "config/theme/Active4D.json", "config/theme/All Hallow's Eve.json", "config/theme/Amy.json", "config/theme/BBEdit.json", "config/theme/Bespin.json", "config/theme/Blackboard.json", "config/theme/BoysAndGirls01.json", "config/theme/Brilliance Black.json", "config/theme/Brilliance Dull.json", "config/theme/Classic Modified.json", "config/theme/Cobalt.json", "config/theme/Cool Glow.json", "config/theme/Dawn.json", "config/theme/Eiffel.json", "config/theme/Espresso Libre.json", "config/theme/Fluidvision.json", "config/theme/IDLE.json", "config/theme/LAZY.json", "config/theme/Mac Classic.json", "config/theme/MagicWB (Amiga).json", "config/theme/Merbivore Soft.json", "config/theme/Merbivore.json", "config/theme/Monokai.json", "config/theme/Notepad2.json", "config/theme/Pastels on Dark.json", "config/theme/RubyBlue.json", "config/theme/Sin City 2.json", "config/theme/Slate.json", "config/theme/Slush & Poppies.json", "config/theme/SpaceCadet.json", "config/theme/Sunburst.json", "config/theme/Twilight BG FG.json", "config/theme/Twilight.json", "config/theme/Whys Poignant.json", "config/theme/Zenburnesque.json", "config/theme/barf.json", "config/theme/fake.json", "config/theme/happydeluxe.json", "config/theme/iLife 05.json", "config/theme/iPlastic.json", "config/theme/mintBlue Dark.json", "config/theme/mintBlue.json", "config/theme/monoindustrial.json", "config/theme/starlight.json", "config/tutorial", "config/welcome", "help/index.verh", "lib/ver.rb", "lib/ver/entry.rb", "lib/ver/font.rb", "lib/ver/help.rb", "lib/ver/help/describe_key.rb", "lib/ver/help/help_for_help.rb", "lib/ver/hover_completion.rb", "lib/ver/keymap.rb", "lib/ver/layout.rb", "lib/ver/methods.rb", "lib/ver/methods/clipboard.rb", "lib/ver/methods/completion.rb", "lib/ver/methods/control.rb", "lib/ver/methods/ctags.rb", "lib/ver/methods/delete.rb", "lib/ver/methods/help.rb", "lib/ver/methods/insert.rb", "lib/ver/methods/move.rb", "lib/ver/methods/open.rb", "lib/ver/methods/preview.rb", "lib/ver/methods/save.rb", "lib/ver/methods/search.rb", "lib/ver/methods/select.rb", "lib/ver/methods/shortcuts.rb", "lib/ver/methods/views.rb", "lib/ver/mode.rb", "lib/ver/options.rb", "lib/ver/plist.rb", "lib/ver/status.rb", "lib/ver/syntax.rb", "lib/ver/syntax/detector.rb", "lib/ver/syntax/processor.rb", "lib/ver/text.rb", "lib/ver/text/index.rb", "lib/ver/theme.rb", "lib/ver/tooltip.rb", "lib/ver/vendor/binary_search.rb", "lib/ver/vendor/fuzzy_file_finder.rb", "lib/ver/vendor/levenshtein.rb", "lib/ver/vendor/textpow.rb", "lib/ver/view.rb", "lib/ver/view/console.rb", "lib/ver/view/entry.rb", "lib/ver/view/list.rb", "lib/ver/view/list/buffer.rb", "lib/ver/view/list/ex.rb", "lib/ver/view/list/fuzzy_file_finder.rb", "lib/ver/view/list/grep.rb", "lib/ver/view/list/methods.rb", "lib/ver/view/list/syntax.rb", "lib/ver/view/list/theme.rb", "lib/ver/view/term.rb", "spec/keymap.rb", "tasks/authors.rake", "tasks/bacon.rake", "tasks/changelog.rake", "tasks/gem.rake", "tasks/gem_installer.rake", "tasks/gem_setup.rake", "tasks/grancher.rake", "tasks/install_dependencies.rake", "tasks/manifest.rake", "tasks/plist2json.rake", "tasks/rcov.rake", "tasks/release.rake", "tasks/reversion.rake", "tasks/setup.rake", "tasks/syntax_list.rake", "tasks/ycov.rake", "ver.gemspec"]
14
+ s.files = ["AUTHORS", "CHANGELOG", "LICENSE", "MANIFEST", "README.textile", "Rakefile", "TODO", "bin/ver", "config/detect.rb", "config/keymap/diakonos.rb", "config/keymap/emacs.rb", "config/keymap/vim.rb", "config/preferences/ANTLR.json", "config/preferences/ASP vb.NET.json", "config/preferences/ASP.json", "config/preferences/ActionScript.json", "config/preferences/Active4D.json", "config/preferences/Ada.json", "config/preferences/Ant.json", "config/preferences/Apache.json", "config/preferences/AppleScript.json", "config/preferences/Bison.json", "config/preferences/Blogging.json", "config/preferences/C.json", "config/preferences/CMake.json", "config/preferences/CSS.json", "config/preferences/CTags.json", "config/preferences/CVS.json", "config/preferences/ColdFusion.json", "config/preferences/D.json", "config/preferences/Darcs.json", "config/preferences/Diff.json", "config/preferences/DokuWiki.json", "config/preferences/Doxygen.json", "config/preferences/Dylan.json", "config/preferences/Eiffel.json", "config/preferences/Erlang.json", "config/preferences/Experimental.json", "config/preferences/F-Script.json", "config/preferences/FXScript.json", "config/preferences/FileMerge.json", "config/preferences/Fortran.json", "config/preferences/GTD2.json", "config/preferences/GTDAlt.json", "config/preferences/GetBundle.json", "config/preferences/Gettext.json", "config/preferences/Graphviz.json", "config/preferences/Greasemonkey.json", "config/preferences/Gri.json", "config/preferences/HTML.json", "config/preferences/Haskell.json", "config/preferences/Hotkey.json", "config/preferences/ImageBrowser.json", "config/preferences/Inform.json", "config/preferences/Ini.json", "config/preferences/Installer.json", "config/preferences/Io.json", "config/preferences/JSON.json", "config/preferences/Java.json", "config/preferences/JavaDoc.json", "config/preferences/JavaScript.json", "config/preferences/LaTeX.json", "config/preferences/Lex/Flex.json", "config/preferences/Lighttpd.json", "config/preferences/LilyPond.json", "config/preferences/Lisp.json", "config/preferences/Logo.json", "config/preferences/Logtalk.json", "config/preferences/Lua.json", "config/preferences/MEL.json", "config/preferences/MIPS Assembler.json", "config/preferences/MacPorts.json", "config/preferences/Mail.json", "config/preferences/Make.json", "config/preferences/Markdown.json", "config/preferences/Math.json", "config/preferences/Matlab.json", "config/preferences/Maven.json", "config/preferences/Mediawiki.json", "config/preferences/Mercurial.json", "config/preferences/Modula.json", "config/preferences/MoinMoin.json", "config/preferences/Navigation.json", "config/preferences/Nemerle.json", "config/preferences/OCaml Code Completion.json", "config/preferences/OCaml.json", "config/preferences/ODCompletion.json", "config/preferences/Objective-C.json", "config/preferences/OpenGL.json", "config/preferences/Outlines.json", "config/preferences/Pascal.json", "config/preferences/Perforce.json", "config/preferences/Perl.json", "config/preferences/PmWiki.json", "config/preferences/Postscript.json", "config/preferences/Processing.json", "config/preferences/Prolog.json", "config/preferences/Propel.json", "config/preferences/Python.json", "config/preferences/Quake.json", "config/preferences/R.json", "config/preferences/Ragel.json", "config/preferences/Regular Expressions.json", "config/preferences/Remind.json", "config/preferences/Rez.json", "config/preferences/Ruby.json", "config/preferences/S5 Slide Show.json", "config/preferences/SCons.json", "config/preferences/SQL.json", "config/preferences/SSH Config.json", "config/preferences/SVK.json", "config/preferences/SWIG.json", "config/preferences/SWeave.json", "config/preferences/Scheme.json", "config/preferences/Scilab.json", "config/preferences/Setext.json", "config/preferences/Shell Script.json", "config/preferences/Slate.json", "config/preferences/Source.json", "config/preferences/Subversion.json", "config/preferences/TODO.json", "config/preferences/Tabular.json", "config/preferences/Tcl.json", "config/preferences/TerminalMate.json", "config/preferences/Text.json", "config/preferences/TextMate.json", "config/preferences/Textile.json", "config/preferences/Thrift.json", "config/preferences/Transmit.json", "config/preferences/Twiki.json", "config/preferences/Txt2tags.json", "config/preferences/Vectorscript.json", "config/preferences/XML.json", "config/preferences/Xcode.json", "config/preferences/YAML.json", "config/preferences/iCalendar.json", "config/preferences/iTerm.json", "config/preferences/reStructuredText.json", "config/rc.rb", "config/scratch", "config/syntax/ANTLR.json", "config/syntax/ASP vb.NET.json", "config/syntax/ASP.json", "config/syntax/ActionScript.json", "config/syntax/Active4D Config.json", "config/syntax/Active4D Library.json", "config/syntax/Active4D.json", "config/syntax/Ada.json", "config/syntax/Ant.json", "config/syntax/Apache.json", "config/syntax/AppleScript.json", "config/syntax/BibTeX.json", "config/syntax/Bison.json", "config/syntax/Blog - HTML.json", "config/syntax/Blog - Markdown.json", "config/syntax/Blog - Text.json", "config/syntax/Blog - Textile.json", "config/syntax/C++.json", "config/syntax/C.json", "config/syntax/CMake Listfile.json", "config/syntax/CSS.json", "config/syntax/CSV.json", "config/syntax/ColdFusion.json", "config/syntax/D.json", "config/syntax/Diff.json", "config/syntax/DokuWiki.json", "config/syntax/Doxygen.json", "config/syntax/Dylan.json", "config/syntax/Eiffel.json", "config/syntax/Erlang.json", "config/syntax/F-Script.json", "config/syntax/FXScript.json", "config/syntax/Fortran - Modern.json", "config/syntax/Fortran - Punchcard.json", "config/syntax/GTD.json", "config/syntax/GTDalt.json", "config/syntax/Gettext.json", "config/syntax/Go.json", "config/syntax/Graphviz (DOT).json", "config/syntax/Greasemonkey.json", "config/syntax/Gri.json", "config/syntax/HTML (ASP).json", "config/syntax/HTML (ASP.net).json", "config/syntax/HTML (Active4D).json", "config/syntax/HTML (Erlang).json", "config/syntax/HTML (Tcl).json", "config/syntax/HTML.json", "config/syntax/Haskell.json", "config/syntax/Inform.json", "config/syntax/Ini.json", "config/syntax/Installer Distribution Script.json", "config/syntax/Io.json", "config/syntax/JSON.json", "config/syntax/Java Properties.json", "config/syntax/Java Server Page (JSP).json", "config/syntax/Java.json", "config/syntax/JavaDoc.json", "config/syntax/JavaScript.json", "config/syntax/LaTeX Beamer.json", "config/syntax/LaTeX Log.json", "config/syntax/LaTeX Memoir.json", "config/syntax/LaTeX.json", "config/syntax/Lex-Flex.json", "config/syntax/Lighttpd.json", "config/syntax/LilyPond.json", "config/syntax/Lisp.json", "config/syntax/Literate Haskell.json", "config/syntax/Logo.json", "config/syntax/Logtalk.json", "config/syntax/Lua.json", "config/syntax/MATLAB.json", "config/syntax/MEL.json", "config/syntax/MIPS Assembler.json", "config/syntax/MacPorts Portfile.json", "config/syntax/Mail.json", "config/syntax/Makefile.json", "config/syntax/Markdown.json", "config/syntax/Maven POM.json", "config/syntax/Mediawiki.json", "config/syntax/Modula-3.json", "config/syntax/MoinMoin.json", "config/syntax/MultiMarkdown.json", "config/syntax/Nemerle.json", "config/syntax/OCaml.json", "config/syntax/OCamllex.json", "config/syntax/OCamlyacc.json", "config/syntax/Objective-C++.json", "config/syntax/Objective-C.json", "config/syntax/Octave.json", "config/syntax/OpenGL.json", "config/syntax/PHP.json", "config/syntax/Pascal.json", "config/syntax/Perl.json", "config/syntax/Plain Text.json", "config/syntax/PmWiki.json", "config/syntax/Postscript.json", "config/syntax/Processing.json", "config/syntax/Prolog.json", "config/syntax/Python.json", "config/syntax/Quake Style .cfg.json", "config/syntax/R.json", "config/syntax/Ragel.json", "config/syntax/Rd (R Documentation).json", "config/syntax/Regular Expressions (Oniguruma).json", "config/syntax/Regular Expressions (Python).json", "config/syntax/Release Notes.json", "config/syntax/Remind.json", "config/syntax/Rez.json", "config/syntax/Ruby Sass.json", "config/syntax/Ruby.json", "config/syntax/S5 Slide Show.json", "config/syntax/SQL.json", "config/syntax/SSH Config.json", "config/syntax/SWIG.json", "config/syntax/SWeave.json", "config/syntax/Scheme.json", "config/syntax/Scilab.json", "config/syntax/Setext.json", "config/syntax/Shell Script (Bash).json", "config/syntax/Slate.json", "config/syntax/Strings File.json", "config/syntax/TSV.json", "config/syntax/Tcl.json", "config/syntax/TeX Math.json", "config/syntax/TeX.json", "config/syntax/Textile.json", "config/syntax/Thrift.json", "config/syntax/Twiki.json", "config/syntax/Txt2tags.json", "config/syntax/Vectorscript.json", "config/syntax/XML strict.json", "config/syntax/XML.json", "config/syntax/XSL.json", "config/syntax/YAML.json", "config/syntax/camlp4.json", "config/syntax/iCalendar.json", "config/syntax/mod_perl.json", "config/syntax/reStructuredText.json", "config/syntax/svn-commit.tmp.json", "config/theme/Active4D.json", "config/theme/All Hallow's Eve.json", "config/theme/Amy.json", "config/theme/BBEdit.json", "config/theme/Bespin.json", "config/theme/Blackboard.json", "config/theme/BoysAndGirls01.json", "config/theme/Brilliance Black.json", "config/theme/Brilliance Dull.json", "config/theme/Classic Modified.json", "config/theme/Cobalt.json", "config/theme/Cool Glow.json", "config/theme/Dawn.json", "config/theme/Eiffel.json", "config/theme/Espresso Libre.json", "config/theme/Fluidvision.json", "config/theme/IDLE.json", "config/theme/LAZY.json", "config/theme/Mac Classic.json", "config/theme/MagicWB (Amiga).json", "config/theme/Merbivore Soft.json", "config/theme/Merbivore.json", "config/theme/Monokai.json", "config/theme/Notepad2.json", "config/theme/Pastels on Dark.json", "config/theme/RubyBlue.json", "config/theme/Sin City 2.json", "config/theme/Slate.json", "config/theme/Slush & Poppies.json", "config/theme/SpaceCadet.json", "config/theme/Sunburst.json", "config/theme/Twilight BG FG.json", "config/theme/Twilight.json", "config/theme/Whys Poignant.json", "config/theme/Zenburnesque.json", "config/theme/barf.json", "config/theme/fake.json", "config/theme/happydeluxe.json", "config/theme/iLife 05.json", "config/theme/iPlastic.json", "config/theme/mintBlue Dark.json", "config/theme/mintBlue.json", "config/theme/monoindustrial.json", "config/theme/starlight.json", "config/tutorial", "config/welcome", "help/index.verh", "lib/ver.rb", "lib/ver/entry.rb", "lib/ver/exception_view.rb", "lib/ver/font.rb", "lib/ver/help.rb", "lib/ver/help/describe_key.rb", "lib/ver/help/help_for_help.rb", "lib/ver/hover_completion.rb", "lib/ver/keymap.rb", "lib/ver/layout.rb", "lib/ver/methods.rb", "lib/ver/methods/bookmark.rb", "lib/ver/methods/clipboard.rb", "lib/ver/methods/completion.rb", "lib/ver/methods/control.rb", "lib/ver/methods/ctags.rb", "lib/ver/methods/delete.rb", "lib/ver/methods/help.rb", "lib/ver/methods/insert.rb", "lib/ver/methods/move.rb", "lib/ver/methods/open.rb", "lib/ver/methods/preview.rb", "lib/ver/methods/save.rb", "lib/ver/methods/search.rb", "lib/ver/methods/select.rb", "lib/ver/methods/shortcuts.rb", "lib/ver/methods/undo.rb", "lib/ver/methods/views.rb", "lib/ver/mode.rb", "lib/ver/options.rb", "lib/ver/plist.rb", "lib/ver/status.rb", "lib/ver/status/context.rb", "lib/ver/syntax.rb", "lib/ver/syntax/detector.rb", "lib/ver/syntax/processor.rb", "lib/ver/text.rb", "lib/ver/text/index.rb", "lib/ver/theme.rb", "lib/ver/tooltip.rb", "lib/ver/undo.rb", "lib/ver/vendor/binary_search.rb", "lib/ver/vendor/fuzzy_file_finder.rb", "lib/ver/vendor/levenshtein.rb", "lib/ver/vendor/sized_array.rb", "lib/ver/vendor/textpow.rb", "lib/ver/version.rb", "lib/ver/view.rb", "lib/ver/view/console.rb", "lib/ver/view/entry.rb", "lib/ver/view/list.rb", "lib/ver/view/list/buffer.rb", "lib/ver/view/list/ex.rb", "lib/ver/view/list/fuzzy_file_finder.rb", "lib/ver/view/list/grep.rb", "lib/ver/view/list/methods.rb", "lib/ver/view/list/syntax.rb", "lib/ver/view/list/theme.rb", "lib/ver/view/term.rb", "spec/helper.rb", "tasks/authors.rake", "tasks/bacon.rake", "tasks/changelog.rake", "tasks/gem.rake", "tasks/gem_installer.rake", "tasks/gem_setup.rake", "tasks/grancher.rake", "tasks/install_dependencies.rake", "tasks/manifest.rake", "tasks/plist2json.rake", "tasks/rcov.rake", "tasks/release.rake", "tasks/reversion.rake", "tasks/setup.rake", "tasks/syntax_list.rake", "tasks/ycov.rake", "ver.gemspec"]
15
15
  s.homepage = %q{http://github.com/manveru/ver}
16
16
  s.require_paths = ["lib"]
17
17
  s.rubygems_version = %q{1.3.5}
@@ -22,11 +22,14 @@ Gem::Specification.new do |s|
22
22
  s.specification_version = 3
23
23
 
24
24
  if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
25
- s.add_runtime_dependency(%q<ffi-tk>, ["= 2009.11.29"])
25
+ s.add_runtime_dependency(%q<ffi-tk>, ["= 2009.12.14"])
26
+ s.add_runtime_dependency(%q<eventmachine>, ["= 0.12.10"])
26
27
  else
27
- s.add_dependency(%q<ffi-tk>, ["= 2009.11.29"])
28
+ s.add_dependency(%q<ffi-tk>, ["= 2009.12.14"])
29
+ s.add_dependency(%q<eventmachine>, ["= 0.12.10"])
28
30
  end
29
31
  else
30
- s.add_dependency(%q<ffi-tk>, ["= 2009.11.29"])
32
+ s.add_dependency(%q<ffi-tk>, ["= 2009.12.14"])
33
+ s.add_dependency(%q<eventmachine>, ["= 0.12.10"])
31
34
  end
32
35
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ver
3
3
  version: !ruby/object:Gem::Version
4
- version: 2009.11.29
4
+ version: 2009.12.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael 'manveru' Fellinger
@@ -9,8 +9,8 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-11-29 00:00:00 +09:00
13
- default_executable: ver
12
+ date: 2009-12-14 00:00:00 +09:00
13
+ default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: ffi-tk
@@ -20,7 +20,17 @@ dependencies:
20
20
  requirements:
21
21
  - - "="
22
22
  - !ruby/object:Gem::Version
23
- version: 2009.11.29
23
+ version: 2009.12.14
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: eventmachine
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.12.10
24
34
  version:
25
35
  description: An advanced text editor using tk and bringing world peace.
26
36
  email: m.fellinger@gmail.com
@@ -31,13 +41,16 @@ extensions: []
31
41
  extra_rdoc_files: []
32
42
 
33
43
  files:
44
+ - AUTHORS
34
45
  - CHANGELOG
46
+ - LICENSE
35
47
  - MANIFEST
36
48
  - README.textile
37
49
  - Rakefile
38
50
  - TODO
39
51
  - bin/ver
40
52
  - config/detect.rb
53
+ - config/keymap/diakonos.rb
41
54
  - config/keymap/emacs.rb
42
55
  - config/keymap/vim.rb
43
56
  - config/preferences/ANTLR.json
@@ -356,6 +369,7 @@ files:
356
369
  - help/index.verh
357
370
  - lib/ver.rb
358
371
  - lib/ver/entry.rb
372
+ - lib/ver/exception_view.rb
359
373
  - lib/ver/font.rb
360
374
  - lib/ver/help.rb
361
375
  - lib/ver/help/describe_key.rb
@@ -364,6 +378,7 @@ files:
364
378
  - lib/ver/keymap.rb
365
379
  - lib/ver/layout.rb
366
380
  - lib/ver/methods.rb
381
+ - lib/ver/methods/bookmark.rb
367
382
  - lib/ver/methods/clipboard.rb
368
383
  - lib/ver/methods/completion.rb
369
384
  - lib/ver/methods/control.rb
@@ -378,11 +393,13 @@ files:
378
393
  - lib/ver/methods/search.rb
379
394
  - lib/ver/methods/select.rb
380
395
  - lib/ver/methods/shortcuts.rb
396
+ - lib/ver/methods/undo.rb
381
397
  - lib/ver/methods/views.rb
382
398
  - lib/ver/mode.rb
383
399
  - lib/ver/options.rb
384
400
  - lib/ver/plist.rb
385
401
  - lib/ver/status.rb
402
+ - lib/ver/status/context.rb
386
403
  - lib/ver/syntax.rb
387
404
  - lib/ver/syntax/detector.rb
388
405
  - lib/ver/syntax/processor.rb
@@ -390,10 +407,13 @@ files:
390
407
  - lib/ver/text/index.rb
391
408
  - lib/ver/theme.rb
392
409
  - lib/ver/tooltip.rb
410
+ - lib/ver/undo.rb
393
411
  - lib/ver/vendor/binary_search.rb
394
412
  - lib/ver/vendor/fuzzy_file_finder.rb
395
413
  - lib/ver/vendor/levenshtein.rb
414
+ - lib/ver/vendor/sized_array.rb
396
415
  - lib/ver/vendor/textpow.rb
416
+ - lib/ver/version.rb
397
417
  - lib/ver/view.rb
398
418
  - lib/ver/view/console.rb
399
419
  - lib/ver/view/entry.rb
@@ -406,7 +426,7 @@ files:
406
426
  - lib/ver/view/list/syntax.rb
407
427
  - lib/ver/view/list/theme.rb
408
428
  - lib/ver/view/term.rb
409
- - spec/keymap.rb
429
+ - spec/helper.rb
410
430
  - tasks/authors.rake
411
431
  - tasks/bacon.rake
412
432
  - tasks/changelog.rake
@@ -1,224 +0,0 @@
1
- require 'bacon'
2
- Bacon.summary_on_exit
3
-
4
- module VER
5
- class Keyboard
6
- end
7
-
8
- class Keymap
9
- attr_accessor :modes, :current_mode
10
-
11
- def initialize
12
- @modes = {}
13
- end
14
-
15
- def send(*args)
16
- @callback.__send__(*args)
17
- end
18
-
19
- def enter_key(key)
20
- modes[current_mode].enter_key key
21
- end
22
-
23
- # TODO: callbacks
24
- def current_mode=(cm)
25
- @current_mode = cm.to_sym
26
- end
27
-
28
- def add_mode(name)
29
- @modes[name.to_sym] = mode = Mode.new(self)
30
- yield mode if block_given?
31
- mode
32
- end
33
- end
34
-
35
- class Mode
36
- def initialize(callback = nil)
37
- @callback = callback
38
- @stack = []
39
- @map = {}
40
- @ancestors = []
41
- end
42
-
43
- def inherit(other)
44
- @ancestors.delete other
45
- @ancestors.unshift other
46
- end
47
-
48
- def ancestors(&block)
49
- ([self] + @ancestors).find(&block)
50
- end
51
-
52
- def map(sym, *keychain)
53
- bind(*keychain.flatten){|*arg| @callback.send(sym, *arg) }
54
- end
55
-
56
- def bind(*keychain, &block)
57
- keychain = keychain.dup
58
- total = hash = {}
59
-
60
- while key = keychain.shift
61
- if keychain.empty?
62
- hash[key] = block
63
- else
64
- hash = hash[key] = {}
65
- end
66
- end
67
-
68
- @map.replace @map.merge(total, &MERGER)
69
- end
70
-
71
- def enter_keys(*keys)
72
- keys.flatten.each{|key| enter_key(key) }
73
- end
74
-
75
- def enter_key(key)
76
- @stack << key
77
- ancestors{|ancestor| ancestor.attempt_execute(@stack) }
78
- end
79
-
80
- def attempt_execute(original_stack)
81
- stack, arg = Mode.split_stack(original_stack)
82
- return false if stack.empty?
83
-
84
- executable = stack.inject(@map){|keys, key| keys.fetch(key) }
85
-
86
- if execute(executable, *arg)
87
- original_stack.clear
88
- return true
89
- end
90
-
91
- false
92
- rescue KeyError
93
- false
94
- end
95
-
96
- def execute(executable, *arg)
97
- case executable
98
- when Proc
99
- executable.call(*arg)
100
- true
101
- when Symbol
102
- @callback.send(executable, *arg)
103
- else
104
- false
105
- end
106
- end
107
-
108
- def self.split_stack(stack)
109
- return stack, nil if stack[0] == '0'
110
-
111
- pivot = stack.index{|c| c !~ /\d/ }
112
-
113
- if pivot == 0
114
- return stack, nil
115
- elsif pivot
116
- return stack[pivot..-1], stack[0..pivot].join.to_i
117
- else
118
- return [], nil
119
- end
120
- end
121
-
122
- MERGER = proc{|key,v1,v2|
123
- Hash === v1 && Hash === v2 ? v1.merge(v2, &MERGER) : v2
124
- }
125
- end
126
- end
127
-
128
- describe Mode = VER::Mode do
129
- it 'splits stack into argument and keychain' do
130
- Mode.split_stack(['4', 'a']).should == [['a'], 4]
131
- Mode.split_stack(['4', '2', 'a']).should == [['a'], 42]
132
- Mode.split_stack(['4', '2', 'a', 'b']).should == [['a', 'b'], 42]
133
- Mode.split_stack(['a', 'b']).should == [['a', 'b'], nil]
134
- end
135
-
136
- it 'executes action assigned to key' do
137
- done = false
138
- mode = Mode.new
139
- mode.bind('a'){ done = true }
140
- mode.enter_keys 'a'
141
- done.should == true
142
- end
143
-
144
- it 'executes action assigned to key chain (immediately)' do
145
- done = false
146
- mode = Mode.new
147
- mode.bind('a', 'b', 'c'){ done = true }
148
- mode.enter_keys 'a', 'b', 'c'
149
- done.should == true
150
- end
151
-
152
- it 'executes action assigned to key chain (delayed)' do
153
- done = false
154
- mode = Mode.new
155
- mode.bind('a', 'b', 'c'){ done = true }
156
- mode.enter_key 'a'
157
- mode.enter_key 'b'
158
- mode.enter_key 'c'
159
- done.should == true
160
- end
161
-
162
- it 'executes action with numeric argument' do
163
- done = false
164
- mode = Mode.new
165
- mode.bind('a', 'b', 'c'){|arg| done = arg }
166
- mode.enter_keys '4', '2', 'a', 'b', 'c'
167
- done.should == 42
168
- end
169
-
170
- it 'executes action on callback' do
171
- done = false
172
- callback = Class.new{
173
- attr_accessor :done
174
-
175
- def foo
176
- @done = true
177
- end
178
- }.new
179
-
180
- mode = Mode.new(callback)
181
- mode.map :foo, %w[a b c]
182
- mode.enter_keys %w[a b c]
183
- callback.done.should == true
184
- end
185
-
186
- it 'inherits another mode but executes actions itself' do
187
- first_done = second_done = false
188
- first, second = Mode.new, Mode.new
189
- second.inherit(first)
190
- second.bind('a', 'b', 'c'){|arg| second_done = arg }
191
- second.enter_keys %w[4 2 a b c]
192
- second_done.should == 42
193
- end
194
-
195
- it 'inherits another mode that also executes actions' do
196
- first_done = second_done = false
197
- first, second = Mode.new, Mode.new
198
- second.inherit(first)
199
-
200
- first.bind('first-key'){|arg| first_done = arg }
201
- second.bind('second-key'){|arg| second_done = arg }
202
-
203
- second.enter_keys %w[4 2 first-key]
204
- first_done.should == 42
205
-
206
- second.enter_keys %w[2 4 second-key]
207
- second_done.should == 24
208
- end
209
- end
210
-
211
- describe Keymap = VER::Keymap do
212
- it 'adds a mode into the keymap' do
213
- done = false
214
-
215
- keymap = Keymap.new
216
- keymap.add_mode :test do |mode|
217
- mode.bind('a'){ done = true }
218
- end
219
- keymap.current_mode = :test
220
-
221
- keymap.enter_key 'a'
222
- done.should == true
223
- end
224
- end