Compare commits

..

197 Commits

Author SHA1 Message Date
bootstraponline 091945152f Release 2.4.5 2012-12-10 18:05:38 -07:00
bootstraponline 4838611273 Fix #602 2012-12-07 17:16:25 -07:00
bootstraponline 144f9959c9 Update test #602 2012-12-07 17:02:50 -07:00
bootstraponline 291c6a8fa0 Add test for #602 2012-12-07 16:49:00 -07:00
bootstraponline d5d3581b78 Update gollum.gemspec 2012-12-06 18:17:41 -07:00
bootstraponline 64d90b027c Merge pull request #597 from shanebdavis/master
altered CSS to more closely match github's markdown css
2012-12-03 16:49:37 -08:00
Shane Brinkman-Davis a0e9989734 altered CSS to more closely match github's markdown css.
Main chaings:
Padding between LIs = 0px
Fixed page-width: 920px
H1, H2, H3: Margin-top: 20px; margin-bottom: 10px
2012-12-01 15:48:28 -08:00
bootstraponline b81aa923d6 Fix KCODE warning on 1.9 2012-11-30 23:35:01 -07:00
bootstraponline 610925bc5a Update Ace
https://github.com/ajaxorg/ace/commit/f887e6411222ed49683c477ca571460b99f8e59f
2012-11-30 23:34:55 -07:00
bootstraponline 86eda9bb10 Release 2.4.4 2012-11-30 17:28:53 -07:00
bootstraponline ca06aa9a6f Merge pull request #595 from jtietema/patch-1
Update lib/gollum/frontend/public/gollum/livepreview/js/livepreview.js
2012-11-30 16:11:47 -08:00
Jeroen Tietema ca57d9e83d Update lib/gollum/frontend/public/gollum/livepreview/js/livepreview.js
Adjusted the height of the preview window so that it doesn't flow 
offscreen. (It was impossible to read the last lines...)
2012-11-30 22:20:36 +01:00
bootstraponline 904f975f0c Fix comment 2012-11-30 00:02:24 -07:00
bootstraponline 9b9212cf4c Remove needless conversion
The fix for page.rb resolved UTF-8 in headers.
2012-11-30 00:00:28 -07:00
bootstraponline 404419d1c3 Release 2.4.3 2012-11-29 23:57:15 -07:00
bootstraponline 4ee94a6574 Fix UTF-8 header and add test 2012-11-29 23:47:25 -07:00
bootstraponline f929df0419 Update check_h1 2012-11-29 23:04:40 -07:00
bootstraponline 57587dafbe Fix UTF-8 in headers 2012-11-29 22:05:29 -07:00
bootstraponline 31a95e81b3 Fix test name 2012-11-29 21:36:04 -07:00
bootstraponline 70a4e9551b Improve h1 test 2012-11-29 21:27:45 -07:00
bootstraponline e1a705f975 Fix UTF-8
to_html uses source document encoding by default. Set UTF-8.

Add note about KCODE warning.
2012-11-29 20:05:41 -07:00
bootstraponline 9057ec82d8 Release 2.4.2 2012-11-29 19:49:15 -07:00
bootstraponline 1b53e36666 Fix UTF-8 2012-11-29 16:58:47 -07:00
bootstraponline 10fa5c7bd2 Upgrade to stringex 1.5 2012-11-29 16:50:52 -07:00
bootstraponline 06e72a5a60 Release 2.4.1 2012-11-19 17:22:28 -07:00
bootstraponline 8fa62fc300 @css is set in before 2012-11-19 17:16:53 -07:00
bootstraponline 6c345fc508 Update dependencies 2012-11-19 17:14:52 -07:00
bootstraponline a34eac4ecb Merge pull request #592 from dekimsey/global-custom-css
Fixed custom.css to apply to all views
2012-11-19 16:11:53 -08:00
bootstraponline 10c121e603 Merge pull request #585 from dekimsey/gitcode-embed-any-file
Modified gitcode to allow syntax highlighting of arbitrary files
2012-11-19 16:11:21 -08:00
Daniel Kimsey 2b910167f4 Fixed custom.css to apply to all views 2012-11-19 13:21:39 -05:00
Daniel Kimsey 7d5311a075 Modified gitcode to allow syntax highlighting of arbitrary files 2012-11-19 12:59:45 -05:00
bootstraponline f5581c4b49 Merge pull request #589 from shanebdavis/master
Fix #96
2012-11-18 19:25:05 -08:00
Shane Brinkman-Davis e09f7cd49c Proposed fix for https://github.com/github/gollum/issues/96
(statically hosted content in the images/ folder returns 404s)
(the problem was all content in javascript, css, and images folders was hard-coded to return 404s)
2012-11-18 09:53:27 -08:00
bootstraponline 4dab03b61b Merge pull request #588 from sunnyone/fix_host_option
Pass the value of --host parameter to Rack::Server
2012-11-17 13:04:38 -08:00
Yoichi Imai 2b5e017aa1 Pass the value of --host parameter to Rack::Server 2012-11-17 19:42:28 +09:00
bootstraponline 8b3d944fd2 Fix #586
Place ASCIIDOC test behind ENV var
2012-11-16 19:08:45 -07:00
bootstraponline 2d886fd38a Fix tests #587 2012-11-16 18:13:38 -07:00
bootstraponline 80088832b9 Fix #587
The default behavior prevented linking to header anchors. id_prefix
can still be set to 'wiki-' however it is no longer the default.
2012-11-16 17:45:56 -07:00
bootstraponline be1883f317 Use HTTPS rubygems
Update gemspec
2012-11-16 17:07:38 -07:00
bootstraponline 30119e0c77 Fix tests 2012-11-16 17:03:18 -07:00
bootstraponline c90c3b1544 Support git code syntax in live preview
Add autocrlf values for Windows, Linux, and OS X.
2012-11-16 16:57:39 -07:00
bootstraponline 578386f083 Add dir support to write_page 2012-11-16 16:43:43 -07:00
bootstraponline 3d21ed362e Add history view test 2012-11-14 21:03:24 -07:00
bootstraponline 9cf469b035 Fix ruby bits #574 2012-11-14 00:45:28 -07:00
bootstraponline 462c93ae43 Fix crash #574 2012-11-13 23:12:22 -07:00
bootstraponline bda3b7b24d Fix --user-icons 2012-11-13 22:56:30 -07:00
bootstraponline d861a22cdd Fix line endings 2012-11-13 22:55:57 -07:00
bootstraponline 0de1a182da Validate user_icons 2012-11-13 22:48:37 -07:00
bootstraponline b030554348 Fix default 2012-11-13 22:43:05 -07:00
bootstraponline 858bfa9ccd Merge pull request #574 from dekimsey/local-gravatar-identicons
Extendable user-icons with optional identicon js library.
2012-11-13 21:42:15 -08:00
Daniel Kimsey ee8ec78da7 Add --user-icons option: none, gravatar, and identicon. 2012-11-13 21:17:23 -05:00
bootstraponline c8f684895c Merge pull request #581 from dekimsey/log-opt-author
Changed history date to use authored date instead.
2012-11-13 16:54:14 -08:00
bootstraponline 138a155ba4 Merge pull request #582 from dekimsey/set-focus-buttons
On window popup, focus the first text-field, if any.
2012-11-13 16:53:34 -08:00
Daniel Kimsey ad749bf345 On window popup, focus the first text-field, if any. 2012-11-13 17:25:36 -05:00
Daniel Kimsey ff0d59c16b Changed history date to use authored date instead. 2012-11-13 15:02:55 -05:00
bootstraponline df75d2d60c Release 2.4.0 2012-11-11 15:08:45 -07:00
bootstraponline 2713aabeaf Update gemspec 2012-11-11 15:08:21 -07:00
bootstraponline 796d1b44c2 Update README.md 2012-11-11 14:46:58 -07:00
bootstraponline 470a7b8f52 Fix #579 2012-11-11 14:40:47 -07:00
bootstraponline f699b82a9f Fix #539 2012-11-11 14:18:14 -07:00
bootstraponline 44edb8c7da Merge pull request #576 from roman-zaharenkov/title_control
Page title control
2012-11-11 12:29:37 -08:00
bootstraponline bc4fc0edd9 Fix gitcode test 2012-11-11 13:14:25 -07:00
Roman Zaharenkov 6545fa691b Adjust page header / title generation.
Now page header can be generated by first h1 header from page content. But page title generated by URL is it was before.
2012-11-11 13:22:10 +03:00
Roman Zaharenkov 4954553927 Page title control
Allow to set page title by setting header inside page body. It will use header as title If header is present and page URL otherwise.
2012-11-11 13:20:14 +03:00
bootstraponline 9c50ba9eeb XSLT was never used 2012-11-10 17:02:27 -07:00
bootstraponline 9a67da145a Merge pull request #578 from github/fileview-hover-fix
Fileview hover fix
2012-11-10 15:59:28 -08:00
bootstraponline ca7d82278c Pretty print with nokogiri 2012-11-10 16:34:37 -07:00
bootstraponline f6245c53dd Add .gitattributes 2012-11-10 12:15:20 -07:00
bootstraponline 6888420cc6 Update file_view output 2012-11-10 12:15:19 -07:00
Daniel Kimsey c5631f5b7d Fixed a:hover not highlighting the a block correctly 2012-11-10 12:15:19 -07:00
Daniel Kimsey 34e0b49d72 Refactored the template generator to use new_page method 2012-11-10 12:15:19 -07:00
Daniel Kimsey bd072264ef Line-ending fix for _styles.css 2012-11-10 12:15:19 -07:00
bootstraponline cfb2d24c71 Merge pull request #577 from dekimsey/fix-page-metadata
Renamed page.meta_data => page.metadata
2012-11-09 18:03:12 -08:00
Daniel Kimsey fe0eb72fa3 Renamed page.meta_data to page.metadata for consistency with views 2012-11-09 18:29:49 -05:00
Daniel Kimsey 2783257f06 Added page.meta_data to tests 2012-11-09 18:25:33 -05:00
bootstraponline cc11cb866c Add css note
#572
2012-11-08 18:51:57 -07:00
bootstraponline 6a02643bda Merge pull request #573 from dekimsey/license-guidelines
Added bootstraponline's comment about licensing guidelines
2012-11-08 16:12:40 -08:00
Daniel Kimsey 7f269c8da3 Added bootstraponline's comment about licensing guidelines 2012-11-08 16:46:49 -05:00
bootstraponline ef7f7cebd1 Release 2.3.12 2012-11-07 20:37:50 -07:00
bootstraponline 05c24fd5e3 Fix #570
Fix #571
2012-11-07 20:35:57 -07:00
bootstraponline b08b97bd28 Release 2.3.11 2012-11-07 20:18:43 -07:00
bootstraponline dbb6ce2f71 Fix #570
Error in gollum.js broke new page button.
2012-11-07 20:17:50 -07:00
bootstraponline f66f14b593 Release 2.3.10 2012-11-07 19:47:09 -07:00
bootstraponline 8a52315dee Add base url to custom css 2012-11-07 19:46:27 -07:00
bootstraponline 7c4052906c Add custom css 2012-11-07 19:40:52 -07:00
bootstraponline 3a56f39f6a Fix readme 2012-11-07 19:17:49 -07:00
bootstraponline 6585ca5dd0 Fix space 2012-11-07 19:13:57 -07:00
bootstraponline 792abae07e Release 2.3.9 2012-11-07 19:11:04 -07:00
bootstraponline 74ce648c59 Options.fetch 2012-11-07 19:04:36 -07:00
bootstraponline 2686e96046 Release 2.3.8 2012-11-07 18:50:37 -07:00
bootstraponline 213e2bb432 Add config example 2012-11-07 18:48:07 -07:00
bootstraponline 79bb5c10ab Remove lib.so note 2012-11-07 18:46:36 -07:00
bootstraponline 7ea012d786 Fix code style 2012-11-07 18:45:20 -07:00
bootstraponline 43591f75de Merge pull request #570 from dekimsey/only-alert-on-changes
Only alert on changes
2012-11-07 17:39:30 -08:00
Daniel Kimsey 05d82c0569 Attach unsaved changes warning to trigger only after changes are made 2012-11-07 17:51:36 -05:00
Daniel Kimsey 76c8d3206c Consolidated create and edit page's javascript into the global gollum.js 2012-11-07 17:50:12 -05:00
bootstraponline 00751d05b4 Release 2.3.7 2012-11-06 18:27:05 -07:00
bootstraponline b5be5df11a Fix test name 2012-11-06 18:26:49 -07:00
bootstraponline 7d159273fc Merge pull request #569 from dekimsey/issue-568
Fixed #568, triple tilde without language causes Gollum to crash
2012-11-06 17:11:08 -08:00
Daniel Kimsey 70127922ab Added test for #568 2012-11-06 15:49:47 -05:00
Daniel Kimsey b95df93775 Fixes #568, triple-tilde without language causes crash 2012-11-06 15:39:39 -05:00
bootstraponline dc06edcf5b Add x.y.z 2012-11-05 17:30:01 -07:00
bootstraponline fdc437dcd5 Release 2.3.6 2012-11-05 17:28:51 -07:00
bootstraponline f6873c9612 Merge pull request #566 from dekimsey/deterministic-search
Gollum search results now displayed in a deterministic order
2012-11-05 16:17:40 -08:00
Daniel Kimsey 93754ab32d Sort by filename in addition to count 2012-11-05 18:01:50 -05:00
Daniel Kimsey 5759334635 Gollum search results are displayed in a deterministic order 2012-11-05 17:02:19 -05:00
bootstraponline f2f543b72d Release 2.3.5 2012-10-31 20:14:15 -06:00
bootstraponline 598b052be3 Fix clean
Duplicate slashes must be removed everywhere.
2012-10-31 20:11:23 -06:00
bootstraponline a746062422 Merge pull request #564 from nikitug/patch-1
Update README to new Sequence diagram markup style
2012-10-31 19:09:45 -07:00
Nikita Afanasenko c8868d369f Update README to new Sequence diagram markup style 2012-10-31 18:02:28 +04:00
bootstraponline 52c6e7474c Release 2.3.4 2012-10-28 20:59:06 -06:00
bootstraponline be81f09b0e Update gemspec 2012-10-28 12:43:51 -06:00
bootstraponline 6fa4504e31 Fix #551 2012-10-28 12:37:02 -06:00
bootstraponline 992ba01a12 Fix page file dir 2012-10-28 11:57:25 -06:00
bootstraponline 72c5a74cf1 Update test
The test passes when verified manually using bin/gollum. Without a running server the test
will fail so it has been commented out. If there's an easy way to mock Rack::Server
then the test can be restored.
2012-10-27 23:44:11 -06:00
bootstraponline 919f41a0f1 Fix #559 2012-10-27 23:44:11 -06:00
bootstraponline 785921cb0f Fix toc generation 2012-10-27 21:46:30 -06:00
bootstraponline 8c8cda5e7d Fix comment 2012-10-27 21:05:56 -06:00
bootstraponline 64ef74e7e9 Add preview button to live preview 2012-10-27 20:52:54 -06:00
bootstraponline 776df4e6ee Fix nokogiri rendering
https://github.com/sparklemotion/nokogiri/issues/782
2012-10-27 19:52:26 -06:00
bootstraponline 68465a8651 Set indent and encoding 2012-10-27 18:12:32 -06:00
bootstraponline fa16c8960c Fix #560 2012-10-27 17:58:14 -06:00
bootstraponline 2c57915781 Refactor fileview 2012-10-23 23:27:31 -06:00
bootstraponline d0527f1aeb Release 2.3.3 2012-10-23 22:58:41 -06:00
bootstraponline 75083c5b56 Fix collapse tree 2012-10-23 22:36:17 -06:00
bootstraponline 82526594db Add attr reader for collapse tree 2012-10-23 22:22:56 -06:00
bootstraponline 941d39800c Merge pull request #556 from adiknoth/fileview
Documentation and usability enhancement of recent fileview fix
2012-10-23 21:20:28 -07:00
bootstraponline a1ae2e8bc0 Fix #554 2012-10-23 22:14:45 -06:00
bootstraponline 4af6f366ca Fix show_all /pages 2012-10-23 22:09:27 -06:00
Adrian Knoth c7a9534ed9 Add --collapse-tree command line option 2012-10-23 14:27:15 +02:00
Adrian Knoth 00bcbbf72b File View: Add option to collapse file trees.
For potentially large repositories, starting with a collapsed tree may
be beneficial.
2012-10-23 14:27:12 +02:00
Adrian Knoth ed2254ff9f Add missing documentation for --show-all 2012-10-23 14:22:54 +02:00
bootstraponline b6633f0ecb Release 2.3.2 2012-10-22 19:21:10 -06:00
bootstraponline e08d2d3052 Enable show_all for /pages 2012-10-22 19:10:40 -06:00
bootstraponline fbc0548b43 Add --show-all
--show-all will show all files in file view (not just valid pages). Default is false.
2012-10-22 19:03:21 -06:00
bootstraponline a9807bd1e1 Update math note 2012-10-21 17:22:31 -06:00
bootstraponline 554b80b39d Add MathJax examples 2012-10-21 17:21:24 -06:00
bootstraponline 99e74bf00b Release 2.3.1 2012-10-21 17:16:40 -06:00
bootstraponline f48e923f28 Fix release 2012-10-21 17:15:09 -06:00
bootstraponline 5400b4bfdd Support inline and display math.
$$2^2$$

$2^2$

\\(2^2\\)

[2^2]
2012-10-21 17:15:09 -06:00
bootstraponline f68bebe0f6 Update math note 2012-10-21 16:26:35 -06:00
bootstraponline 4c6019b439 Update math note 2012-10-21 16:23:58 -06:00
bootstraponline 66e08a6b17 Release 2.3.0 2012-10-21 16:19:05 -06:00
bootstraponline 7898db70ed Auto load all MathJax extensions
Fix #549
2012-10-21 16:14:04 -06:00
bootstraponline 7c357116ff Remove TeX
As discussed with @vmg
MathJax is available via a flag for those self hosting gollum
2012-10-18 23:36:05 -06:00
bootstraponline 69ce0eb0d0 Update rake 2012-10-17 21:04:20 -06:00
bootstraponline 4db31a297b Update rake
Jekyll uses rake ~> 0.9
2012-10-17 21:03:29 -06:00
bootstraponline e1fca457e4 Restore gemnasium
Gemnasium fixed the missing pygments.rb issue.

https://github.com/laserlemon/gemnasium-parser/commit/c9b3e43c3021967d5c1bb115e7dd1555e01c6444
2012-10-17 20:54:01 -06:00
bootstraponline 7f8485ce80 Improve system requirements language 2012-10-16 22:31:25 -06:00
bootstraponline 290061fd11 Add system requirements to readme 2012-10-16 22:15:26 -06:00
bootstraponline a507836936 Update dependencies 2012-10-16 21:39:22 -06:00
bootstraponline 6524d20a96 Use pygments.rb 0.3.2 2012-10-16 21:36:37 -06:00
bootstraponline f1c523aa30 Release 2.2.9 2012-10-14 22:26:17 -06:00
bootstraponline 87c08f5613 Escape " in headers 2012-10-14 22:21:00 -06:00
bootstraponline 82913cea20 Improve base path note 2012-10-14 21:42:25 -06:00
bootstraponline 2ad743e4bd Release 2.2.8 2012-10-14 21:28:43 -06:00
bootstraponline fa97b57a96 Define default map as suggested on #460
Base path now sets a default map without having to use an external config.ru.
2012-10-14 20:57:27 -06:00
bootstraponline 1b952b6d56 Release 2.2.7 2012-10-14 17:24:33 -06:00
bootstraponline 90cc512bd1 Fix home loop with page-file-dir #491 2012-10-14 15:45:26 -06:00
bootstraponline b82556c9c0 Fix #460 2012-10-14 15:42:06 -06:00
bootstraponline fbe3b4bb3b Fix #460 2012-10-14 15:23:52 -06:00
bootstraponline 5ffd98ad31 Fix #491 2012-10-14 15:15:55 -06:00
bootstraponline cb9dd4d228 Fix formatting 2012-10-14 14:31:40 -06:00
bootstraponline cd823bf10c Add doc from wiki.rb 2012-10-14 14:31:00 -06:00
bootstraponline 5560ec52c2 Add base_path doc 2012-10-14 14:27:08 -06:00
bootstraponline 065151a77f Add base_path disclaimer 2012-10-14 14:25:27 -06:00
bootstraponline 23454f556c Release 2.2.6 2012-10-14 13:14:08 -06:00
bootstraponline a2b3ddf931 Update tests to XHTML 2012-10-14 13:07:18 -06:00
bootstraponline 44b0d2fcfc Remove old comment 2012-10-14 12:26:23 -06:00
bootstraponline aed4cc590a Fix unicode characters
Fix #547

Update test
2012-10-14 12:21:31 -06:00
bootstraponline 72ee08b5ab Release 2.2.5 2012-10-14 11:21:56 -06:00
bootstraponline 45547624e4 Improve tilde fence support
More than 3 tildes can be used. The code block must end with the same amount of tildes used to open the code block.

Fix #537

http://johnmacfarlane.net/pandoc/README.html#delimited-code-blocks
2012-10-14 11:02:45 -06:00
bootstraponline f928cfa8be Don't ship Lorem ipsum in gem 2012-10-13 20:21:08 -06:00
bootstraponline 988984846a Release 2.2.4 2012-10-13 20:01:57 -06:00
bootstraponline 1149618653 Fix #537 2012-10-13 19:53:41 -06:00
bootstraponline 168a033903 Remove old comment 2012-10-13 14:59:42 -06:00
bootstraponline 6a765c9791 Fix #537 2012-10-13 14:52:28 -06:00
bootstraponline e16ae7b511 Travis is having a bad day
E: There are problems and -y was used without --force-yes
before_install: 'sudo apt-get install -y asciidoc' returned false.
Done. Build script exited with: 1
2012-10-13 14:07:15 -06:00
bootstraponline 174334ea44 Remove comment 2012-10-13 13:58:56 -06:00
bootstraponline dbdf06930d Fix 2012-10-13 13:55:20 -06:00
bootstraponline c93e65ddc3 Merge branch 'master' of github.com:github/gollum 2012-10-13 13:32:19 -06:00
bootstraponline 56101ed264 Fix #535 and add test 2012-10-13 13:32:08 -06:00
bootstraponline 8269c8e574 TOC doesn't require ' 2012-10-13 13:11:31 -06:00
bootstraponline 2246419d1e Fix spacing 2012-10-13 13:09:20 -06:00
bootstraponline 118a0c318b Update comment 2012-10-13 13:06:15 -06:00
bootstraponline 5401cf2910 Fix #542 2012-10-13 13:04:51 -06:00
bootstraponline 432f9b8d2f Add test for #542 2012-10-13 12:57:58 -06:00
bootstraponline 66fc8a2d31 Revert "Fix #542"
This reverts commit 2f3dd3d227.
2012-10-13 12:55:43 -06:00
bootstraponline 2f3dd3d227 Fix #542
Page link may contain duplicate starting forward slashes.
//page points to http://page/ when what we want is
/page pointing to http://localhost:1234/page
2012-10-13 09:53:25 -06:00
bootstraponline c43fd9fa6c Update language comment 2012-10-12 21:19:24 -06:00
bootstraponline 868518e0f5 Bash is Ace mode sh 2012-10-12 20:58:05 -06:00
bootstraponline 039b5cce98 Try to fix Travis
FFI is no longer used in the new pygments.rb.
apt-get update may resolve the asciidoc install failure.
2012-10-12 20:24:31 -06:00
bootstraponline 4a421842d5 https://github.com/travis-ci/travis-ci/issues/725
Modified README to trigger a Travis CI build. It's currently broken.
2012-10-12 20:22:10 -06:00
bootstraponline cfbb124f81 Update README.md 2012-10-12 20:16:43 -06:00
bootstraponline dcb147cde2 Ensure declaredLanguage is lower case 2012-10-10 20:20:33 -06:00
bootstraponline 8d06b5e67e Fix pygments language to Ace mode translation 2012-10-10 20:16:04 -06:00
bootstraponline 4776d0b422 Use rake release in readme 2012-10-10 19:45:42 -06:00
457 changed files with 74373 additions and 93832 deletions
+32
View File
@@ -0,0 +1,32 @@
# https://help.github.com/articles/dealing-with-line-endings
#
# For Mac & Linux
# git config --global core.autocrlf input
#
# For windows
# git config --global core.autocrlf true
#
# Set default behaviour, in case users don't have core.autocrlf set.
* text=auto
# Explicitly declare text files we want to always be normalized and converted
# to native line endings on checkout.
*.txt text
*.md text
*.rb text
*.js text
*.html text
*.yml text
*.mustache text
*.css text
Rakefile text
Gemfile text
LICENSE text
COPYRIGHT text
gollum text
.gitattributes text
.gitignore text
# Denote all files that are truly binary and should not be modified.
*.png binary
*.jpg binary
+3 -2
View File
@@ -4,5 +4,6 @@ rvm:
notifications: notifications:
disabled: true disabled: true
before_install: before_install:
- gem uninstall ffi -a - sudo apt-get update
- sudo apt-get install -y asciidoc - sudo apt-get install -y --force-yes asciidoc
- ASCIIDOC=1; export ASCIIDOC
+2 -2
View File
@@ -1,4 +1,4 @@
source "http://rubygems.org" source 'https://rubygems.org'
gemspec gemspec
gem "rake", "~> 0.9.2.2" gem 'rake', '~> 10.0.2'
+49 -27
View File
@@ -2,6 +2,7 @@ gollum -- A wiki built on top of Git
==================================== ====================================
[![Build Status](https://secure.travis-ci.org/github/gollum.png?branch=master)](http://travis-ci.org/github/gollum) [![Build Status](https://secure.travis-ci.org/github/gollum.png?branch=master)](http://travis-ci.org/github/gollum)
[![Dependency Status](https://gemnasium.com/github/gollum.png)](https://gemnasium.com/github/gollum)
## DESCRIPTION ## DESCRIPTION
@@ -18,6 +19,11 @@ number of ways depending on your needs. You can edit your wiki locally:
Gollum follows the rules of [Semantic Versioning](http://semver.org/) and uses Gollum follows the rules of [Semantic Versioning](http://semver.org/) and uses
[TomDoc](http://tomdoc.org/) for inline documentation. [TomDoc](http://tomdoc.org/) for inline documentation.
## SYSTEM REQUIREMENTS
- Python 2.5+ (2.7.3 recommended)
- Ruby 1.8.7+ (1.9.3 recommended)
- Unix like operating system (OS X, Ubuntu, Debian, and more)
- Will not work on Windows (because of [grit](https://github.com/github/grit))
## INSTALLATION ## INSTALLATION
@@ -130,7 +136,13 @@ or JavaScript. These tags will be stripped from the converted HTML. See
`docs/sanitization.md` for more details on what tags and attributes are `docs/sanitization.md` for more details on what tags and attributes are
allowed. allowed.
## TITLES
The first defined `h1` will override the default header on a page. There are two ways to set a page title. The metadata syntax:
`<!-- --- title: New Title -->`
The first `h1` tag can be set to always override the page title, without needing to use the metadata syntax. Start gollum with the `--h1-title` flag.
## BRACKET TAGS ## BRACKET TAGS
A variety of Gollum tags use a double bracket syntax. For example: A variety of Gollum tags use a double bracket syntax. For example:
@@ -295,7 +307,7 @@ This is useful for writing about the link syntax in your wiki pages.
Gollum has a special tag to insert a table of contents (new in v2.1) Gollum has a special tag to insert a table of contents (new in v2.1)
'[[_TOC_]] [[_TOC_]]
This tag is case sensitive, use all upper case. The TOC tag can be inserted This tag is case sensitive, use all upper case. The TOC tag can be inserted
into the `_Header`, `_Footer` or `_Sidebar` files too. into the `_Header`, `_Footer` or `_Sidebar` files too.
@@ -357,25 +369,17 @@ appropriately.
## MATHEMATICAL EQUATIONS ## MATHEMATICAL EQUATIONS
Start gollum with the `--mathjax` flag. Read more about [MathJax](http://docs.mathjax.org/en/latest/index.html) on the web. Gollum uses the `TeX-AMS-MML_HTMLorMML` config with the `autoload-all` extension.
Page files may contain mathematic equations in TeX syntax that will be nicely Inline math:
typeset into the expected output. A block-style equation is delimited by `\[`
and `\]`. For example:
\[ P(E) = {n \choose k} p^k (1-p)^{ n-k} \] - $2^2$
- `\\(2^2\\)`
Inline equations are delimited by `\(` and `\)`. These equations will appear Display math:
inline with regular text. For example:
The Pythagorean theorem is \( a^2 + b^2 = c^2 \). - $$2^2$$
- [2^2]
### INSTALLATION REQUIREMENTS
In order to get the mathematical equations rendering to work, you need the following binaries:
* LaTex, TeTex or MacTex/BasicTeX (pdflatex)
* Netpbm (pnmcrop, pnmpad, pnmscale, ppmtopgm, pnmgamma, pnmtopng)
* Ghostscript (gs)
## SEQUENCE DIAGRAMS ## SEQUENCE DIAGRAMS
@@ -383,10 +387,10 @@ You may imbed sequence diagrams into your wiki page (rendered by
[WebSequenceDiagrams](http://www.websequencediagrams.com) by using the [WebSequenceDiagrams](http://www.websequencediagrams.com) by using the
following syntax: following syntax:
{{{ blue-modern {{{{{{ blue-modern
alice->bob: Test alice->bob: Test
bob->alice: Test response bob->alice: Test response
}}} }}}}}}
You can replace the string "blue-modern" with any supported style. You can replace the string "blue-modern" with any supported style.
@@ -413,6 +417,17 @@ By default, internal wiki links are all absolute from the root. To specify a dif
wiki = Gollum::Wiki.new("my-gollum-repo.git", :base_path => "/wiki") wiki = Gollum::Wiki.new("my-gollum-repo.git", :base_path => "/wiki")
Note that base_path just modifies the links. To map gollum to a non-root location:
- Use the gollum binary: `gollum path/to/wiki --base-path mywiki`
- Define config.ru with `map`. See [#532](https://github.com/github/gollum/issues/532) for an example.
> :base_path - String base path for all Wiki links.
>
> The String base path to prefix to internal links. For example, when set
> to "/wiki", the page "Hobbit" will be linked as "/wiki/Hobbit". Defaults
> to "/".
Get the latest version of the given human or canonical page name: Get the latest version of the given human or canonical page name:
page = wiki.page('page-name') page = wiki.page('page-name')
@@ -523,9 +538,17 @@ Your Rack middleware can pass author details to Gollum in a Hash in the session
## WINDOWS FILENAME VALIDATION ## WINDOWS FILENAME VALIDATION
Note that filenames on windows must not contain any of the following characters `\ / : * ? " < > |`. See [this support article](http://support.microsoft.com/kb/177506) for details. Note that filenames on windows must not contain any of the following characters `\ / : * ? " < > |`. See [this support article](http://support.microsoft.com/kb/177506) for details.
## LIB.SO ERROR ## CONFIG FILE
`Could not open library 'lib.so'` may be solved by installing `python-devel` on Fedora or `python-dev` on Ubuntu. Gentoo requires a rubypython [patch](https://gist.github.com/2802480) to use python2.7. Gollum optionally takes a `--config file`. See [config.rb](https://github.com/github/gollum/blob/master/config.rb) for an example.
## CUSTOM CSS
The `--css` flag will inject `custom.css` from the root of your git repository into each page. `custom.css` must be commited to git or you will get a 302 redirect to the create page. Here's an example of floating the sidebar to the left.
```css
#wiki-rightbar { float: left !important; }
```
## CONTRIBUTE ## CONTRIBUTE
@@ -547,17 +570,16 @@ your changes merged back into core is as follows:
1. Send a pull request to the github/gollum project. 1. Send a pull request to the github/gollum project.
## RELEASING ## RELEASING
For x.y releases: x.y.z
Update VERSION in lib/gollum.rb
$ rake gemspec
For z releases: For z releases:
$ rake bump $ rake bump
$ rake release
$ git tag vX.Y.Z For x.y releases:
$ git push origin vX.Y.Z Update VERSION in lib/gollum.rb
$ gem build gollum.gemspec $ rake gemspec
$ gem push gollum-X.Y.Z.gem $ rake release
## BUILDING THE GEM FROM MASTER ## BUILDING THE GEM FROM MASTER
$ gem uninstall -aIx gollum $ gem uninstall -aIx gollum
+2 -1
View File
@@ -114,6 +114,7 @@ task :release => :build do
exit! exit!
end end
sh "git commit --allow-empty -a -m 'Release #{version}'" sh "git commit --allow-empty -a -m 'Release #{version}'"
sh "git pull"
sh "git tag v#{version}" sh "git tag v#{version}"
sh "git push origin master" sh "git push origin master"
sh "git push origin v#{version}" sh "git push origin v#{version}"
@@ -145,7 +146,7 @@ task :gemspec => :validate do
split("\n"). split("\n").
sort. sort.
reject { |file| file =~ /^\./ }. reject { |file| file =~ /^\./ }.
reject { |file| file =~ /^(rdoc|pkg|test)/ }. reject { |file| file =~ /^(rdoc|pkg|test|Home\.md|\.gitattributes)/ }.
map { |file| " #{file}" }. map { |file| " #{file}" }.
join("\n") join("\n")
+45
View File
@@ -45,6 +45,10 @@ opts = OptionParser.new do |opts|
options['irb'] = true options['irb'] = true
end end
opts.on("--css", "Inject custom css. Uses custom.css from root repository") do
wiki_options[:css] = true
end
opts.on("--page-file-dir [PATH]", "Specify the sub directory for all page files (default: repository root).") do |path| opts.on("--page-file-dir [PATH]", "Specify the sub directory for all page files (default: repository root).") do |path|
wiki_options[:page_file_dir] = path wiki_options[:page_file_dir] = path
end end
@@ -68,6 +72,21 @@ opts = OptionParser.new do |opts|
opts.on("--mathjax", "Enables mathjax.") do opts.on("--mathjax", "Enables mathjax.") do
wiki_options[:mathjax] = true wiki_options[:mathjax] = true
end end
opts.on("--user-icons [SOURCE]", "Set the history user icons. Valid values: gravatar, identicon, none. Default: none.") do |source|
wiki_options[:user_icons] = source
end
opts.on("--show-all", "Shows all files in file view. By default only valid pages are shown.") do
wiki_options[:show_all] = true
end
opts.on("--collapse-tree", "Collapse file view tree. By default, expanded tree is shown.") do
wiki_options[:collapse_tree] = true
end
opts.on("--h1-title", "Sets page title to value of first h1") do
wiki_options[:h1_title] = true
end
end end
# Read command line options into `options` hash # Read command line options into `options` hash
@@ -141,5 +160,31 @@ else
require cfg require cfg
end end
base_path = wiki_options[:base_path]
if wiki_options[:base_path].nil?
Precious::App.run!(options) Precious::App.run!(options)
else
require 'rack'
class MapGollum
def initialize base_path
@mg = Rack::Builder.new do
map '/' do
run Proc.new { [ 302, {'Location'=> "/#{base_path}" }, [] ] }
end
map "/#{base_path}" do
run Precious::App
end
end
end
def call(env)
@mg.call(env)
end
end
# Rack::Handler does not work with Ctrl + C. Use Rack::Server instead.
Rack::Server.new(:app => MapGollum.new(base_path), :Port => options['port'], :Host => options['bind']).start
end
end end
+28
View File
@@ -0,0 +1,28 @@
# Example gollum config
# gollum ../wiki --config config.rb
#
# or run from source with
#
# bundle exec bin/gollum ../wiki/ --config config.rb
# Remove const to avoid
# warning: already initialized constant FORMAT_NAMES
#
# only remove if it's defined.
# constant Gollum::Page::FORMAT_NAMES not defined (NameError)
Gollum::Page.send :remove_const, :FORMAT_NAMES if defined? Gollum::Page::FORMAT_NAMES
# limit to one format
Gollum::Page::FORMAT_NAMES = { :markdown => "Markdown" }
=begin
Valid formats are:
{ :markdown => "Markdown",
:textile => "Textile",
:rdoc => "RDoc",
:org => "Org-mode",
:creole => "Creole",
:rest => "reStructuredText",
:asciidoc => "AsciiDoc",
:mediawiki => "MediaWiki",
:pod => "Pod" }
=end
+116 -28
View File
@@ -5,8 +5,8 @@ Gem::Specification.new do |s|
s.required_ruby_version = ">= 1.8.7" s.required_ruby_version = ">= 1.8.7"
s.name = 'gollum' s.name = 'gollum'
s.version = '2.2.3' s.version = '2.4.5'
s.date = '2012-10-10' s.date = '2012-12-10'
s.rubyforge_project = 'gollum' s.rubyforge_project = 'gollum'
s.summary = "A simple, Git-powered wiki." s.summary = "A simple, Git-powered wiki."
@@ -25,33 +25,35 @@ Gem::Specification.new do |s|
s.add_dependency('grit', '~> 2.5.0') s.add_dependency('grit', '~> 2.5.0')
s.add_dependency('github-markup', ['>= 0.7.4', '< 1.0.0']) s.add_dependency('github-markup', ['>= 0.7.4', '< 1.0.0'])
s.add_dependency('github-markdown', '~> 0.5.1') s.add_dependency('github-markdown', '~> 0.5.3')
s.add_dependency('pygments.rb', '~> 0.3.1') s.add_dependency('pygments.rb', '~> 0.3.2')
s.add_dependency('escape_utils', '0.2.4')
s.add_dependency('sinatra', '~> 1.3.3') s.add_dependency('sinatra', '~> 1.3.3')
s.add_dependency('mustache', ['>= 0.99.4', '< 1.0.0']) s.add_dependency('mustache', ['>= 0.99.4', '< 1.0.0'])
s.add_dependency('sanitize', '~> 2.0.3') s.add_dependency('sanitize', '~> 2.0.3')
s.add_dependency('nokogiri', '~> 1.5.5') s.add_dependency('nokogiri', '~> 1.5.5')
s.add_dependency('useragent', '~> 0.4.10') s.add_dependency('useragent', '~> 0.4.15')
s.add_dependency('stringex', '~> 1.4.0') s.add_dependency('stringex', '~> 1.5.1')
s.add_development_dependency('RedCloth', '~> 4.2.9') s.add_development_dependency('RedCloth', '~> 4.2.9')
s.add_development_dependency('mocha', '~> 0.12.6') s.add_development_dependency('mocha', '~> 0.13.0')
s.add_development_dependency('org-ruby', '~> 0.7.1') s.add_development_dependency('org-ruby', '~> 0.7.2')
s.add_development_dependency('shoulda', '~> 3.1.1') s.add_development_dependency('shoulda', '~> 3.3.2')
s.add_development_dependency('rack-test', '~> 0.6.2') s.add_development_dependency('rack-test', '~> 0.6.2')
s.add_development_dependency('wikicloth', '~> 0.8.0') s.add_development_dependency('wikicloth', '~> 0.8.0')
s.add_development_dependency('rake', '~> 0.9.2.2') s.add_development_dependency('rake', '~> 10.0.2')
s.add_development_dependency('pry', '~> 0.9.10')
# required by pry
s.add_development_dependency('rb-readline', '~> 0.4.2')
# = MANIFEST = # = MANIFEST =
s.files = %w[ s.files = %w[
Gemfile Gemfile
HISTORY.md HISTORY.md
Home.md
LICENSE LICENSE
README.md README.md
Rakefile Rakefile
bin/gollum bin/gollum
config.rb
docs/sanitization.md docs/sanitization.md
gollum.gemspec gollum.gemspec
lib/gollum.rb lib/gollum.rb
@@ -73,6 +75,7 @@ Gem::Specification.new do |s|
lib/gollum/frontend/public/gollum/images/fileview/toggle-small-expand.png lib/gollum/frontend/public/gollum/images/fileview/toggle-small-expand.png
lib/gollum/frontend/public/gollum/images/fileview/toggle-small.png lib/gollum/frontend/public/gollum/images/fileview/toggle-small.png
lib/gollum/frontend/public/gollum/images/icon-sprite.png lib/gollum/frontend/public/gollum/images/icon-sprite.png
lib/gollum/frontend/public/gollum/images/man_24.png
lib/gollum/frontend/public/gollum/images/para.png lib/gollum/frontend/public/gollum/images/para.png
lib/gollum/frontend/public/gollum/images/pin-16.png lib/gollum/frontend/public/gollum/images/pin-16.png
lib/gollum/frontend/public/gollum/images/pin-20.png lib/gollum/frontend/public/gollum/images/pin-20.png
@@ -89,11 +92,13 @@ Gem::Specification.new do |s|
lib/gollum/frontend/public/gollum/javascript/gollum.dialog.js lib/gollum/frontend/public/gollum/javascript/gollum.dialog.js
lib/gollum/frontend/public/gollum/javascript/gollum.js lib/gollum/frontend/public/gollum/javascript/gollum.js
lib/gollum/frontend/public/gollum/javascript/gollum.placeholder.js lib/gollum/frontend/public/gollum/javascript/gollum.placeholder.js
lib/gollum/frontend/public/gollum/javascript/identicon_canvas.js
lib/gollum/frontend/public/gollum/javascript/jquery-1.7.2.min.js lib/gollum/frontend/public/gollum/javascript/jquery-1.7.2.min.js
lib/gollum/frontend/public/gollum/javascript/jquery.color.js lib/gollum/frontend/public/gollum/javascript/jquery.color.js
lib/gollum/frontend/public/gollum/javascript/mousetrap.min.js lib/gollum/frontend/public/gollum/javascript/mousetrap.min.js
lib/gollum/frontend/public/gollum/livepreview/css/custom.css lib/gollum/frontend/public/gollum/livepreview/css/custom.css
lib/gollum/frontend/public/gollum/livepreview/images/cancel_24.png lib/gollum/frontend/public/gollum/livepreview/images/cancel_24.png
lib/gollum/frontend/public/gollum/livepreview/images/globe_24.png
lib/gollum/frontend/public/gollum/livepreview/images/lr_24.png lib/gollum/frontend/public/gollum/livepreview/images/lr_24.png
lib/gollum/frontend/public/gollum/livepreview/images/save_24.png lib/gollum/frontend/public/gollum/livepreview/images/save_24.png
lib/gollum/frontend/public/gollum/livepreview/images/savecomment_24.png lib/gollum/frontend/public/gollum/livepreview/images/savecomment_24.png
@@ -108,6 +113,7 @@ Gem::Specification.new do |s|
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/default_commands.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/default_commands.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/multi_select_commands.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/commands/multi_select_commands.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/config.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/config.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/config_test.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/css/codefolding-fold-button-states.png lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/css/codefolding-fold-button-states.png
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/css/editor.css lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/css/editor.css
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/css/expand-marker.png lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/css/expand-marker.png
@@ -158,6 +164,55 @@ Gem::Specification.new do |s|
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/oop.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/oop.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/regexp.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/regexp.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/useragent.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/lib/useragent.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/package.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/test_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/text_javascript.txt
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_c9search.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_c_cpp.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_clojure.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_coffee.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_coldfusion.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_csharp.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_css.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_diff.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_glsl.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_golang.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_groovy.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_haxe.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_html.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_java.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_javascript.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_json.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_jsx.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_latex.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_less.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_liquid.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_lua.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_luapage.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_markdown.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_ocaml.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_perl.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_pgsql.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_php.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_powershell.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_python.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_ruby.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_scad.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_scala.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_scss.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_sh.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_sql.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_svg.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_tcl.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_text.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_textile.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_xml.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_xquery.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/_test/tokens_yaml.json
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/abap.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/abap_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/asciidoc.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/asciidoc_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/cstyle.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/cstyle.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/html.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/behaviour/html.js
@@ -193,9 +248,12 @@ Gem::Specification.new do |s|
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_test.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_test.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_worker.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_worker.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_worker_test.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/css_worker_test.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/dart.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/dart_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/diff.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/diff.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/diff_highlight_rules.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/diff_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/doc_comment_highlight_rules.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/doc_comment_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/asciidoc.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/c9search.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/c9search.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/coffee.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/coffee.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/coffee_test.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/coffee_test.js
@@ -205,24 +263,34 @@ Gem::Specification.new do |s|
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/fold_mode.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/fold_mode.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/html.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/html.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/html_test.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/html_test.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/latex.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/lua.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/markdown.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/mixed.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/mixed.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/pythonic.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/pythonic.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/pythonic_test.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/pythonic_test.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/xml.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/xml.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/xml_test.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/folding/xml_test.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/glsl.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/glsl_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/golang.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/golang.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/golang_highlight_rules.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/golang_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/groovy.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/groovy.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/groovy_highlight_rules.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/groovy_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/haml.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/haml_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/haxe.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/haxe.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/haxe_highlight_rules.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/haxe_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html_highlight_rules.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html_highlight_rules_test.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html_highlight_rules_test.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html_test.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/html_test.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/jade.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/jade_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/java.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/java.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/java_highlight_rules.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/java_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript/jshint.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_highlight_rules.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_highlight_rules_test.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_highlight_rules_test.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_test.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/javascript_test.js
@@ -233,6 +301,8 @@ Gem::Specification.new do |s|
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json_highlight_rules.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json_worker.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json_worker.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json_worker_test.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/json_worker_test.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/jsp.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/jsp_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/jsx.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/jsx.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/jsx_highlight_rules.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/jsx_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/latex.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/latex.js
@@ -242,14 +312,24 @@ Gem::Specification.new do |s|
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/liquid.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/liquid.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/liquid_highlight_rules.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/liquid_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/liquid_highlight_rules_test.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/liquid_highlight_rules_test.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lisp.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lisp_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lua.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lua.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lua_highlight_rules.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lua_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/luapage.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/luapage.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/luapage_highlight_rules.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/luapage_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lucene.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lucene_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/lucene_highlight_rules_test.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/makefile.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/makefile_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/markdown.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/markdown.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/markdown_highlight_rules.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/markdown_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/markdown_highlight_rules_test.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/matching_brace_outdent.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/matching_brace_outdent.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/matching_parens_outdent.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/matching_parens_outdent.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/objectivec.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/objectivec_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ocaml.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ocaml.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ocaml_highlight_rules.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ocaml_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/perl.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/perl.js
@@ -263,6 +343,12 @@ Gem::Specification.new do |s|
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/python.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/python.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/python_highlight_rules.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/python_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/python_test.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/python_test.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/r.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/r_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/rdoc.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/rdoc_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/rhtml.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/rhtml_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ruby.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ruby.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ruby_highlight_rules.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ruby_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ruby_highlight_rules_test.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/ruby_highlight_rules_test.js
@@ -276,30 +362,31 @@ Gem::Specification.new do |s|
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sh_highlight_rules.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sh_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sql.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sql.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sql_highlight_rules.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/sql_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/stylus.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/stylus_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/svg.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/svg.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/svg_highlight_rules.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/svg_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/tcl.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/tcl_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/tex.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/tex_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/text.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/text.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/text_highlight_rules.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/text_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/text_test.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/text_test.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/textile.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/textile.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/textile_highlight_rules.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/textile_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/typescript.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/typescript_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_highlight_rules.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_highlight_rules_test.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_highlight_rules_test.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_test.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_test.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_util.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xml_util.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/Position.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/JSONParseTreeHandler.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/Readme.md lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/Readme.md
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/StringLexer.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XMLLexer.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQDTLexer.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQDTParser.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQueryLexer.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQueryParser.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQueryParser.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/XQuerySemanticHighlighter.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/visitors/SyntaxHighlighter.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/antlr3-all.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery/xquery.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery_highlight_rules.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery_highlight_rules.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery_worker.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/xquery_worker.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/yaml.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mode/yaml.js
@@ -314,10 +401,6 @@ Gem::Specification.new do |s|
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/multi_select_handler.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/mouse/multi_select_handler.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/multi_select.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/multi_select.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/multi_select_test.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/multi_select_test.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/definitions.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/lexer.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/options.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/narcissus/parser.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/placeholder.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/placeholder.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/placeholder_test.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/placeholder_test.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/range.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/range.js
@@ -345,6 +428,8 @@ Gem::Specification.new do |s|
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/mockdom.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/mockdom.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/mockrenderer.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/mockrenderer.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/tests.html lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/test/tests.html
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/ambiance.css
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/ambiance.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/chrome.css lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/chrome.css
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/chrome.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/chrome.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/clouds.css lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/clouds.css
@@ -397,15 +482,16 @@ Gem::Specification.new do |s|
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/twilight.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/twilight.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/vibrant_ink.css lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/vibrant_ink.css
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/vibrant_ink.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/vibrant_ink.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/xcode.css
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/theme/xcode.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/token_iterator.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/token_iterator.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/token_iterator_test.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/token_iterator_test.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/tokenizer.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/tokenizer.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/tokenizer_dev.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/undomanager.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/undomanager.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/unicode.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/unicode.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/virtual_renderer.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/virtual_renderer.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/virtual_renderer_test.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/virtual_renderer_test.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/jshint.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/jslint.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/mirror.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/worker.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/worker.js
lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/worker_client.js lib/gollum/frontend/public/gollum/livepreview/js/ace/lib/ace/worker/worker_client.js
@@ -435,6 +521,9 @@ Gem::Specification.new do |s|
lib/gollum/frontend/templates/error.mustache lib/gollum/frontend/templates/error.mustache
lib/gollum/frontend/templates/file_view.mustache lib/gollum/frontend/templates/file_view.mustache
lib/gollum/frontend/templates/history.mustache lib/gollum/frontend/templates/history.mustache
lib/gollum/frontend/templates/history_authors/gravatar.mustache
lib/gollum/frontend/templates/history_authors/identicon.mustache
lib/gollum/frontend/templates/history_authors/none.mustache
lib/gollum/frontend/templates/layout.mustache lib/gollum/frontend/templates/layout.mustache
lib/gollum/frontend/templates/page.mustache lib/gollum/frontend/templates/page.mustache
lib/gollum/frontend/templates/pages.mustache lib/gollum/frontend/templates/pages.mustache
@@ -459,7 +548,6 @@ Gem::Specification.new do |s|
lib/gollum/page.rb lib/gollum/page.rb
lib/gollum/pagination.rb lib/gollum/pagination.rb
lib/gollum/sanitization.rb lib/gollum/sanitization.rb
lib/gollum/tex.rb
lib/gollum/web_sequence_diagram.rb lib/gollum/web_sequence_diagram.rb
lib/gollum/wiki.rb lib/gollum/wiki.rb
licenses/css_tree_menu_thecssninja/license.txt licenses/css_tree_menu_thecssninja/license.txt
+7 -2
View File
@@ -1,5 +1,7 @@
# ~*~ encoding: utf-8 ~*~
# stdlib # stdlib
require 'digest/md5' require 'digest/md5'
require 'digest/sha1'
require 'ostruct' require 'ostruct'
# external # external
@@ -18,12 +20,15 @@ require File.expand_path('../gollum/file', __FILE__)
require File.expand_path('../gollum/file_view', __FILE__) require File.expand_path('../gollum/file_view', __FILE__)
require File.expand_path('../gollum/markup', __FILE__) require File.expand_path('../gollum/markup', __FILE__)
require File.expand_path('../gollum/sanitization', __FILE__) require File.expand_path('../gollum/sanitization', __FILE__)
require File.expand_path('../gollum/tex', __FILE__)
require File.expand_path('../gollum/web_sequence_diagram', __FILE__) require File.expand_path('../gollum/web_sequence_diagram', __FILE__)
require File.expand_path('../gollum/frontend/uri_encode_component', __FILE__) require File.expand_path('../gollum/frontend/uri_encode_component', __FILE__)
# Set ruby to UTF-8 mode
# This is required for Ruby 1.8.7 which gollum still supports.
$KCODE = 'U' if RUBY_VERSION[2,1] == '8'
module Gollum module Gollum
VERSION = '2.2.3' VERSION = '2.4.5'
def self.assets_path def self.assets_path
::File.expand_path('gollum/frontend/public', ::File.dirname(__FILE__)) ::File.expand_path('gollum/frontend/public', ::File.dirname(__FILE__))
+1
View File
@@ -1,3 +1,4 @@
# ~*~ encoding: utf-8 ~*~
module Gollum module Gollum
class BlobEntry class BlobEntry
# Gets the String SHA for this blob. # Gets the String SHA for this blob.
+1
View File
@@ -1,3 +1,4 @@
# ~*~ encoding: utf-8 ~*~
module Gollum module Gollum
# Responsible for handling the commit process for a Wiki. It sets up the # Responsible for handling the commit process for a Wiki. It sets up the
# Git index, provides methods for modifying the tree, and stores callbacks # Git index, provides methods for modifying the tree, and stores callbacks
+17
View File
@@ -1,3 +1,4 @@
# ~*~ encoding: utf-8 ~*~
module Gollum module Gollum
class File class File
Wiki.file_class = self Wiki.file_class = self
@@ -13,6 +14,22 @@ module Gollum
@path = nil @path = nil
end end
# Public: The url path required to reach this page within the repo.
#
# Returns the String url_path
def url_path
path = self.path
path = path.sub(/\/[^\/]+$/, '/') if path.include?('/')
path
end
# Public: The url_path, but CGI escaped.
#
# Returns the String url_path
def escaped_url_path
CGI.escape(self.url_path).gsub('%2F','/')
end
# Public: The on-disk filename of the file. # Public: The on-disk filename of the file.
# #
# Returns the String name. # Returns the String name.
+21 -11
View File
@@ -1,3 +1,4 @@
# ~*~ encoding: utf-8 ~*~
module Gollum module Gollum
=begin =begin
FileView requires that: FileView requires that:
@@ -5,8 +6,13 @@ module Gollum
- Then all the folders are sorted and processed - Then all the folders are sorted and processed
=end =end
class FileView class FileView
def initialize pages # common use cases:
# set pages to wiki.pages and show_all to false
# set pages to wiki.pages + wiki.files and show_all to true
def initialize pages, options = {}
@pages = pages @pages = pages
@show_all = options[:show_all] || false
@checked = options[:collapse_tree] ? '' : "checked"
end end
def enclose_tree string def enclose_tree string
@@ -16,7 +22,7 @@ module Gollum
def new_page page def new_page page
name = page.name name = page.name
url = url_for_page page url = url_for_page page
%Q( <li class="file"><a href="#{url}">#{name}</a></li>\n) %Q( <li class="file"><a href="#{url}"><span class="icon"></span>#{name}</a></li>)
end end
def new_folder folder_path def new_folder folder_path
@@ -26,20 +32,26 @@ module Gollum
def new_sub_folder path def new_sub_folder path
<<-HTML <<-HTML
<li> <li>
<label>#{path}</label> <input type="checkbox" checked /> <label>#{path}</label> <input type="checkbox" #{@checked} />
<ol> <ol>
HTML HTML
end end
def end_folder def end_folder
<<-HTML "</ol></li>\n"
</ol>
</li>
HTML
end end
def url_for_page page def url_for_page page
url = ''
if @show_all
# Remove ext for valid pages.
filename = page.filename
filename = Page::valid_page_name?(filename) ? filename.chomp(::File.extname(filename)) : filename
url = ::File.join(::File.dirname(page.path), filename)
else
url = ::File.join(::File.dirname(page.path), page.filename_stripped) url = ::File.join(::File.dirname(page.path), page.filename_stripped)
end
url = url[2..-1] if url[0,2] == './' url = url[2..-1] if url[0,2] == './'
url url
end end
@@ -70,13 +82,11 @@ module Gollum
# Handle special case of only one folder. # Handle special case of only one folder.
if (count - folder_start == 1) if (count - folder_start == 1)
page = @pages[ folder_start ] page = @pages[ folder_start ]
name = page.name
url = url_for_page page
html += <<-HTML html += <<-HTML
<li> <li>
<label>#{::File.dirname(page.path)}</label> <input type="checkbox" checked /> <label>#{::File.dirname(page.path)}</label> <input type="checkbox" #{@checked} />
<ol> <ol>
<li class="file"><a href="#{url}">#{name}</a></li> #{new_page page}
</ol> </ol>
</li> </li>
HTML HTML
+32 -20
View File
@@ -1,3 +1,4 @@
# ~*~ encoding: utf-8 ~*~
require 'cgi' require 'cgi'
require 'sinatra' require 'sinatra'
require 'gollum' require 'gollum'
@@ -17,8 +18,7 @@ class String
# _Header => header which causes errors # _Header => header which causes errors
def to_url def to_url
return nil if self.nil? return nil if self.nil?
return self if ['_Header', '_Footer', '_Sidebar'].include? self upstream_to_url :exclude => ['_Header', '_Footer', '_Sidebar']
upstream_to_url
end end
end end
@@ -82,11 +82,13 @@ module Precious
before do before do
@base_url = url('/', false).chomp('/') @base_url = url('/', false).chomp('/')
settings.wiki_options.merge!({ :base_path => @base_url }) unless settings.wiki_options.has_key? :base_path # above will detect base_path when it's used with map in a config.ru
settings.wiki_options.merge!({ :base_path => @base_url })
@css = settings.wiki_options[:css]
end end
get '/' do get '/' do
redirect File.join(settings.wiki_options[:base_path].to_s, 'Home') redirect ::File.join(@base_url, 'Home')
end end
# path is set to name if path is nil. # path is set to name if path is nil.
@@ -145,6 +147,7 @@ module Precious
page_name = CGI.unescape(params[:page]) page_name = CGI.unescape(params[:page])
wiki = wiki_new wiki = wiki_new
page = wiki.paged(page_name, path, exact = true) page = wiki.paged(page_name, path, exact = true)
return if page.nil?
rename = params[:rename].to_url if params[:rename] rename = params[:rename].to_url if params[:rename]
name = rename || page.name name = rename || page.name
committer = Gollum::Committer.new(wiki, commit_message) committer = Gollum::Committer.new(wiki, commit_message)
@@ -186,17 +189,18 @@ module Precious
post '/create' do post '/create' do
name = params[:page].to_url name = params[:page].to_url
path = sanitize_empty_params(params[:path]) path = sanitize_empty_params(params[:path]) || ''
path = '' if path.nil?
format = params[:format].intern format = params[:format].intern
# write_page is not directory aware so use wiki_options to emulate dir support. # ensure pages are created in page_file_dir
wiki_options = settings.wiki_options.merge({ :page_file_dir => path }) page_dir = settings.wiki_options[:page_file_dir].to_s
wiki = Gollum::Wiki.new(settings.gollum_path, wiki_options) path = clean_url(::File.join(page_dir, path)) unless path.start_with?(page_dir)
wiki = wiki_new
begin begin
wiki.write_page(name, format, params[:content], commit_message) wiki.write_page(name, format, params[:content], commit_message, path)
redirect to("/#{clean_url(CGI.escape(::File.join(path,name)))}") redirect to("/#{clean_url(::File.join(path,name))}")
rescue Gollum::DuplicatePageError => e rescue Gollum::DuplicatePageError => e
@message = "Duplicate page: #{e.message}" @message = "Duplicate page: #{e.message}"
mustache :error mustache :error
@@ -232,6 +236,7 @@ module Precious
@content = @page.formatted_data @content = @page.formatted_data
@toc_content = wiki.universal_toc ? @page.toc_data : nil @toc_content = wiki.universal_toc ? @page.toc_data : nil
@mathjax = wiki.mathjax @mathjax = wiki.mathjax
@h1_title = wiki.h1_title
@editable = false @editable = false
mustache :page mustache :page
end end
@@ -276,10 +281,6 @@ module Precious
mustache :compare mustache :compare
end end
get %r{^/(javascript|css|images)} do
halt 404
end
get %r{/(.+?)/([0-9a-f]{40})} do get %r{/(.+?)/([0-9a-f]{40})} do
file_path = params[:captures][0] file_path = params[:captures][0]
version = params[:captures][1] version = params[:captures][1]
@@ -300,7 +301,8 @@ module Precious
get '/search' do get '/search' do
@query = params[:q] @query = params[:q]
wiki = wiki_new wiki = wiki_new
@results = wiki.search @query # Sort wiki search results by count (desc) and then by name (asc)
@results = wiki.search(@query).sort{ |a, b| (a[:count] <=> b[:count]).nonzero? || b[:name] <=> a[:name] }.reverse
@name = @query @name = @query
mustache :search mustache :search
end end
@@ -315,13 +317,21 @@ module Precious
wiki_options = settings.wiki_options.merge({ :page_file_dir => @path }) wiki_options = settings.wiki_options.merge({ :page_file_dir => @path })
wiki = Gollum::Wiki.new(settings.gollum_path, wiki_options) wiki = Gollum::Wiki.new(settings.gollum_path, wiki_options)
@results = wiki.pages @results = wiki.pages
@results += wiki.files if settings.wiki_options[:show_all]
@ref = wiki.ref @ref = wiki.ref
mustache :pages mustache :pages
end end
get '/fileview' do get '/fileview' do
wiki = Gollum::Wiki.new(settings.gollum_path, settings.wiki_options) wiki = wiki_new
@results = Gollum::FileView.new(wiki.pages).render_files options = settings.wiki_options
content = wiki.pages
# if showing all files include wiki.files
content += wiki.files if options[:show_all]
# must pass wiki_options to FileView
# --show-all and --collapse-tree can be set.
@results = Gollum::FileView.new(content, options).render_files
@ref = wiki.ref @ref = wiki.ref
mustache :file_view, { :layout => false } mustache :file_view, { :layout => false }
end end
@@ -332,10 +342,11 @@ module Precious
def show_page_or_file(fullpath) def show_page_or_file(fullpath)
name = extract_name(fullpath) name = extract_name(fullpath)
path = extract_path(fullpath) path = extract_path(fullpath) || '/'
wiki = wiki_new wiki = wiki_new
path = '/' if path.nil? page_dir = settings.wiki_options[:page_file_dir].to_s
path = ::File.join(page_dir, path) unless path.start_with?(page_dir)
if page = wiki.paged(name, path, exact = true) if page = wiki.paged(name, path, exact = true)
@page = page @page = page
@@ -344,6 +355,7 @@ module Precious
@content = page.formatted_data @content = page.formatted_data
@toc_content = wiki.universal_toc ? @page.toc_data : nil @toc_content = wiki.universal_toc ? @page.toc_data : nil
@mathjax = wiki.mathjax @mathjax = wiki.mathjax
@h1_title = wiki.h1_title
mustache :page mustache :page
elsif file = wiki.file(fullpath) elsif file = wiki.file(fullpath)
content_type file.mime_type content_type file.mime_type
+10 -1
View File
@@ -1,3 +1,4 @@
# ~*~ encoding: utf-8 ~*~
module Precious module Precious
module Helpers module Helpers
# Extract the path string that Gollum::Wiki expects # Extract the path string that Gollum::Wiki expects
@@ -19,9 +20,17 @@ module Precious
end end
# Remove all slashes from the start of string. # Remove all slashes from the start of string.
# Remove all double slashes
def clean_url url def clean_url url
return url if url.nil? return url if url.nil?
url.gsub('%2F','/').gsub(/^\/+/,'') url.gsub('%2F','/').gsub(/^\/+/,'').gsub('//','/')
end
def trim_leading_slash url
return url if url.nil?
url.gsub!('%2F','/')
return '/' + url.gsub(/^\/+/,'') if url[0,1] == '/'
url
end end
end end
end end
@@ -72,16 +72,23 @@ ol.tree
} }
li.file a li.file a
{ {
background: url(../images/fileview/document.png) 0 0 no-repeat;
color: #fff; color: #fff;
padding-left: 21px;
text-decoration: none; text-decoration: none;
display: block; display: inline-block;
} }
li.file a[href *= '.pdf'] { background: url(../images/fileview/document.png) 0 0 no-repeat; } li.file a span.icon
li.file a[href *= '.html'] { background: url(../images/fileview/document.png) 0 0 no-repeat; } {
li.file a[href $= '.css'] { background: url(../images/fileview/document.png) 0 0 no-repeat; } width: 14px;
li.file a[href $= '.js'] { background: url(../images/fileview/document.png) 0 0 no-repeat; } height: 18px;
background: url(../images/fileview/document.png) 0 0 no-repeat;
display: inline-block;
margin-right: 7px;
vertical-align: text-top;
}
li.file a[href *= '.pdf'] span.icon { background: url(../images/fileview/document.png) 0 0 no-repeat; }
li.file a[href *= '.html'] span.icon { background: url(../images/fileview/document.png) 0 0 no-repeat; }
li.file a[href $= '.css'] span.icon { background: url(../images/fileview/document.png) 0 0 no-repeat; }
li.file a[href $= '.js'] span.icon { background: url(../images/fileview/document.png) 0 0 no-repeat; }
li input li input
{ {
position: absolute; position: absolute;
@@ -21,7 +21,9 @@ body, html {
#wiki-wrapper { #wiki-wrapper {
margin: 0 auto; margin: 0 auto;
overflow: visible; overflow: visible;
width: 80%; width: 920px;
padding-left:20px;
padding-right:20px;
} }
a:link { a:link {
@@ -97,20 +97,16 @@ a.absent {
.markdown-body h1 { .markdown-body h1 {
font-size: 28px; font-size: 28px;
color: #000; color: #000;
margin-top: 50px; margin-top: 20px;
margin-bottom: 20px; margin-bottom: 10px;
} }
.markdown-body h2 { .markdown-body h2 {
font-size: 24px; font-size: 24px;
border-bottom: 1px solid #ccc; border-bottom: 1px solid #ccc;
color: #000; color: #000;
margin-top: 40px;
margin-bottom: 20px;
} }
.markdown-body h3 { .markdown-body h3 {
font-size: 18px; font-size: 18px;
margin-top: 30px;
margin-bottom: 15px;
} }
.markdown-body h4 { .markdown-body h4 {
font-size: 16px; font-size: 16px;
@@ -127,10 +123,13 @@ a.absent {
.markdown-body ul, .markdown-body ul,
.markdown-body ol, .markdown-body ol,
.markdown-body dl, .markdown-body dl,
.markdown-body li,
.markdown-body table, .markdown-body table,
.markdown-body pre { .markdown-body pre {
margin: 15px 0; margin: 0px 0;
margin-bottom: 15px;
}
.markdown-body li {
margin: 0px;
} }
.markdown-body hr { .markdown-body hr {
background: transparent url(../images/dirty-shade.png) repeat-x 0 0; background: transparent url(../images/dirty-shade.png) repeat-x 0 0;
@@ -146,12 +145,9 @@ a.absent {
.markdown-body>h5:first-child, .markdown-body>h5:first-child,
.markdown-body>h6:first-child { .markdown-body>h6:first-child {
} }
.markdown-body h1+h2{ .markdown-body h1+h2+h3{
margin-top: 30px; margin-top: 30px;
} }
.markdown-body h2+h3{
margin-top: 10px;
}
.markdown-body a:first-child h1, .markdown-body a:first-child h1,
.markdown-body a:first-child h2, .markdown-body a:first-child h2,
.markdown-body a:first-child h3, .markdown-body a:first-child h3,
Binary file not shown.

After

Width:  |  Height:  |  Size: 376 B

@@ -233,6 +233,7 @@
$('#gollum-dialog-dialog').animate({ opacity: 1 }, { $('#gollum-dialog-dialog').animate({ opacity: 1 }, {
duration: 500 duration: 500
}); });
$($('#gollum-dialog-dialog input[type="text"]').get(0)).focus();
} }
}); });
} }
@@ -212,4 +212,37 @@ $(document).ready(function() {
$('#gollum-revert-form').submit(); $('#gollum-revert-form').submit();
}); });
} }
if( $('#wiki-wrapper.edit').length ){
$("#gollum-editor-submit").click( function() { window.onbeforeunload = null; } );
$("#gollum-editor-body").one('change', function(){
window.onbeforeunload = function(){ return "Leaving will discard all edits!" };
});
$.GollumEditor();
}
if( $('#wiki-wrapper.create').length ){
$("#gollum-editor-submit").click( function() { window.onbeforeunload = null; } );
$("#gollum-editor-body").one('change', function(){
window.onbeforeunload = function(){ return "Leaving will not create a new page!" };
});
$.GollumEditor({ NewFile: true, MarkupType: default_markup });
}
if( $('#wiki-history').length ){
var lookup = {};
$('img.identicon').each(function(index, element){
var $item = $(element);
var code = parseInt($item.data('identicon'), 10);
var img_bin = lookup[code];
if( img_bin === undefined ){
var size = 16;
var canvas = $('<canvas width=16 height=16/>').get(0);
render_identicon(canvas, code, 16);
img_bin = canvas.toDataURL("image/png");
lookup[code] = img_bin;
}
$item.attr('src', img_bin);
});
}
}); });
@@ -0,0 +1,111 @@
/*
Client-side Canvas tag based Identicon rendering code
@author Don Park
@version 0.2
@date January 21th, 2007
*/
var patch0 = new Array( 0, 4, 24, 20 );
var patch1 = new Array( 0, 4, 20 );
var patch2 = new Array( 2, 24, 20 );
var patch3 = new Array( 0, 2, 20, 22 );
var patch4 = new Array( 2, 14, 22, 10 );
var patch5 = new Array( 0, 14, 24, 22 );
var patch6 = new Array( 2, 24, 22, 13, 11, 22, 20 );
var patch7 = new Array( 0, 14, 22 );
var patch8 = new Array( 6, 8, 18, 16 );
var patch9 = new Array( 4, 20, 10, 12, 2 );
var patch10 = new Array( 0, 2, 12, 10 );
var patch11 = new Array( 10, 14, 22 );
var patch12 = new Array( 20, 12, 24 );
var patch13 = new Array( 10, 2, 12 );
var patch14 = new Array( 0, 2, 10 );
var patchTypes = new Array( patch0, patch1, patch2, patch3, patch4,
patch5, patch6, patch7, patch8, patch9, patch10, patch11,
patch12, patch13, patch14, patch0 );
var centerPatchTypes = new Array(0, 4, 8, 15);
function render_identicon_patch(ctx, x, y, size, patch, turn, invert, foreColor, backColor) {
patch %= patchTypes.length;
turn %= 4;
if (patch == 15)
invert = !invert;
var vertices = patchTypes[patch];
var offset = size / 2;
var scale = size / 4;
ctx.save();
// paint background
ctx.fillStyle = invert ? foreColor : backColor;
ctx.fillRect(x, y, size, size);
// build patch path
ctx.translate(x + offset, y + offset);
ctx.rotate(turn * Math.PI / 2);
ctx.beginPath();
ctx.moveTo((vertices[0] % 5 * scale - offset), (Math.floor(vertices[0] / 5) * scale - offset));
for (var i = 1; i < vertices.length; i++)
ctx.lineTo((vertices[i] % 5 * scale - offset), (Math.floor(vertices[i] / 5) * scale - offset));
ctx.closePath();
// offset and rotate coordinate space by patch position (x, y) and
// 'turn' before rendering patch shape
// render rotated patch using fore color (back color if inverted)
ctx.fillStyle = invert ? backColor : foreColor;
ctx.fill();
// restore rotation
ctx.restore();
}
function render_identicon(node, code, size) {
if (!node || !code || !size) return;
var patchSize = size / 3;
var middleType = centerPatchTypes[code & 3];
var middleInvert = ((code >> 2) & 1) != 0;
var cornerType = (code >> 3) & 15;
var cornerInvert = ((code >> 7) & 1) != 0;
var cornerTurn = (code >> 8) & 3;
var sideType = (code >> 10) & 15;
var sideInvert = ((code >> 14) & 1) != 0;
var sideTurn = (code >> 15) & 3;
var blue = (code >> 16) & 31;
var green = (code >> 21) & 31;
var red = (code >> 27) & 31;
var foreColor = "rgb(" + (red << 3) + "," + (green << 3) + "," + (blue << 3) + ")";
var backColor = "rgb(255,255,255)";
var ctx = node.getContext("2d");
// middle patch
render_identicon_patch(ctx, patchSize, patchSize, patchSize, middleType, 0, middleInvert, foreColor, backColor);
// side patchs, starting from top and moving clock-wise
render_identicon_patch(ctx, patchSize, 0, patchSize, sideType, sideTurn++, sideInvert, foreColor, backColor);
render_identicon_patch(ctx, patchSize * 2, patchSize, patchSize, sideType, sideTurn++, sideInvert, foreColor, backColor);
render_identicon_patch(ctx, patchSize, patchSize * 2, patchSize, sideType, sideTurn++, sideInvert, foreColor, backColor);
render_identicon_patch(ctx, 0, patchSize, patchSize, sideType, sideTurn++, sideInvert, foreColor, backColor);
// corner patchs, starting from top left and moving clock-wise
render_identicon_patch(ctx, 0, 0, patchSize, cornerType, cornerTurn++, cornerInvert, foreColor, backColor);
render_identicon_patch(ctx, patchSize * 2, 0, patchSize, cornerType, cornerTurn++, cornerInvert, foreColor, backColor);
render_identicon_patch(ctx, patchSize * 2, patchSize * 2, patchSize, cornerType, cornerTurn++, cornerInvert, foreColor, backColor);
render_identicon_patch(ctx, 0, patchSize * 2, patchSize, cornerType, cornerTurn++, cornerInvert, foreColor, backColor);
}
function render_identicon_canvases(prefix) {
var canvases = document.getElementsByTagName("canvas");
var n = canvases.length;
for (var i = 0; i < n; i++) {
var node = canvases[i];
if (node.title && node.title.indexOf(prefix) == 0) {
if (node.style.display == 'none') node.style.display = "inline";
var code = node.title.substring(prefix.length) * 1;
var size = node.width;
render_identicon(node, code, size);
}
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 630 B

@@ -11,6 +11,7 @@
<div id='previewframe'><div id='contentframe' class='markdown-body'></div></div> <div id='previewframe'><div id='contentframe' class='markdown-body'></div></div>
<!-- tool panel from notepage.es. save & savecomment icons from Retina Display Icon Set. --> <!-- tool panel from notepage.es. save & savecomment icons from Retina Display Icon Set. -->
<div id='toolpanel' class='toolpanel edit' style='width: 500px; right: 0px; visibility: hidden;'> <div id='toolpanel' class='toolpanel edit' style='width: 500px; right: 0px; visibility: hidden;'>
<a id='preview' class='edit'><img src='images/globe_24.png' alt='Preview' title='Preview'></a>
<a id='save' class='edit'><img src='images/save_24.png' alt='Save' title='Save'></a> <a id='save' class='edit'><img src='images/save_24.png' alt='Save' title='Save'></a>
<a id='savecomment' class='edit'><img src='images/savecomment_24.png' alt='Save with comment' title='Save with comment'></a> <a id='savecomment' class='edit'><img src='images/savecomment_24.png' alt='Save with comment' title='Save with comment'></a>
<a id='toggle' class='edit' href='javascript:void(0)' onclick='jsm.toggleLeftRight();'><img src='images/lr_24.png' alt='Toggle left to right' title='Toggle left to right'></a> <a id='toggle' class='edit' href='javascript:void(0)' onclick='jsm.toggleLeftRight();'><img src='images/lr_24.png' alt='Toggle left to right' title='Toggle left to right'></a>
@@ -1,46 +1,37 @@
/* ***** BEGIN LICENSE BLOCK ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Distributed under the BSD license:
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Mozilla Skywriter. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Mozilla. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2009 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Kevin Dangoor (kdangoor@mozilla.com) * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
/** /**
* class Ace
*
* The main class required to set up an Ace instance in the browser. * The main class required to set up an Ace instance in the browser.
* *
* * @class Ace
**/ **/
define(function(require, exports, module) { define(function(require, exports, module) {
@@ -48,8 +39,8 @@ define(function(require, exports, module) {
require("./lib/fixoldbrowsers"); require("./lib/fixoldbrowsers");
var Dom = require("./lib/dom"); var dom = require("./lib/dom");
var Event = require("./lib/event"); var event = require("./lib/event");
var Editor = require("./editor").Editor; var Editor = require("./editor").Editor;
var EditSession = require("./edit_session").EditSession; var EditSession = require("./edit_session").EditSession;
@@ -60,44 +51,57 @@ var MultiSelect = require("./multi_select").MultiSelect;
// The following require()s are for inclusion in the built ace file // The following require()s are for inclusion in the built ace file
require("./worker/worker_client"); require("./worker/worker_client");
require("./keyboard/hash_handler"); require("./keyboard/hash_handler");
require("./keyboard/state_handler");
require("./placeholder"); require("./placeholder");
require("./mode/folding/fold_mode");
exports.config = require("./config"); exports.config = require("./config");
/** /**
* Ace.edit(el) -> Editor * Provides access to require in packed noconflict mode
* - el (String | DOMElement): Either the id of an element, or the element itself * @param {String} moduleName
* @returns {Object}
* *
* This method embeds the Ace editor into the DOM, at the element provided by `el`. **/
exports.require = require;
/**
* Embeds the Ace editor into the DOM, at the element provided by `el`.
* @param {String | DOMElement} el Either the id of an element, or the element itself
* *
**/ **/
exports.edit = function(el) { exports.edit = function(el) {
if (typeof(el) == "string") { if (typeof(el) == "string") {
el = document.getElementById(el); var _id = el;
var el = document.getElementById(_id);
if (!el)
throw "ace.edit can't find div #" + _id;
} }
if (el.env && el.env.editor instanceof Editor) if (el.env && el.env.editor instanceof Editor)
return el.env.editor; return el.env.editor;
var doc = new EditSession(Dom.getInnerText(el)); var doc = exports.createEditSession(dom.getInnerText(el));
doc.setUndoManager(new UndoManager());
el.innerHTML = ''; el.innerHTML = '';
var editor = new Editor(new Renderer(el, require("./theme/textmate"))); var editor = new Editor(new Renderer(el));
new MultiSelect(editor); new MultiSelect(editor);
editor.setSession(doc); editor.setSession(doc);
var env = {}; var env = {
env.document = doc; document: doc,
env.editor = editor; editor: editor,
editor.resize(); onResize: editor.resize.bind(editor)
Event.addListener(window, "resize", function() { };
editor.resize(); event.addListener(window, "resize", env.onResize);
}); el.env = editor.env = env;
el.env = env;
// Store env on editor such that it can be accessed later on from
// the returned object.
editor.env = env;
return editor; return editor;
}; };
exports.createEditSession = function(text, mode) {
var doc = new EditSession(text, doc);
doc.setUndoManager(new UndoManager());
return doc;
}
exports.EditSession = EditSession;
exports.UndoManager = UndoManager;
}); });
@@ -1,37 +1,30 @@
/* ***** BEGIN LICENSE BLOCK ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Distributed under the BSD license:
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Fabian Jakobs <fabian AT ajax DOT org> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -42,20 +35,20 @@ var oop = require("./lib/oop");
var EventEmitter = require("./lib/event_emitter").EventEmitter; var EventEmitter = require("./lib/event_emitter").EventEmitter;
/** /**
* class Anchor
* *
* Defines the floating pointer in the document. Whenever text is inserted or deleted before the cursor, the position of the cursor is updated * Defines the floating pointer in the document. Whenever text is inserted or deleted before the cursor, the position of the cursor is updated.
* *
* @class Anchor
**/ **/
/** /**
* new Anchor(doc, row, column)
* - doc (Document): The document to associate with the anchor
* - row (Number): The starting row position
* - column (Number): The starting column position
*
* Creates a new `Anchor` and associates it with a document. * Creates a new `Anchor` and associates it with a document.
* *
* @param {Document} doc The document to associate with the anchor
* @param {Number} row The starting row position
* @param {Number} column The starting column position
*
* @constructor
**/ **/
var Anchor = exports.Anchor = function(doc, row, column) { var Anchor = exports.Anchor = function(doc, row, column) {
@@ -75,10 +68,8 @@ var Anchor = exports.Anchor = function(doc, row, column) {
oop.implement(this, EventEmitter); oop.implement(this, EventEmitter);
/** /**
* Anchor.getPosition() -> Object
*
* Returns an object identifying the `row` and `column` position of the current anchor. * Returns an object identifying the `row` and `column` position of the current anchor.
* * @returns {Object}
**/ **/
this.getPosition = function() { this.getPosition = function() {
@@ -86,10 +77,9 @@ var Anchor = exports.Anchor = function(doc, row, column) {
}; };
/** /**
* Anchor.getDocument() -> Document
* *
* Returns the current document. * Returns the current document.
* * @returns {Document}
**/ **/
this.getDocument = function() { this.getDocument = function() {
@@ -97,10 +87,17 @@ var Anchor = exports.Anchor = function(doc, row, column) {
}; };
/** /**
* Anchor@onChange(e) * Fires whenever the anchor position changes.
* - e (Event): Contains data about the event *
* Both of these objects have a `row` and `column` property corresponding to the position.
*
* Events that can trigger this function include [[Anchor.setPosition `setPosition()`]].
*
* @event change
* @param {Object} e An object containing information about the anchor position. It has two properties:
* - `old`: An object describing the old Anchor position
* - `value`: An object describing the new Anchor position
* *
* Fires whenever the anchor position changes. Events that can trigger this function include `'includeText'`, `'insertLines'`, `'removeText'`, and `'removeLines'`.
* *
**/ **/
@@ -170,12 +167,12 @@ var Anchor = exports.Anchor = function(doc, row, column) {
}; };
/** /**
* Anchor.setPosition(row, column, noClip)
* - row (Number): The row index to move the anchor to
* - column (Number): The column index to move the anchor to
* - noClip (Boolean): Identifies if you want the position to be clipped
*
* Sets the anchor position to the specified row and column. If `noClip` is `true`, the position is not clipped. * Sets the anchor position to the specified row and column. If `noClip` is `true`, the position is not clipped.
* @param {Number} row The row index to move the anchor to
* @param {Number} column The column index to move the anchor to
* @param {Boolean} noClip Identifies if you want the position to be clipped
*
*
* *
**/ **/
@@ -208,8 +205,6 @@ var Anchor = exports.Anchor = function(doc, row, column) {
}; };
/** /**
* Anchor.detach()
*
* When called, the `'change'` event listener is removed. * When called, the `'change'` event listener is removed.
* *
**/ **/
@@ -218,15 +213,14 @@ var Anchor = exports.Anchor = function(doc, row, column) {
this.document.removeEventListener("change", this.$onChange); this.document.removeEventListener("change", this.$onChange);
}; };
/** internal, hide /**
* Anchor.clipPositionToDocument(row, column)
* - row (Number): The row index to clip the anchor to
* - column (Number): The column index to clip the anchor to
*
* Clips the anchor position to the specified row and column. * Clips the anchor position to the specified row and column.
* @param {Number} row The row index to clip the anchor to
* @param {Number} column The column index to clip the anchor to
*
*
* *
**/ **/
this.$clipPositionToDocument = function(row, column) { this.$clipPositionToDocument = function(row, column) {
var pos = {}; var pos = {};
@@ -1,37 +1,30 @@
/* ***** BEGIN LICENSE BLOCK ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Distributed under the BSD license:
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Fabian Jakobs <fabian AT ajax DOT org> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -1,37 +1,30 @@
/* ***** BEGIN LICENSE BLOCK ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Distributed under the BSD license:
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Fabian Jakobs <fabian AT ajax DOT org> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -45,20 +38,23 @@ var EventEmitter = require("./lib/event_emitter").EventEmitter;
var MAX_LINE_LENGTH = 5000; var MAX_LINE_LENGTH = 5000;
/** /**
* class BackgroundTokenizer
* *
* Tokenizes the current [[Document `Document`]] in the background, and caches the tokenized rows for future use. If a certain row is changed, everything below that row is re-tokenized.
* *
* Tokenizes the current [[Document `Document`]] in the background, and caches the tokenized rows for future use.
*
* If a certain row is changed, everything below that row is re-tokenized.
*
* @class BackgroundTokenizer
**/ **/
/** /**
* new BackgroundTokenizer(tokenizer, editor)
* - tokenizer (Tokenizer): The tokenizer to use
* - editor (Editor): The editor to associate with
*
* Creates a new `BackgroundTokenizer` object. * Creates a new `BackgroundTokenizer` object.
* @param {Tokenizer} tokenizer The tokenizer to use
* @param {Editor} editor The editor to associate with
* *
* *
*
* @constructor
**/ **/
var BackgroundTokenizer = function(tokenizer, editor) { var BackgroundTokenizer = function(tokenizer, editor) {
@@ -105,11 +101,10 @@ var BackgroundTokenizer = function(tokenizer, editor) {
oop.implement(this, EventEmitter); oop.implement(this, EventEmitter);
/** /**
* BackgroundTokenizer.setTokenizer(tokenizer)
* - tokenizer (Tokenizer): The new tokenizer to use
*
* Sets a new tokenizer for this object. * Sets a new tokenizer for this object.
* *
* @param {Tokenizer} tokenizer The new tokenizer to use
*
**/ **/
this.setTokenizer = function(tokenizer) { this.setTokenizer = function(tokenizer) {
this.tokenizer = tokenizer; this.tokenizer = tokenizer;
@@ -120,11 +115,8 @@ var BackgroundTokenizer = function(tokenizer, editor) {
}; };
/** /**
* BackgroundTokenizer.setDocument(doc)
* - doc (Document): The new document to associate with
*
* Sets a new document to associate with this object. * Sets a new document to associate with this object.
* * @param {Document} doc The new document to associate with
**/ **/
this.setDocument = function(doc) { this.setDocument = function(doc) {
this.doc = doc; this.doc = doc;
@@ -135,11 +127,16 @@ var BackgroundTokenizer = function(tokenizer, editor) {
}; };
/** /**
* BackgroundTokenizer.fireUpdateEvent(firstRow, lastRow) * Fires whenever the background tokeniziers between a range of rows are going to be updated.
* - firstRow (Number): The starting row region
* - lastRow (Number): The final row region
* *
* @event update
* @param {Object} e An object containing two properties, `first` and `last`, which indicate the rows of the region being updated.
*
**/
/**
* Emits the `'update'` event. `firstRow` and `lastRow` are used to define the boundaries of the region to be updated. * Emits the `'update'` event. `firstRow` and `lastRow` are used to define the boundaries of the region to be updated.
* @param {Number} firstRow The starting row region
* @param {Number} lastRow The final row region
* *
**/ **/
this.fireUpdateEvent = function(firstRow, lastRow) { this.fireUpdateEvent = function(firstRow, lastRow) {
@@ -151,11 +148,10 @@ var BackgroundTokenizer = function(tokenizer, editor) {
}; };
/** /**
* BackgroundTokenizer.start(startRow)
* - startRow (Number): The row to start at
*
* Starts tokenizing at the row indicated. * Starts tokenizing at the row indicated.
* *
* @param {Number} startRow The row to start at
*
**/ **/
this.start = function(startRow) { this.start = function(startRow) {
this.currentLine = Math.min(startRow || 0, this.currentLine, this.doc.getLength()); this.currentLine = Math.min(startRow || 0, this.currentLine, this.doc.getLength());
@@ -194,8 +190,6 @@ var BackgroundTokenizer = function(tokenizer, editor) {
}; };
/** /**
* BackgroundTokenizer.stop()
*
* Stops tokenizing. * Stops tokenizing.
* *
**/ **/
@@ -205,12 +199,12 @@ var BackgroundTokenizer = function(tokenizer, editor) {
this.running = false; this.running = false;
}; };
/** related to: BackgroundTokenizer.$tokenizeRows /**
* BackgroundTokenizer.getTokens(firstRow, lastRow) -> [Object] * Gives list of tokens of the row. (tokens are cached)
* - firstRow (Number): The row to start at *
* - lastRow (Number): The row to finish at * @param {Number} row The row to get tokens at
*
* *
* Starts tokenizing at the row indicated. Returns a list of objects of the tokenized rows.
* *
**/ **/
this.getTokens = function(row) { this.getTokens = function(row) {
@@ -218,10 +212,9 @@ var BackgroundTokenizer = function(tokenizer, editor) {
}; };
/** /**
* BackgroundTokenizer.getState(row) -> String
* - row (Number): The row to start at
*
* [Returns the state of tokenization at the end of a row.]{: #BackgroundTokenizer.getState} * [Returns the state of tokenization at the end of a row.]{: #BackgroundTokenizer.getState}
*
* @param {Number} row The row to get state at
**/ **/
this.getState = function(row) { this.getState = function(row) {
if (this.currentLine == row) if (this.currentLine == row)
@@ -1,37 +1,30 @@
/* ***** BEGIN LICENSE BLOCK ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Distributed under the BSD license:
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Harutyun Amirjanyan <harutyun@c9.io> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -6,26 +6,24 @@ var HashHandler = require("../keyboard/hash_handler").HashHandler;
var EventEmitter = require("../lib/event_emitter").EventEmitter; var EventEmitter = require("../lib/event_emitter").EventEmitter;
/** /**
* class CommandManager * @class CommandManager
*
*
* *
* *
**/ **/
/** /**
* new CommandManager(platform, commands) * new CommandManager(platform, commands)
* - platform (String): Identifier for the platform; must be either `'mac'` or `'win'` * @param {String} platform Identifier for the platform; must be either `'mac'` or `'win'`
* - commands (Array): A list of commands * @param {Array} commands A list of commands
*
* *
* TODO
* *
* *
**/ **/
var CommandManager = function(platform, commands) { var CommandManager = function(platform, commands) {
this.platform = platform; this.platform = platform;
this.commands = {}; this.commands = this.byName = {};
this.commmandKeyBinding = {}; this.commmandKeyBinding = {};
this.addCommands(commands); this.addCommands(commands);
@@ -60,9 +58,11 @@ oop.inherits(CommandManager, HashHandler);
return retvalue === false ? false : true; return retvalue === false ? false : true;
}; };
this.toggleRecording = function() { this.toggleRecording = function(editor) {
if (this.$inReplay) if (this.$inReplay)
return; return;
editor && editor._emit("changeStatus");
if (this.recording) { if (this.recording) {
this.macro.pop(); this.macro.pop();
this.removeEventListener("exec", this.$addCommandToMacro); this.removeEventListener("exec", this.$addCommandToMacro);
@@ -89,7 +89,7 @@ oop.inherits(CommandManager, HashHandler);
return; return;
if (this.recording) if (this.recording)
return this.toggleRecording(); return this.toggleRecording(editor);
try { try {
this.$inReplay = true; this.$inReplay = true;
@@ -1,37 +1,30 @@
/* ***** BEGIN LICENSE BLOCK ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Distributed under the BSD license:
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Fabian Jakobs <fabian AT ajax DOT org> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -68,20 +61,20 @@ module.exports = {
}, },
"test: mac hotkeys": function() { "test: mac hotkeys": function() {
var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "L"); var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "l");
assert.equal(command, this.command); assert.equal(command, this.command);
var command = this.cm.findKeyCommand(keys.KEY_MODS.ctrl, "L"); var command = this.cm.findKeyCommand(keys.KEY_MODS.ctrl, "l");
assert.equal(command, undefined); assert.equal(command, undefined);
}, },
"test: win hotkeys": function() { "test: win hotkeys": function() {
var cm = new CommandManager("win", [this.command]); var cm = new CommandManager("win", [this.command]);
var command = cm.findKeyCommand(keys.KEY_MODS.command, "L"); var command = cm.findKeyCommand(keys.KEY_MODS.command, "l");
assert.equal(command, undefined); assert.equal(command, undefined);
var command = cm.findKeyCommand(keys.KEY_MODS.ctrl, "L"); var command = cm.findKeyCommand(keys.KEY_MODS.ctrl, "l");
assert.equal(command, this.command); assert.equal(command, this.command);
}, },
@@ -91,7 +84,7 @@ module.exports = {
this.cm.exec("gotoline"); this.cm.exec("gotoline");
assert.ok(!this.command.called); assert.ok(!this.command.called);
var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "L"); var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "l");
assert.equal(command, null); assert.equal(command, null);
}, },
@@ -101,7 +94,7 @@ module.exports = {
this.cm.exec("gotoline"); this.cm.exec("gotoline");
assert.ok(!this.command.called); assert.ok(!this.command.called);
var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "L"); var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "l");
assert.equal(command, null); assert.equal(command, null);
}, },
@@ -121,14 +114,14 @@ module.exports = {
assert.ok(command.called); assert.ok(command.called);
assert.ok(!this.command.called); assert.ok(!this.command.called);
assert.equal(this.cm.findKeyCommand(keys.KEY_MODS.command, "L"), command); assert.equal(this.cm.findKeyCommand(keys.KEY_MODS.command, "l"), command);
}, },
"test: adding commands and recording a macro": function() { "test: adding commands and recording a macro": function() {
var called = ""; var called = "";
this.cm.addCommands({ this.cm.addCommands({
togglerecording: function(editor) { togglerecording: function(editor) {
editor.cm.toggleRecording(); editor.cm.toggleRecording(editor);
}, },
replay: function(editor) { replay: function(editor) {
editor.cm.replay(); editor.cm.replay();
@@ -141,8 +134,13 @@ module.exports = {
} }
}); });
var statusUpdateEmitted = false;
this._emit = function() {statusUpdateEmitted = true};
this.cm.exec("togglerecording", this); this.cm.exec("togglerecording", this);
assert.ok(this.cm.recording); assert.ok(this.cm.recording);
assert.ok(statusUpdateEmitted);
this.cm.exec("cm1", this, "-"); this.cm.exec("cm1", this, "-");
this.cm.exec("cm2"); this.cm.exec("cm2");
@@ -156,33 +154,41 @@ module.exports = {
}, },
"test: bindkeys": function() { "test: bindkeys": function() {
var called = "";
this.cm.addCommands({
cm1: function(editor, arg) {
called += "1" + (arg || "");
},
cm2: function(editor) {
called += "2";
}
});
this.cm.bindKeys({ this.cm.bindKeys({
"Ctrl-L|Command-C": "cm1", "Ctrl-L|Command-C": "cm1",
"Ctrl-R": "cm2" "Ctrl-R": "cm2"
}); });
var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "C"); var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "c");
assert.equal(command, "cm1"); assert.equal(command, "cm1");
var command = this.cm.findKeyCommand(keys.KEY_MODS.ctrl, "R"); var command = this.cm.findKeyCommand(keys.KEY_MODS.ctrl, "r");
assert.equal(command, "cm2"); assert.equal(command, "cm2");
this.cm.bindKeys({ this.cm.bindKeys({
"Ctrl-R": null "Ctrl-R": null
}); });
var command = this.cm.findKeyCommand(keys.KEY_MODS.ctrl, "R"); var command = this.cm.findKeyCommand(keys.KEY_MODS.ctrl, "r");
assert.equal(command, null); assert.equal(command, null);
},
"test: binding keys without modifiers": function() {
this.cm.bindKeys({
"R": "cm1",
"Shift-r": "cm2",
"Return": "cm4",
"Enter": "cm3"
});
var command = this.cm.findKeyCommand(-1, "r");
assert.equal(command, "cm1");
var command = this.cm.findKeyCommand(-1, "R");
assert.equal(command, "cm2");
var command = this.cm.findKeyCommand(0, "return");
assert.equal(command, "cm3");
} }
}; };
@@ -1,40 +1,30 @@
/* vim:ts=4:sts=4:sw=4: /* ***** BEGIN LICENSE BLOCK *****
* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license:
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Fabian Jakobs <fabian AT ajax DOT org> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* Julian Viereck <julian.viereck@gmail.com> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Mihai Sucan <mihai.sucan@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -117,11 +107,13 @@ exports.commands = [{
name: "selecttostart", name: "selecttostart",
bindKey: bindKey("Ctrl-Shift-Home", "Command-Shift-Up"), bindKey: bindKey("Ctrl-Shift-Home", "Command-Shift-Up"),
exec: function(editor) { editor.getSelection().selectFileStart(); }, exec: function(editor) { editor.getSelection().selectFileStart(); },
multiSelectAction: "forEach",
readOnly: true readOnly: true
}, { }, {
name: "gotostart", name: "gotostart",
bindKey: bindKey("Ctrl-Home", "Command-Home|Command-Up"), bindKey: bindKey("Ctrl-Home", "Command-Home|Command-Up"),
exec: function(editor) { editor.navigateFileStart(); }, exec: function(editor) { editor.navigateFileStart(); },
multiSelectAction: "forEach",
readOnly: true readOnly: true
}, { }, {
name: "selectup", name: "selectup",
@@ -286,7 +278,7 @@ exports.commands = [{
}, { }, {
name: "togglerecording", name: "togglerecording",
bindKey: bindKey("Ctrl-Alt-E", "Command-Option-E"), bindKey: bindKey("Ctrl-Alt-E", "Command-Option-E"),
exec: function(editor) { editor.commands.toggleRecording(); }, exec: function(editor) { editor.commands.toggleRecording(editor); },
readOnly: true readOnly: true
}, { }, {
name: "replaymacro", name: "replaymacro",
@@ -295,13 +287,13 @@ exports.commands = [{
readOnly: true readOnly: true
}, { }, {
name: "jumptomatching", name: "jumptomatching",
bindKey: bindKey("Ctrl-P", "Ctrl-P"), bindKey: bindKey("Ctrl-P", "Ctrl-Shift-P"),
exec: function(editor) { editor.jumpToMatching(); }, exec: function(editor) { editor.jumpToMatching(); },
multiSelectAction: "forEach", multiSelectAction: "forEach",
readOnly: true readOnly: true
}, { }, {
name: "selecttomatching", name: "selecttomatching",
bindKey: bindKey("Ctrl-Shift-P", "Ctrl-Shift-P"), bindKey: bindKey("Ctrl-Shift-P", null),
exec: function(editor) { editor.jumpToMatching(true); }, exec: function(editor) { editor.jumpToMatching(true); },
readOnly: true readOnly: true
}, },
@@ -329,11 +321,26 @@ exports.commands = [{
bindKey: bindKey("Ctrl-Shift-D", "Command-Shift-D"), bindKey: bindKey("Ctrl-Shift-D", "Command-Shift-D"),
exec: function(editor) { editor.duplicateSelection(); }, exec: function(editor) { editor.duplicateSelection(); },
multiSelectAction: "forEach" multiSelectAction: "forEach"
}, {
name: "sortlines",
bindKey: bindKey("Ctrl-Alt-S", "Command-Alt-S"),
exec: function(editor) { editor.sortLines(); },
multiSelectAction: "forEach"
}, { }, {
name: "togglecomment", name: "togglecomment",
bindKey: bindKey("Ctrl-/", "Command-/"), bindKey: bindKey("Ctrl-/", "Command-/"),
exec: function(editor) { editor.toggleCommentLines(); }, exec: function(editor) { editor.toggleCommentLines(); },
multiSelectAction: "forEach" multiSelectAction: "forEach"
}, {
name: "modifyNumberUp",
bindKey: bindKey("Ctrl-Shift-Up", "Alt-Shift-Up"),
exec: function(editor) { editor.modifyNumber(1); },
multiSelectAction: "forEach"
}, {
name: "modifyNumberDown",
bindKey: bindKey("Ctrl-Shift-Down", "Alt-Shift-Down"),
exec: function(editor) { editor.modifyNumber(-1); },
multiSelectAction: "forEach"
}, { }, {
name: "replace", name: "replace",
bindKey: bindKey("Ctrl-R", "Command-Option-F"), bindKey: bindKey("Ctrl-R", "Command-Option-F"),
@@ -1,38 +1,30 @@
/* vim:ts=4:sts=4:sw=4: /* ***** BEGIN LICENSE BLOCK *****
* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license:
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Harutyun Amirjanyan <amirjanyan AT gmail DOT com> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -82,11 +74,15 @@ exports.defaultCommands = [{
}, { }, {
name: "splitIntoLines", name: "splitIntoLines",
exec: function(editor) { editor.multiSelect.splitIntoLines(); }, exec: function(editor) { editor.multiSelect.splitIntoLines(); },
bindKey: {win: "Ctrl-Shift-L", mac: "Ctrl-Shift-L"}, bindKey: {win: "Ctrl-Alt-L", mac: "Ctrl-Alt-L"},
readonly: true readonly: true
}, {
name: "alignCursors",
exec: function(editor) { editor.alignCursors(); },
bindKey: {win: "Ctrl-Alt-A", mac: "Ctrl-Alt-A"}
}]; }];
// commands active in multiselect mode // commands active only in multiselect mode
exports.multiSelectCommands = [{ exports.multiSelectCommands = [{
name: "singleSelection", name: "singleSelection",
bindKey: "esc", bindKey: "esc",
@@ -1,38 +1,30 @@
/* vim:ts=4:sts=4:sw=4: /* ***** BEGIN LICENSE BLOCK *****
* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license:
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Fabian Jakobs <fabian AT ajax DOT org> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -47,10 +39,12 @@ var global = (function() {
var options = { var options = {
packaged: false, packaged: false,
workerPath: "", workerPath: null,
modePath: "", modePath: null,
themePath: "", themePath: null,
suffix: ".js" basePath: "",
suffix: ".js",
$moduleUrls: {}
}; };
exports.get = function(key) { exports.get = function(key) {
@@ -71,6 +65,28 @@ exports.all = function() {
return lang.copyObject(options); return lang.copyObject(options);
}; };
exports.moduleUrl = function(name, component) {
if (options.$moduleUrls[name])
return options.$moduleUrls[name];
var parts = name.split("/");
component = component || parts[parts.length - 2] || "";
var base = parts[parts.length - 1].replace(component, "").replace(/(^[\-_])|([\-_]$)/, "");
if (!base && parts.length > 1)
base = parts[parts.length - 2];
var path = options[component + "Path"];
if (path == null)
path = options.basePath;
if (path && path.slice(-1) != "/")
path += "/";
return path + component + "-" + base + this.get("suffix");
};
exports.setModuleUrl = function(name, subst) {
return options.$moduleUrls[name] = subst;
};
exports.init = function() { exports.init = function() {
options.packaged = require.packaged || module.packaged || (global.define && define.packaged); options.packaged = require.packaged || module.packaged || (global.define && define.packaged);
@@ -85,9 +101,8 @@ exports.init = function() {
var script = scripts[i]; var script = scripts[i];
var src = script.src || script.getAttribute("src"); var src = script.src || script.getAttribute("src");
if (!src) { if (!src)
continue; continue;
}
var attributes = script.attributes; var attributes = script.attributes;
for (var j=0, l=attributes.length; j < l; j++) { for (var j=0, l=attributes.length; j < l; j++) {
@@ -0,0 +1,71 @@
/* ***** BEGIN LICENSE BLOCK *****
* Distributed under the BSD license:
*
* Copyright (c) 2010, Ajax.org B.V.
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* ***** END LICENSE BLOCK ***** */
if (typeof process !== "undefined") {
require("amd-loader");
}
define(function(require, exports, module) {
"use strict";
var config = require("./config");
var assert = require("./test/assertions");
module.exports = {
"test path resolution" : function() {
config.set("packaged", "true");
var url = config.moduleUrl("kr_theme", "theme");
assert.equal(url, "theme-kr.js");
config.set("basePath", "a/b");
url = config.moduleUrl("m/theme", "theme");
assert.equal(url, "a/b/theme-m.js");
url = config.moduleUrl("m/theme", "ext");
assert.equal(url, "a/b/ext-theme.js");
config.set("workerPath", "c/");
url = config.moduleUrl("foo/1", "worker");
assert.equal(url, "c/worker-1.js");
config.setModuleUrl("foo/1", "a/b1.js");
url = config.moduleUrl("foo/1", "theme");
assert.equal(url, "a/b1.js");
assert.equal();
}
};
});
if (typeof module !== "undefined" && module === require.main) {
require("asyncjs").test.testcase(module.exports).exec()
}
@@ -1,7 +1,7 @@
.ace_editor { .ace_editor {
position: absolute; position: absolute;
overflow: hidden; overflow: hidden;
font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Droid Sans Mono', 'Consolas', monospace; font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Consolas', 'source-code-pro', monospace;
font-size: 12px; font-size: 12px;
} }
@@ -12,9 +12,9 @@
.ace_content { .ace_content {
position: absolute; position: absolute;
box-sizing: border-box;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
box-sizing: border-box;
cursor: text; cursor: text;
} }
@@ -27,13 +27,20 @@
z-index: 4; z-index: 4;
} }
.ace_scroller.horscroll { .ace_gutter-active-line {
position: absolute;
left: 0;
right: 0;
}
.ace_scroller.ace_scroll-left {
box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset; box-shadow: 17px 0 16px -16px rgba(0, 0, 0, 0.4) inset;
} }
.ace_gutter-cell { .ace_gutter-cell {
padding-left: 19px; padding-left: 19px;
padding-right: 6px; padding-right: 6px;
background-repeat: no-repeat;
} }
.ace_gutter-cell.ace_error { .ace_gutter-cell.ace_error {
@@ -44,7 +51,6 @@
.ace_gutter-cell.ace_warning { .ace_gutter-cell.ace_warning {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QUM2OEZDQTg4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QUM2OEZDQTk4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBQzY4RkNBNjhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBQzY4RkNBNzhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pgd7PfIAAAGmSURBVHjaYvr//z8DJZiJgUIANoCRkREb9gLiSVAaQx4OQM7AAkwd7XU2/v++/rOttdYGEB9dASEvOMydGKfH8Gv/p4XTkvRBfLxeQAP+1cUhXopyvzhP7P/IoSj7g7Mw09cNKO6J1QQ0L4gICPIv/veg/8W+JdFvQNLHVsW9/nmn9zk7B+cCkDwhL7gt6knSZnx9/LuCEOcvkIAMP+cvto9nfqyZmmUAksfnBUtbM60gX/3/kgyv3/xSFOL5DZT+L8vP+Yfh5cvfPvp/xUHyQHXGyAYwgpwBjZYFT3Y1OEl/OfCH4ffv3wzc4iwMvNIsDJ+f/mH4+vIPAxsb631WW0Yln6ZpQLXdMK/DXGDflh+sIv37EivD5x//Gb7+YWT4y86sl7BCCkSD+Z++/1dkvsFRl+HnD1Rvje4F8whjMXmGj58YGf5zsDMwcnAwfPvKcml62DsQDeaDxN+/Y0qwlpEHqrdB94IRNIDUgfgfKJChGK4OikEW3gTiXUB950ASLFAF54AC94A0G9QAfOnmF9DCDzABFqS08IHYDIScdijOjQABBgC+/9awBH96jwAAAABJRU5ErkJggg=="); background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyJpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMC1jMDYwIDYxLjEzNDc3NywgMjAxMC8wMi8xMi0xNzozMjowMCAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNSBNYWNpbnRvc2giIHhtcE1NOkluc3RhbmNlSUQ9InhtcC5paWQ6QUM2OEZDQTg4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiIHhtcE1NOkRvY3VtZW50SUQ9InhtcC5kaWQ6QUM2OEZDQTk4RTU0MTFFMUEzM0VFRTM2RUY1M0RBMjYiPiA8eG1wTU06RGVyaXZlZEZyb20gc3RSZWY6aW5zdGFuY2VJRD0ieG1wLmlpZDpBQzY4RkNBNjhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIgc3RSZWY6ZG9jdW1lbnRJRD0ieG1wLmRpZDpBQzY4RkNBNzhFNTQxMUUxQTMzRUVFMzZFRjUzREEyNiIvPiA8L3JkZjpEZXNjcmlwdGlvbj4gPC9yZGY6UkRGPiA8L3g6eG1wbWV0YT4gPD94cGFja2V0IGVuZD0iciI/Pgd7PfIAAAGmSURBVHjaYvr//z8DJZiJgUIANoCRkREb9gLiSVAaQx4OQM7AAkwd7XU2/v++/rOttdYGEB9dASEvOMydGKfH8Gv/p4XTkvRBfLxeQAP+1cUhXopyvzhP7P/IoSj7g7Mw09cNKO6J1QQ0L4gICPIv/veg/8W+JdFvQNLHVsW9/nmn9zk7B+cCkDwhL7gt6knSZnx9/LuCEOcvkIAMP+cvto9nfqyZmmUAksfnBUtbM60gX/3/kgyv3/xSFOL5DZT+L8vP+Yfh5cvfPvp/xUHyQHXGyAYwgpwBjZYFT3Y1OEl/OfCH4ffv3wzc4iwMvNIsDJ+f/mH4+vIPAxsb631WW0Yln6ZpQLXdMK/DXGDflh+sIv37EivD5x//Gb7+YWT4y86sl7BCCkSD+Z++/1dkvsFRl+HnD1Rvje4F8whjMXmGj58YGf5zsDMwcnAwfPvKcml62DsQDeaDxN+/Y0qwlpEHqrdB94IRNIDUgfgfKJChGK4OikEW3gTiXUB950ASLFAF54AC94A0G9QAfOnmF9DCDzABFqS08IHYDIScdijOjQABBgC+/9awBH96jwAAAABJRU5ErkJggg==");
background-repeat: no-repeat;
background-position: 2px center; background-position: 2px center;
} }
@@ -56,50 +62,40 @@
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpGRTk5MTVGREIxNDkxMUUxOTc5Q0FFREQyMTNGMjBFQyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpGRTk5MTVGRUIxNDkxMUUxOTc5Q0FFREQyMTNGMjBFQyI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkZFOTkxNUZCQjE0OTExRTE5NzlDQUVERDIxM0YyMEVDIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkZFOTkxNUZDQjE0OTExRTE5NzlDQUVERDIxM0YyMEVDIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+SIDkjAAAAJ1JREFUeNpi/P//PwMlgImBQkB7A6qrq/+DMC55FkIGKCoq4pVnpFkgTp069f/+/fv/r1u37r+tre1/kg0A+ptn9uzZYLaRkRHpLvjw4cNXWVlZhufPnzOcO3eOdAO0tbVPAjHDmzdvGA4fPsxIsgGSkpJmv379Ynj37h2DjIyMCMkG3LhxQ/T27dsMampqDHZ2dq/pH41DxwCAAAMAFdc68dUsFZgAAAAASUVORK5CYII="); background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAyRpVFh0WE1MOmNvbS5hZG9iZS54bXAAAAAAADw/eHBhY2tldCBiZWdpbj0i77u/IiBpZD0iVzVNME1wQ2VoaUh6cmVTek5UY3prYzlkIj8+IDx4OnhtcG1ldGEgeG1sbnM6eD0iYWRvYmU6bnM6bWV0YS8iIHg6eG1wdGs9IkFkb2JlIFhNUCBDb3JlIDUuMy1jMDExIDY2LjE0NTY2MSwgMjAxMi8wMi8wNi0xNDo1NjoyNyAgICAgICAgIj4gPHJkZjpSREYgeG1sbnM6cmRmPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5LzAyLzIyLXJkZi1zeW50YXgtbnMjIj4gPHJkZjpEZXNjcmlwdGlvbiByZGY6YWJvdXQ9IiIgeG1sbnM6eG1wPSJodHRwOi8vbnMuYWRvYmUuY29tL3hhcC8xLjAvIiB4bWxuczp4bXBNTT0iaHR0cDovL25zLmFkb2JlLmNvbS94YXAvMS4wL21tLyIgeG1sbnM6c3RSZWY9Imh0dHA6Ly9ucy5hZG9iZS5jb20veGFwLzEuMC9zVHlwZS9SZXNvdXJjZVJlZiMiIHhtcDpDcmVhdG9yVG9vbD0iQWRvYmUgUGhvdG9zaG9wIENTNiAoTWFjaW50b3NoKSIgeG1wTU06SW5zdGFuY2VJRD0ieG1wLmlpZDpGRTk5MTVGREIxNDkxMUUxOTc5Q0FFREQyMTNGMjBFQyIgeG1wTU06RG9jdW1lbnRJRD0ieG1wLmRpZDpGRTk5MTVGRUIxNDkxMUUxOTc5Q0FFREQyMTNGMjBFQyI+IDx4bXBNTTpEZXJpdmVkRnJvbSBzdFJlZjppbnN0YW5jZUlEPSJ4bXAuaWlkOkZFOTkxNUZCQjE0OTExRTE5NzlDQUVERDIxM0YyMEVDIiBzdFJlZjpkb2N1bWVudElEPSJ4bXAuZGlkOkZFOTkxNUZDQjE0OTExRTE5NzlDQUVERDIxM0YyMEVDIi8+IDwvcmRmOkRlc2NyaXB0aW9uPiA8L3JkZjpSREY+IDwveDp4bXBtZXRhPiA8P3hwYWNrZXQgZW5kPSJyIj8+SIDkjAAAAJ1JREFUeNpi/P//PwMlgImBQkB7A6qrq/+DMC55FkIGKCoq4pVnpFkgTp069f/+/fv/r1u37r+tre1/kg0A+ptn9uzZYLaRkRHpLvjw4cNXWVlZhufPnzOcO3eOdAO0tbVPAjHDmzdvGA4fPsxIsgGSkpJmv379Ynj37h2DjIyMCMkG3LhxQ/T27dsMampqDHZ2dq/pH41DxwCAAAMAFdc68dUsFZgAAAAASUVORK5CYII=");
} }
.ace_editor .ace_sb { .ace_scrollbar {
position: absolute; position: absolute;
overflow-x: hidden; overflow-x: hidden;
overflow-y: scroll; overflow-y: scroll;
right: 0; right: 0;
} }
.ace_editor .ace_sb div { .ace_scrollbar-inner {
position: absolute; position: absolute;
width: 1px; width: 1px;
left: 0; left: 0;
} }
.ace_editor .ace_print_margin_layer { .ace_print-margin {
z-index: 0;
position: absolute;
overflow: hidden;
margin: 0;
left: 0;
height: 100%;
width: 100%;
}
.ace_editor .ace_print_margin {
position: absolute; position: absolute;
height: 100%; height: 100%;
} }
.ace_editor > textarea { .ace_text-input {
position: absolute; position: absolute;
z-index: 0; z-index: 0;
width: 0.5em; width: 0.5em;
height: 1em; height: 1em;
opacity: 0; opacity: 0;
background: transparent; background: transparent;
appearance: none;
-moz-appearance: none; -moz-appearance: none;
appearance: none;
border: none; border: none;
resize: none; resize: none;
outline: none; outline: none;
overflow: hidden; overflow: hidden;
} }
.ace_editor > textarea.ace_composition { .ace_text-input.ace_composition {
background: #fff; background: #fff;
color: #000; color: #000;
z-index: 1000; z-index: 1000;
@@ -115,17 +111,16 @@
white-space: nowrap; white-space: nowrap;
height: 100%; height: 100%;
width: 100%; width: 100%;
box-sizing: border-box;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
box-sizing: border-box;
/* setting pointer-events: auto; on node under the mouse, which changes /* setting pointer-events: auto; on node under the mouse, which changes
during scroll, will break mouse wheel scrolling in Safari */ during scroll, will break mouse wheel scrolling in Safari */
pointer-events: none; pointer-events: none;
} }
.ace_gutter .ace_layer { .ace_gutter-layer {
position: relative; position: relative;
min-width: 40px;
width: auto; width: auto;
text-align: right; text-align: right;
pointer-events: auto; pointer-events: auto;
@@ -148,13 +143,28 @@
.ace_cursor { .ace_cursor {
z-index: 4; z-index: 4;
position: absolute; position: absolute;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
} }
.ace_cursor.ace_hidden { .ace_hidden-cursors .ace_cursor {
opacity: 0.2; opacity: 0.2;
} }
.ace_editor.multiselect .ace_cursor { .ace_smooth-blinking .ace_cursor {
-moz-transition: opacity 0.18s;
-webkit-transition: opacity 0.18s;
-o-transition: opacity 0.18s;
-ms-transition: opacity 0.18s;
transition: opacity 0.18s;
}
.ace_cursor[style*="opacity: 0"]{
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=0)";
}
.ace_editor.ace_multiselect .ace_cursor {
border-left-width: 1px; border-left-width: 1px;
} }
@@ -177,23 +187,23 @@
z-index: 6; z-index: 6;
} }
.ace_marker-layer .ace_active_line { .ace_marker-layer .ace_active-line {
position: absolute; position: absolute;
z-index: 2; z-index: 2;
} }
.ace_marker-layer .ace_selected_word { .ace_marker-layer .ace_selected-word {
position: absolute; position: absolute;
z-index: 4; z-index: 4;
box-sizing: border-box;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
box-sizing: border-box;
} }
.ace_line .ace_fold { .ace_line .ace_fold {
box-sizing: border-box;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
box-sizing: border-box;
display: inline-block; display: inline-block;
height: 11px; height: 11px;
@@ -227,39 +237,55 @@
background-position: center center, top left; background-position: center center, top left;
} }
.ace_dragging .ace_content { .ace_editor.ace_dragging .ace_content {
cursor: move; cursor: move;
} }
.ace_gutter-tooltip {
background-color: #FFFFD5;
border: 1px solid gray;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.4);
color: black;
display: inline-block;
padding: 4px;
position: absolute;
z-index: 300;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
cursor: default;
white-space: pre-line;
word-wrap: break-word;
}
.ace_folding-enabled > .ace_gutter-cell { .ace_folding-enabled > .ace_gutter-cell {
padding-right: 13px; padding-right: 13px;
} }
.ace_fold-widget { .ace_fold-widget {
box-sizing: border-box;
-moz-box-sizing: border-box; -moz-box-sizing: border-box;
-webkit-box-sizing: border-box; -webkit-box-sizing: border-box;
box-sizing: border-box;
margin: 0 -12px 1px 1px; margin: 0 -12px 0 1px;
display: inline-block; display: inline-block;
height: 14px;
width: 11px; width: 11px;
vertical-align: text-bottom; vertical-align: top;
background-image: url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%00%05%08%06%00%00%00%8Do%26%E5%00%00%004IDATx%DAe%8A%B1%0D%000%0C%C2%F2%2CK%96%BC%D0%8F9%81%88H%E9%D0%0E%96%C0%10%92%3E%02%80%5E%82%E4%A9*-%EEsw%C8%CC%11%EE%96w%D8%DC%E9*Eh%0C%151(%00%00%00%00IEND%AEB%60%82"); background-image: url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%00%05%08%06%00%00%00%8Do%26%E5%00%00%004IDATx%DAe%8A%B1%0D%000%0C%C2%F2%2CK%96%BC%D0%8F9%81%88H%E9%D0%0E%96%C0%10%92%3E%02%80%5E%82%E4%A9*-%EEsw%C8%CC%11%EE%96w%D8%DC%E9*Eh%0C%151(%00%00%00%00IEND%AEB%60%82");
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center 4px; background-position: center;
border-radius: 3px; border-radius: 3px;
border: 1px solid transparent; border: 1px solid transparent;
} }
.ace_fold-widget.end { .ace_fold-widget.ace_end {
background-image: url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%00%05%08%06%00%00%00%8Do%26%E5%00%00%004IDATx%DAm%C7%C1%09%000%08C%D1%8C%ECE%C8E(%8E%EC%02)%1EZJ%F1%C1'%04%07I%E1%E5%EE%CAL%F5%A2%99%99%22%E2%D6%1FU%B5%FE0%D9x%A7%26Wz5%0E%D5%00%00%00%00IEND%AEB%60%82"); background-image: url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%05%00%00%00%05%08%06%00%00%00%8Do%26%E5%00%00%004IDATx%DAm%C7%C1%09%000%08C%D1%8C%ECE%C8E(%8E%EC%02)%1EZJ%F1%C1'%04%07I%E1%E5%EE%CAL%F5%A2%99%99%22%E2%D6%1FU%B5%FE0%D9x%A7%26Wz5%0E%D5%00%00%00%00IEND%AEB%60%82");
} }
.ace_fold-widget.closed { .ace_fold-widget.ace_closed {
background-image: url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%03%00%00%00%06%08%06%00%00%00%06%E5%24%0C%00%00%009IDATx%DA5%CA%C1%09%000%08%03%C0%AC*(%3E%04%C1%0D%BA%B1%23%A4Uh%E0%20%81%C0%CC%F8%82%81%AA%A2%AArGfr%88%08%11%11%1C%DD%7D%E0%EE%5B%F6%F6%CB%B8%05Q%2F%E9tai%D9%00%00%00%00IEND%AEB%60%82"); background-image: url("data:image/png,%89PNG%0D%0A%1A%0A%00%00%00%0DIHDR%00%00%00%03%00%00%00%06%08%06%00%00%00%06%E5%24%0C%00%00%009IDATx%DA5%CA%C1%09%000%08%03%C0%AC*(%3E%04%C1%0D%BA%B1%23%A4Uh%E0%20%81%C0%CC%F8%82%81%AA%A2%AArGfr%88%08%11%11%1C%DD%7D%E0%EE%5B%F6%F6%CB%B8%05Q%2F%E9tai%D9%00%00%00%00IEND%AEB%60%82");
} }
@@ -269,7 +295,6 @@
-moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7); -moz-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
-webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7); -webkit-box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7); box-shadow: 0 1px 1px rgba(255, 255, 255, 0.7);
background-position: center 4px;
} }
.ace_fold-widget:active { .ace_fold-widget:active {
@@ -285,10 +310,10 @@
.ace_dark .ace_fold-widget { .ace_dark .ace_fold-widget {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC"); background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHklEQVQIW2P4//8/AzoGEQ7oGCaLLAhWiSwB146BAQCSTPYocqT0AAAAAElFTkSuQmCC");
} }
.ace_dark .ace_fold-widget.end { .ace_dark .ace_fold-widget.ace_end {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg=="); background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAH0lEQVQIW2P4//8/AxQ7wNjIAjDMgC4AxjCVKBirIAAF0kz2rlhxpAAAAABJRU5ErkJggg==");
} }
.ace_dark .ace_fold-widget.closed { .ace_dark .ace_fold-widget.ace_closed {
background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg=="); background-image: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAMAAAAFCAYAAACAcVaiAAAAHElEQVQIW2P4//+/AxAzgDADlOOAznHAKgPWAwARji8UIDTfQQAAAABJRU5ErkJggg==");
} }
.ace_dark .ace_fold-widget:hover { .ace_dark .ace_fold-widget:hover {
@@ -303,7 +328,7 @@
.ace_fold-widget.invalid { .ace_fold-widget.ace_invalid {
background-color: #FFB4B4; background-color: #FFB4B4;
border-color: #DE5555; border-color: #DE5555;
} }
@@ -325,3 +350,19 @@
transition: opacity 0.05s ease 0.05s; transition: opacity 0.05s ease 0.05s;
opacity:1; opacity:1;
} }
.ace_underline {
text-decoration: underline;
}
.ace_bold {
font-weight: bold;
}
.ace_nobold .ace_bold {
font-weight: normal;
}
.ace_italic {
font-style: italic;
}
@@ -1,37 +1,30 @@
/* ***** BEGIN LICENSE BLOCK ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Distributed under the BSD license:
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Fabian Jakobs <fabian AT ajax DOT org> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -44,20 +37,20 @@ var Range = require("./range").Range;
var Anchor = require("./anchor").Anchor; var Anchor = require("./anchor").Anchor;
/** /**
* class Document * Contains the text of the document. Document can be attached to several [[EditSession `EditSession`]]s.
*
* Contains the text of the document. Documents are controlled by a single [[EditSession `EditSession`]]. At its core, `Document`s are just an array of strings, with each row in the document matching up to the array index.
* *
* At its core, `Document`s are just an array of strings, with each row in the document matching up to the array index.
* *
* @class Document
**/ **/
/** /**
* new Document([text])
* - text (String | Array): The starting text
* *
* Creates a new `Document`. If `text` is included, the `Document` contains those strings; otherwise, it's empty. * Creates a new `Document`. If `text` is included, the `Document` contains those strings; otherwise, it's empty.
* * @param {String | Array} text The starting text
* @constructor
**/ **/
var Document = function(text) { var Document = function(text) {
this.$lines = []; this.$lines = [];
@@ -77,10 +70,9 @@ var Document = function(text) {
oop.implement(this, EventEmitter); oop.implement(this, EventEmitter);
/** /**
* Document.setValue(text) -> Void
* - text (String): The text to use
*
* Replaces all the lines in the current `Document` with the value of `text`. * Replaces all the lines in the current `Document` with the value of `text`.
*
* @param {String} text The text to use
**/ **/
this.setValue = function(text) { this.setValue = function(text) {
var len = this.getLength(); var len = this.getLength();
@@ -89,8 +81,6 @@ var Document = function(text) {
}; };
/** /**
* Document.getValue() -> String
*
* Returns all the lines in the document as a single string, split by the new line character. * Returns all the lines in the document as a single string, split by the new line character.
**/ **/
this.getValue = function() { this.getValue = function() {
@@ -98,23 +88,23 @@ var Document = function(text) {
}; };
/** /**
* Document.createAnchor(row, column) -> Anchor
* - row (Number): The row number to use
* - column (Number): The column number to use
*
* Creates a new `Anchor` to define a floating point in the document. * Creates a new `Anchor` to define a floating point in the document.
* @param {Number} row The row number to use
* @param {Number} column The column number to use
*
*
**/ **/
this.createAnchor = function(row, column) { this.createAnchor = function(row, column) {
return new Anchor(this, row, column); return new Anchor(this, row, column);
}; };
/** internal, hide /**
* Document.$split(text) -> [String]
* - text (String): The text to work with
* + ([String]): A String array, with each index containing a piece of the original `text` string.
*
* Splits a string of text on any newline (`\n`) or carriage-return ('\r') characters. * Splits a string of text on any newline (`\n`) or carriage-return ('\r') characters.
* *
* @method $split
* @param {String} text The text to work with
* @returns {String} A String array, with each index containing a piece of the original `text` string.
*
* *
**/ **/
@@ -129,11 +119,7 @@ var Document = function(text) {
}; };
/** internal, hide
* Document.$detectNewLine(text) -> Void
*
*
**/
this.$detectNewLine = function(text) { this.$detectNewLine = function(text) {
var match = text.match(/^.*?(\r\n|\r|\n)/m); var match = text.match(/^.*?(\r\n|\r|\n)/m);
if (match) { if (match) {
@@ -144,12 +130,11 @@ var Document = function(text) {
}; };
/** /**
* Document.getNewLineCharacter() -> String * Returns the newline character that's being used, depending on the value of `newLineMode`.
* + (String): If `newLineMode == windows`, `\r\n` is returned.<br/> * @returns {String} If `newLineMode == windows`, `\r\n` is returned.
* If `newLineMode == unix`, `\n` is returned.<br/> * If `newLineMode == unix`, `\n` is returned.
* If `newLineMode == auto`, the value of `autoNewLine` is returned. * If `newLineMode == auto`, the value of `autoNewLine` is returned.
* *
* Returns the newline character that's being used, depending on the value of `newLineMode`.
* *
* *
* *
@@ -170,10 +155,10 @@ var Document = function(text) {
this.$autoNewLine = "\n"; this.$autoNewLine = "\n";
this.$newLineMode = "auto"; this.$newLineMode = "auto";
/** /**
* Document.setNewLineMode(newLineMode) -> Void
* - newLineMode(String): [The newline mode to use; can be either `windows`, `unix`, or `auto`]{: #Document.setNewLineMode.param}
*
* [Sets the new line mode.]{: #Document.setNewLineMode.desc} * [Sets the new line mode.]{: #Document.setNewLineMode.desc}
* @param {String} newLineMode [The newline mode to use; can be either `windows`, `unix`, or `auto`]{: #Document.setNewLineMode.param}
*
*
**/ **/
this.setNewLineMode = function(newLineMode) { this.setNewLineMode = function(newLineMode) {
if (this.$newLineMode === newLineMode) if (this.$newLineMode === newLineMode)
@@ -183,20 +168,18 @@ var Document = function(text) {
}; };
/** /**
* Document.getNewLineMode() -> String
*
* [Returns the type of newlines being used; either `windows`, `unix`, or `auto`]{: #Document.getNewLineMode} * [Returns the type of newlines being used; either `windows`, `unix`, or `auto`]{: #Document.getNewLineMode}
* * @returns String
**/ **/
this.getNewLineMode = function() { this.getNewLineMode = function() {
return this.$newLineMode; return this.$newLineMode;
}; };
/** /**
* Document.isNewLine(text) -> Boolean
* - text (String): The text to check
*
* Returns `true` if `text` is a newline character (either `\r\n`, `\r`, or `\n`). * Returns `true` if `text` is a newline character (either `\r\n`, `\r`, or `\n`).
* @param {String} text The text to check
*
*
* *
**/ **/
this.isNewLine = function(text) { this.isNewLine = function(text) {
@@ -204,10 +187,10 @@ var Document = function(text) {
}; };
/** /**
* Document.getLine(row) -> String
* - row (Number): The row index to retrieve
*
* Returns a verbatim copy of the given line as it is in the document * Returns a verbatim copy of the given line as it is in the document
* @param {Number} row The row index to retrieve
*
*
* *
**/ **/
this.getLine = function(row) { this.getLine = function(row) {
@@ -215,11 +198,11 @@ var Document = function(text) {
}; };
/** /**
* Document.getLines(firstRow, lastRow) -> [String]
* - firstRow (Number): The first row index to retrieve
* - lastRow (Number): The final row index to retrieve
*
* Returns an array of strings of the rows between `firstRow` and `lastRow`. This function is inclusive of `lastRow`. * Returns an array of strings of the rows between `firstRow` and `lastRow`. This function is inclusive of `lastRow`.
* @param {Number} firstRow The first row index to retrieve
* @param {Number} lastRow The final row index to retrieve
*
*
* *
**/ **/
this.getLines = function(firstRow, lastRow) { this.getLines = function(firstRow, lastRow) {
@@ -227,8 +210,6 @@ var Document = function(text) {
}; };
/** /**
* Document.getAllLines() -> [String]
*
* Returns all lines in the document as string array. Warning: The caller should not modify this array! * Returns all lines in the document as string array. Warning: The caller should not modify this array!
**/ **/
this.getAllLines = function() { this.getAllLines = function() {
@@ -236,8 +217,6 @@ var Document = function(text) {
}; };
/** /**
* Document.getLength() -> Number
*
* Returns the number of rows in the document. * Returns the number of rows in the document.
**/ **/
this.getLength = function() { this.getLength = function() {
@@ -245,10 +224,10 @@ var Document = function(text) {
}; };
/** /**
* Document.getTextRange(range) -> String
* - range (Range): The range to work with
*
* [Given a range within the document, this function returns all the text within that range as a single string.]{: #Document.getTextRange.desc} * [Given a range within the document, this function returns all the text within that range as a single string.]{: #Document.getTextRange.desc}
* @param {Range} range The range to work with
*
*
**/ **/
this.getTextRange = function(range) { this.getTextRange = function(range) {
if (range.start.row == range.end.row) { if (range.start.row == range.end.row) {
@@ -263,11 +242,6 @@ var Document = function(text) {
} }
}; };
/** internal, hide
* Document.$clipPosition(position) -> Number
*
*
**/
this.$clipPosition = function(position) { this.$clipPosition = function(position) {
var length = this.getLength(); var length = this.getLength();
if (position.row >= length) { if (position.row >= length) {
@@ -278,12 +252,10 @@ var Document = function(text) {
}; };
/** /**
* Document.insert(position, text) -> Number
* - position (Number): The position to start inserting at
* - text (String): A chunk of text to insert
* + (Number): The position of the last line of `text`. If the length of `text` is 0, this function simply returns `position`.
* Inserts a block of `text` and the indicated `position`. * Inserts a block of `text` and the indicated `position`.
* * @param {Object} position The position to start inserting at
* @param {String} text A chunk of text to insert
* @returns {Object} The position ({row, column}) of the last line of `text`. If the length of `text` is 0, this function simply returns `position`.
* *
**/ **/
this.insert = function(position, text) { this.insert = function(position, text) {
@@ -310,15 +282,42 @@ var Document = function(text) {
}; };
/** /**
* Document.insertLines(row, lines) -> Object * Fires whenever the document changes.
* - row (Number): The index of the row to insert at
* - lines (Array): An array of strings
* + (Object): Returns an object containing the final row and column, like this:<br/>
* ```{row: endRow, column: 0}```<br/>
* If `lines` is empty, this function returns an object containing the current row, and column, like this:<br/>
* ```{row: row, column: 0}```
* *
* Several methods trigger different `"change"` events. Below is a list of each action type, followed by each property that's also available:
*
* * `"insertLines"` (emitted by [[Document.insertLines]])
* * `range`: the [[Range]] of the change within the document
* * `lines`: the lines in the document that are changing
* * `"insertText"` (emitted by [[Document.insertNewLine]])
* * `range`: the [[Range]] of the change within the document
* * `text`: the text that's being added
* * `"removeLines"` (emitted by [[Document.insertLines]])
* * `range`: the [[Range]] of the change within the document
* * `lines`: the lines in the document that were removed
* * `nl`: the new line character (as defined by [[Document.getNewLineCharacter]])
* * `"removeText"` (emitted by [[Document.removeInLine]] and [[Document.removeNewLine]])
* * `range`: the [[Range]] of the change within the document
* * `text`: the text that's being removed
*
* @event change
* @param {Object} e Contains at least one property called `"action"`. `"action"` indicates the action that triggered the change. Each action also has a set of additional properties.
*
**/
/**
* Inserts the elements in `lines` into the document, starting at the row index given by `row`. This method also triggers the `'change'` event. * Inserts the elements in `lines` into the document, starting at the row index given by `row`. This method also triggers the `'change'` event.
* @param {Number} row The index of the row to insert at
* @param {Array} lines An array of strings
* @returns {Object} Contains the final row and column, like this:
* ```
* {row: endRow, column: 0}
* ```
* If `lines` is empty, this function returns an object containing the current row, and column, like this:
* ```
* {row: row, column: 0}
* ```
*
*
* *
* *
**/ **/
@@ -348,14 +347,12 @@ var Document = function(text) {
}; };
/** /**
* Document.insertNewLine(position) -> Object
* - position (String): The position to insert at
* + (Object): Returns an object containing the final row and column, like this:<br/>
* ```{row: endRow, column: 0}```
*
* Inserts a new line into the document at the current row's `position`. This method also triggers the `'change'` event. * Inserts a new line into the document at the current row's `position`. This method also triggers the `'change'` event.
* * @param {Object} position The position to insert at
* * @returns {Object} Returns an object containing the final row and column, like this:<br/>
* ```
* {row: endRow, column: 0}
* ```
* *
**/ **/
this.insertNewLine = function(position) { this.insertNewLine = function(position) {
@@ -381,16 +378,13 @@ var Document = function(text) {
}; };
/** /**
* Document.insertInLine(position, text) -> Object | Number
* - position (Number): The position to insert at
* - text (String): A chunk of text
* + (Object): Returns an object containing the final row and column, like this:<br/>
* ```{row: endRow, column: 0}```
* + (Number): If `text` is empty, this function returns the value of `position`
*
* Inserts `text` into the `position` at the current row. This method also triggers the `'change'` event. * Inserts `text` into the `position` at the current row. This method also triggers the `'change'` event.
* * @param {Object} position The position to insert at
* * @param {String} text A chunk of text
* @returns {Object} Returns an object containing the final row and column, like this:
* ```
* {row: endRow, column: 0}
* ```
* *
**/ **/
this.insertInLine = function(position, text) { this.insertInLine = function(position, text) {
@@ -418,11 +412,9 @@ var Document = function(text) {
}; };
/** /**
* Document.remove(range) -> Object
* - range (Range): A specified Range to remove
* + (Object): Returns the new `start` property of the range, which contains `startRow` and `startColumn`. If `range` is empty, this function returns the unmodified value of `range.start`.
*
* Removes the `range` from the document. * Removes the `range` from the document.
* @param {Range} range A specified Range to remove
* @returns {Object} Returns the new `start` property of the range, which contains `startRow` and `startColumn`. If `range` is empty, this function returns the unmodified value of `range.start`.
* *
* *
**/ **/
@@ -459,13 +451,11 @@ var Document = function(text) {
}; };
/** /**
* Document.removeInLine(row, startColumn, endColumn) -> Object
* - row (Number): The row to remove from
* - startColumn (Number): The column to start removing at
* - endColumn (Number): The column to stop removing at
* + (Object): Returns an object containing `startRow` and `startColumn`, indicating the new row and column values.<br/>If `startColumn` is equal to `endColumn`, this function returns nothing.
*
* Removes the specified columns from the `row`. This method also triggers the `'change'` event. * Removes the specified columns from the `row`. This method also triggers the `'change'` event.
* @param {Number} row The row to remove from
* @param {Number} startColumn The column to start removing at
* @param {Number} endColumn The column to stop removing at
* @returns {Object} Returns an object containing `startRow` and `startColumn`, indicating the new row and column values.<br/>If `startColumn` is equal to `endColumn`, this function returns nothing.
* *
* *
**/ **/
@@ -489,12 +479,10 @@ var Document = function(text) {
}; };
/** /**
* Document.removeLines(firstRow, lastRow) -> [String]
* - firstRow (Number): The first row to be removed
* - lastRow (Number): The last row to be removed
* + ([String]): Returns all the removed lines.
*
* Removes a range of full lines. This method also triggers the `'change'` event. * Removes a range of full lines. This method also triggers the `'change'` event.
* @param {Number} firstRow The first row to be removed
* @param {Number} lastRow The last row to be removed
* @returns {[String]} Returns all the removed lines.
* *
* *
**/ **/
@@ -513,10 +501,8 @@ var Document = function(text) {
}; };
/** /**
* Document.removeNewLine(row) -> Void
* - row (Number): The row to check
*
* Removes the new line between `row` and the row immediately following it. This method also triggers the `'change'` event. * Removes the new line between `row` and the row immediately following it. This method also triggers the `'change'` event.
* @param {Number} row The row to check
* *
**/ **/
this.removeNewLine = function(row) { this.removeNewLine = function(row) {
@@ -537,15 +523,14 @@ var Document = function(text) {
}; };
/** /**
* Document.replace(range, text) -> Object * Replaces a range in the document with the new `text`.
* - range (Range): A specified Range to replace * @param {Range} range A specified Range to replace
* - text (String): The new text to use as a replacement * @param {String} text The new text to use as a replacement
* + (Object): Returns an object containing the final row and column, like this: * @returns {Object} Returns an object containing the final row and column, like this:
* {row: endRow, column: 0} * {row: endRow, column: 0}
* If the text and range are empty, this function returns an object containing the current `range.start` value. * If the text and range are empty, this function returns an object containing the current `range.start` value.
* If the text is the exact same as what currently exists, this function returns an object containing the current `range.end` value. * If the text is the exact same as what currently exists, this function returns an object containing the current `range.end` value.
* *
* Replaces a range in the document with the new `text`.
* *
**/ **/
this.replace = function(range, text) { this.replace = function(range, text) {
@@ -569,8 +554,6 @@ var Document = function(text) {
}; };
/** /**
* Document.applyDeltas(deltas) -> Void
*
* Applies all the changes previously accumulated. These can be either `'includeText'`, `'insertLines'`, `'removeText'`, and `'removeLines'`. * Applies all the changes previously accumulated. These can be either `'includeText'`, `'insertLines'`, `'removeText'`, and `'removeLines'`.
**/ **/
this.applyDeltas = function(deltas) { this.applyDeltas = function(deltas) {
@@ -590,8 +573,6 @@ var Document = function(text) {
}; };
/** /**
* Document.revertDeltas(deltas) -> Void
*
* Reverts any changes previously applied. These can be either `'includeText'`, `'insertLines'`, `'removeText'`, and `'removeLines'`. * Reverts any changes previously applied. These can be either `'includeText'`, `'insertLines'`, `'removeText'`, and `'removeLines'`.
**/ **/
this.revertDeltas = function(deltas) { this.revertDeltas = function(deltas) {
@@ -1,38 +1,30 @@
/* ***** BEGIN LICENSE BLOCK ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Distributed under the BSD license:
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Fabian Jakobs <fabian AT ajax DOT org> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* Julian Viereck <julian.viereck@gmail.com> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
File diff suppressed because it is too large Load Diff
@@ -1,38 +1,30 @@
/* vim:ts=4:sts=4:sw=4: /* ***** BEGIN LICENSE BLOCK *****
* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license:
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Fabian Jakobs <fabian AT ajax DOT org> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -42,38 +34,13 @@ define(function(require, exports, module) {
var TokenIterator = require("../token_iterator").TokenIterator; var TokenIterator = require("../token_iterator").TokenIterator;
var Range = require("../range").Range; var Range = require("../range").Range;
/**
* class BracketMatch
*
*
*
*
**/
/**
* new BracketMatch(position)
* - platform (String): Identifier for the platform; must be either `'mac'` or `'win'`
* - commands (Array): A list of commands
*
* TODO
*
*
**/
function BracketMatch() { function BracketMatch() {
/** this.findMatchingBracket = function(position, char) {
* new findMatchingBracket(position)
* - position (Number): Identifier for the platform; must be either `'mac'` or `'win'`
* - commands (Array): A list of commands
*
* TODO
*
*
**/
this.findMatchingBracket = function(position) {
if (position.column == 0) return null; if (position.column == 0) return null;
var charBeforeCursor = this.getLine(position.row).charAt(position.column-1); var charBeforeCursor = char || this.getLine(position.row).charAt(position.column-1);
if (charBeforeCursor == "") return null; if (charBeforeCursor == "") return null;
var match = charBeforeCursor.match(/([\(\[\{])|([\)\]\}])/); var match = charBeforeCursor.match(/([\(\[\{])|([\)\]\}])/);
@@ -144,7 +111,7 @@ function BracketMatch() {
if (!token) if (!token)
token = iterator.stepForward(); token = iterator.stepForward();
if (!token) if (!token)
return return;
if (!typeRe){ if (!typeRe){
typeRe = new RegExp( typeRe = new RegExp(
@@ -200,7 +167,7 @@ function BracketMatch() {
if (!token) if (!token)
token = iterator.stepForward(); token = iterator.stepForward();
if (!token) if (!token)
return return;
if (!typeRe){ if (!typeRe){
typeRe = new RegExp( typeRe = new RegExp(
@@ -1,38 +1,30 @@
/* vim:ts=4:sts=4:sw=4: /* ***** BEGIN LICENSE BLOCK *****
* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license:
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Julian Viereck <julian DOT viereck AT gmail DOT com> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -91,7 +83,7 @@ var Fold = exports.Fold = function(range, placeholder) {
var afterStart = this.subFolds[i]; var afterStart = this.subFolds[i];
if (cmp == 0) if (cmp == 0)
return afterStart.addSubFold(fold) return afterStart.addSubFold(fold);
// cmp == -1 // cmp == -1
var row = fold.range.end.row, column = fold.range.end.column; var row = fold.range.end.row, column = fold.range.end.column;
@@ -105,11 +97,11 @@ var Fold = exports.Fold = function(range, placeholder) {
if (cmp == 0) if (cmp == 0)
throw "A fold can't intersect already existing fold" + fold.range + this.range; throw "A fold can't intersect already existing fold" + fold.range + this.range;
var consumedFolds = this.subFolds.splice(i, j - i, fold) var consumedFolds = this.subFolds.splice(i, j - i, fold);
fold.setFoldLine(this.foldLine); fold.setFoldLine(this.foldLine);
return fold; return fold;
} };
}).call(Fold.prototype); }).call(Fold.prototype);
@@ -1,38 +1,30 @@
/* vim:ts=4:sts=4:sw=4: /* ***** BEGIN LICENSE BLOCK *****
* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license:
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Julian Viereck <julian DOT viereck AT gmail DOT com> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -178,7 +170,7 @@ function FoldLine(foldData, folds) {
&& fold.start.row != row) && fold.start.row != row)
{ {
//throwing here breaks whole editor //throwing here breaks whole editor
//@todo properly handle this //TODO: properly handle this
window.console && window.console.log(row, column, fold); window.console && window.console.log(row, column, fold);
} else if (fold.start.row == row) { } else if (fold.start.row == row) {
folds = this.folds; folds = this.folds;
@@ -1,38 +1,30 @@
/* vim:ts=4:sts=4:sw=4: /* ***** BEGIN LICENSE BLOCK *****
* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license:
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Julian Viereck <julian DOT viereck AT gmail DOT com> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -282,9 +274,6 @@ function Folding() {
var endColumn = fold.end.column; var endColumn = fold.end.column;
// --- Some checking --- // --- Some checking ---
if (fold.placeholder.length < 2)
throw "Placeholder has to be at least 2 characters";
if (startRow == endRow && endColumn - startColumn < 2) if (startRow == endRow && endColumn - startColumn < 2)
throw "The range has to be at least 2 characters width"; throw "The range has to be at least 2 characters width";
@@ -470,9 +459,7 @@ function Folding() {
this.getRowFoldEnd = function(docRow, startFoldRow) { this.getRowFoldEnd = function(docRow, startFoldRow) {
var foldLine = this.getFoldLine(docRow, startFoldRow); var foldLine = this.getFoldLine(docRow, startFoldRow);
return (foldLine return foldLine ? foldLine.end.row : docRow;
? foldLine.end.row
: docRow);
}; };
this.getFoldDisplayLine = function(foldLine, endRow, endColumn, startRow, startColumn) { this.getFoldDisplayLine = function(foldLine, endRow, endColumn, startRow, startColumn) {
@@ -499,7 +486,7 @@ function Folding() {
} }
lastColumn = Math.max(startColumn, lastColumn); lastColumn = Math.max(startColumn, lastColumn);
} }
if (placeholder) { if (placeholder != null) {
textLine += placeholder; textLine += placeholder;
} else { } else {
textLine += doc.getLine(row).substring(lastColumn, column); textLine += doc.getLine(row).substring(lastColumn, column);
@@ -598,30 +585,34 @@ function Folding() {
this.addFold(placeholder, range); this.addFold(placeholder, range);
}; };
this.getCommentFoldRange = function(row, column) { this.getCommentFoldRange = function(row, column, dir) {
var iterator = new TokenIterator(this, row, column); var iterator = new TokenIterator(this, row, column);
var token = iterator.getCurrentToken(); var token = iterator.getCurrentToken();
if (token && /^comment|string/.test(token.type)) { if (token && /^comment|string/.test(token.type)) {
var range = new Range(); var range = new Range();
var re = new RegExp(token.type.replace(/\..*/, "\\.")); var re = new RegExp(token.type.replace(/\..*/, "\\."));
if (dir != 1) {
do { do {
token = iterator.stepBackward(); token = iterator.stepBackward();
} while(token && re.test(token.type)); } while(token && re.test(token.type));
iterator.stepForward(); iterator.stepForward();
}
range.start.row = iterator.getCurrentTokenRow(); range.start.row = iterator.getCurrentTokenRow();
range.start.column = iterator.getCurrentTokenColumn() + 2; range.start.column = iterator.getCurrentTokenColumn() + 2;
iterator = new TokenIterator(this, row, column); iterator = new TokenIterator(this, row, column);
if (dir != -1) {
do { do {
token = iterator.stepForward(); token = iterator.stepForward();
} while(token && re.test(token.type)); } while(token && re.test(token.type));
token = iterator.stepBackward(); token = iterator.stepBackward();
} else
token = iterator.getCurrentToken();
range.end.row = iterator.getCurrentTokenRow(); range.end.row = iterator.getCurrentTokenRow();
range.end.column = iterator.getCurrentTokenColumn() + token.value.length; range.end.column = iterator.getCurrentTokenColumn() + token.value.length - 2;
return range; return range;
} }
}; };
@@ -638,7 +629,7 @@ function Folding() {
var range = this.getFoldWidgetRange(row); var range = this.getFoldWidgetRange(row);
// sometimes range can be incompatible with existing fold // sometimes range can be incompatible with existing fold
// wouldn't it be better for addFold to return null istead of throwing? // wouldn't it be better for addFold to return null istead of throwing?
if (range && range.end.row < endRow) try { if (range && range.end.row <= endRow) try {
this.addFold("...", range); this.addFold("...", range);
} catch(e) {} } catch(e) {}
} }
@@ -693,6 +684,7 @@ function Folding() {
}; };
this.onFoldWidgetClick = function(row, e) { this.onFoldWidgetClick = function(row, e) {
e = e.domEvent;
var type = this.getFoldWidget(row); var type = this.getFoldWidget(row);
var line = this.getLine(row); var line = this.getLine(row);
var onlySubfolds = e.shiftKey; var onlySubfolds = e.shiftKey;
@@ -731,7 +723,7 @@ function Folding() {
} else { } else {
if (addSubfolds) if (addSubfolds)
this.foldAll(row + 1, this.getLength()); this.foldAll(row + 1, this.getLength());
e.target.className += " invalid" (e.target || e.srcElement).className += " ace_invalid"
} }
}; };
@@ -1,38 +1,30 @@
/* ***** BEGIN LICENSE BLOCK ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Distributed under the BSD license:
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Fabian Jakobs <fabian AT ajax DOT org> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* Julian Viereck <julian DOT viereck AT gmail DOT com> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -69,6 +61,13 @@ function createFoldTestSession() {
return session; return session;
} }
function assertArray(a, b) {
assert.ok(a.length == b.length);
for (var i = 0; i < a.length; i++) {
assert.equal(a[i], b[i]);
}
}
module.exports = { module.exports = {
"test: find matching opening bracket in Text mode" : function() { "test: find matching opening bracket in Text mode" : function() {
@@ -808,13 +807,6 @@ module.exports = {
}, },
"test fold wrap data compution": function() { "test fold wrap data compution": function() {
function assertArray(a, b) {
assert.ok(a.length == b.length);
for (var i = 0; i < a.length; i++) {
assert.equal(a[i], b[i]);
}
}
function assertWrap(line0, line1, line2) { function assertWrap(line0, line1, line2) {
line0 && assertArray(wrapData[0], line0); line0 && assertArray(wrapData[0], line0);
line1 && assertArray(wrapData[1], line1); line1 && assertArray(wrapData[1], line1);
@@ -928,7 +920,7 @@ module.exports = {
tryAddFold("foo", new Range(0, 13, 0, 18), false); tryAddFold("foo", new Range(0, 13, 0, 18), false);
assert.equal(session.$foldData[0].folds.length, 1); assert.equal(session.$foldData[0].folds.length, 1);
tryAddFold("f", new Range(0, 13, 0, 18), true); tryAddFold("f", new Range(0, 13, 0, 18), false);
tryAddFold("foo", new Range(0, 18, 0, 21), false); tryAddFold("foo", new Range(0, 18, 0, 21), false);
assert.equal(session.$foldData[0].folds.length, 2); assert.equal(session.$foldData[0].folds.length, 2);
session.removeFold(fold); session.removeFold(fold);
@@ -971,6 +963,34 @@ module.exports = {
session.addFold("fold0", new Range(0, 1, 0, 5)); session.addFold("fold0", new Range(0, 1, 0, 5));
session.addFold("fold0", new Range(0, 6, 0, 8)); session.addFold("fold0", new Range(0, 6, 0, 8));
assert.equal(fold.subFolds.length, 2); assert.equal(fold.subFolds.length, 2);
},
"test row cache": function() {
var session = createFoldTestSession();
session.screenToDocumentPosition(2,3);
assertArray(session.$docRowCache, [1,3]);
assertArray(session.$screenRowCache, [1,2]);
session.screenToDocumentPosition(5,3);
assertArray(session.$docRowCache, [1,3,4]);
assertArray(session.$screenRowCache, [1,2,3]);
session.screenToDocumentPosition(0,3);
assertArray(session.$docRowCache, [1,3,4]);
assertArray(session.$screenRowCache, [1,2,3]);
session.screenToDocumentPosition(0,0);
assertArray(session.$docRowCache, [1,3,4]);
assertArray(session.$screenRowCache, [1,2,3]);
session.screenToDocumentPosition(1,0);
assertArray(session.$docRowCache, [1,3,4]);
assertArray(session.$screenRowCache, [1,2,3]);
session.$resetRowCache();
assertArray(session.$docRowCache, []);
assertArray(session.$screenRowCache, []);
} }
}; };
File diff suppressed because it is too large Load Diff
@@ -1,37 +1,30 @@
/* ***** BEGIN LICENSE BLOCK ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Distributed under the BSD license:
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Fabian Jakobs <fabian AT ajax DOT org> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -1,38 +1,30 @@
/* vim:ts=4:sts=4:sw=4: /* ***** BEGIN LICENSE BLOCK *****
* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license:
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Mihai Sucan. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Mihai Sucan <mihai.sucan@gmail.com> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -1,37 +1,30 @@
/* ***** BEGIN LICENSE BLOCK ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Distributed under the BSD license:
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Fabian Jakobs <fabian AT ajax DOT org> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -1,37 +1,30 @@
/* ***** BEGIN LICENSE BLOCK ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Distributed under the BSD license:
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Fabian Jakobs <fabian AT ajax DOT org> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -1,39 +1,30 @@
/* vim:ts=4:sts=4:sw=4: /* ***** BEGIN LICENSE BLOCK *****
* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license:
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Jan Jongboom <fabian AT ajax DOT org> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* Fabian Jakobs <fabian AT ajax DOT org> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -72,11 +63,10 @@ exports.render = function(input, mode, theme, lineStart, disableGutter) {
var length = session.getLength(); var length = session.getLength();
for(var ix = 0; ix < length; ix++) { for(var ix = 0; ix < length; ix++) {
var lineTokens = session.getTokens(ix);
stringBuilder.push("<div class='ace_line'>"); stringBuilder.push("<div class='ace_line'>");
if (!disableGutter) if (!disableGutter)
stringBuilder.push("<span class='ace_gutter ace_gutter-cell' unselectable='on'>" + (ix + lineStart) + "</span>"); stringBuilder.push("<span class='ace_gutter ace_gutter-cell' unselectable='on'>" + (ix + lineStart) + "</span>");
textLayer.$renderLine(stringBuilder, 0, lineTokens, true); textLayer.$renderLine(stringBuilder, ix, true, false);
stringBuilder.push("</div>"); stringBuilder.push("</div>");
} }
@@ -16,7 +16,8 @@ module.exports = {
"test simple snippet": function(next) { "test simple snippet": function(next) {
var theme = require("../theme/tomorrow"); var theme = require("../theme/tomorrow");
var snippet = "/** this is a function\n\ var snippet = "\
/** this is a function\n\
*\n\ *\n\
*/\n\ */\n\
function hello (a, b, c) {\n\ function hello (a, b, c) {\n\
@@ -24,23 +25,16 @@ function hello (a, b, c) {\n\
}"; }";
var mode = new JavaScriptMode(); var mode = new JavaScriptMode();
var isError = false, result; var result = highlighter.render(snippet, mode, theme);
try { assert.equal(result.html, "<div class='ace-tomorrow'> <div class='ace_editor ace_scroller ace_text-layer'> <div class='ace_line'><span class='ace_gutter ace_gutter-cell' unselectable='on'>1</span><span class='ace_comment ace_doc'>/**&#160;this&#160;is&#160;a&#160;function</span></div><div class='ace_line'><span class='ace_gutter ace_gutter-cell' unselectable='on'>2</span><span class='ace_comment ace_doc'>*</span></div><div class='ace_line'><span class='ace_gutter ace_gutter-cell' unselectable='on'>3</span><span class='ace_comment ace_doc'>*/</span></div><div class='ace_line'><span class='ace_gutter ace_gutter-cell' unselectable='on'>4</span><span class='ace_storage ace_type'>function</span>&#160;<span class='ace_entity ace_name ace_function'>hello</span>&#160;<span class='ace_paren ace_lparen'>(</span><span class='ace_variable ace_parameter'>a</span><span class='ace_punctuation ace_operator'>,&#160;</span><span class='ace_variable ace_parameter'>b</span><span class='ace_punctuation ace_operator'>,&#160;</span><span class='ace_variable ace_parameter'>c</span><span class='ace_paren ace_rparen'>)</span>&#160;<span class='ace_paren ace_lparen'>{</span></div><div class='ace_line'><span class='ace_gutter ace_gutter-cell' unselectable='on'>5</span>&#160;&#160;&#160;&#160;<span class='ace_storage ace_type'>console</span><span class='ace_punctuation ace_operator'>.</span><span class='ace_support ace_function ace_firebug'>log</span><span class='ace_paren ace_lparen'>(</span><span class='ace_identifier'>a</span>&#160;<span class='ace_keyword ace_operator'>*</span>&#160;<span class='ace_identifier'>b</span>&#160;<span class='ace_keyword ace_operator'>+</span>&#160;<span class='ace_identifier'>c</span>&#160;<span class='ace_keyword ace_operator'>+</span>&#160;<span class='ace_string'>'sup?'</span><span class='ace_paren ace_rparen'>)</span><span class='ace_punctuation ace_operator'>;</span></div><div class='ace_line'><span class='ace_gutter ace_gutter-cell' unselectable='on'>6</span><span class='ace_paren ace_rparen'>}</span></div> </div> </div>");
result = highlighter.render(snippet, mode, theme); assert.ok(!!result.css);
}
catch (e) {
console.log(e);
isError = true;
}
// todo: write something more meaningful
assert.equal(isError, false);
next(); next();
}, },
"test css from theme is used": function(next) { "test css from theme is used": function(next) {
var theme = require("../theme/tomorrow"); var theme = require("../theme/tomorrow");
var snippet = "/** this is a function\n\ var snippet = "\
/** this is a function\n\
*\n\ *\n\
*/\n\ */\n\
function hello (a, b, c) {\n\ function hello (a, b, c) {\n\
@@ -58,7 +52,8 @@ function hello (a, b, c) {\n\
"test theme classname should be in output html": function (next) { "test theme classname should be in output html": function (next) {
var theme = require("../theme/tomorrow"); var theme = require("../theme/tomorrow");
var snippet = "/** this is a function\n\ var snippet = "\
/** this is a function\n\
*\n\ *\n\
*/\n\ */\n\
function hello (a, b, c) {\n\ function hello (a, b, c) {\n\
@@ -1,39 +1,30 @@
/* ***** BEGIN LICENSE BLOCK ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Distributed under the BSD license:
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Mozilla Skywriter. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Mozilla. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2009 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Kevin Dangoor (kdangoor@mozilla.com) * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* Julian Viereck <julian.viereck@gmail.com> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Harutyun Amirjanyan [harutyun@c9.io]
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -45,7 +36,7 @@ var UA = require("../lib/useragent");
var net = require("../lib/net"); var net = require("../lib/net");
var ace = require("../ace"); var ace = require("../ace");
require("ace/theme/textmate"); require("../theme/textmate");
module.exports = exports = ace; module.exports = exports = ace;
@@ -193,7 +184,6 @@ exports.transformTextarea = function(element, loader) {
var settingOpener = document.createElement("div"); var settingOpener = document.createElement("div");
applyStyles(settingOpener, { applyStyles(settingOpener, {
position: "absolute", position: "absolute",
width: "15px",
right: "0px", right: "0px",
bottom: "0px", bottom: "0px",
background: "red", background: "red",
@@ -1,38 +1,30 @@
/* ***** BEGIN LICENSE BLOCK ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Distributed under the BSD license:
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Mozilla Skywriter. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Mozilla. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2009 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Julian Viereck (julian.viereck@gmail.com) * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* Harutyun Amirjanyan (harutyun@c9.io) * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -65,6 +57,7 @@ exports.handler.attach = function(editor) {
.emacs-mode .ace_cursor{\ .emacs-mode .ace_cursor{\
border: 2px rgba(50,250,50,0.8) solid!important;\ border: 2px rgba(50,250,50,0.8) solid!important;\
-moz-box-sizing: border-box!important;\ -moz-box-sizing: border-box!important;\
-webkit-box-sizing: border-box!important;\
box-sizing: border-box!important;\ box-sizing: border-box!important;\
background-color: rgba(0,250,0,0.9);\ background-color: rgba(0,250,0,0.9);\
opacity: 0.5;\ opacity: 0.5;\
@@ -73,7 +66,7 @@ exports.handler.attach = function(editor) {
opacity: 1;\ opacity: 1;\
background-color: transparent;\ background-color: transparent;\
}\ }\
.emacs-mode .ace_cursor.ace_overwrite {\ .emacs-mode .ace_overwrite-cursors .ace_cursor {\
opacity: 1;\ opacity: 1;\
background-color: transparent;\ background-color: transparent;\
border-width: 0 0 2px 2px !important;\ border-width: 0 0 2px 2px !important;\
@@ -220,7 +213,8 @@ exports.emacsKeys = {
"S-C-Home" : "selecttostart", "S-C-Home" : "selecttostart",
"S-C-End" : "selecttoend", "S-C-End" : "selecttoend",
"C-l|M-s" : "centerselection", "C-l" : "recenterTopBottom",
"M-s" : "centerselection",
"M-g": "gotoline", "M-g": "gotoline",
"C-x C-p": "selectall", "C-x C-p": "selectall",
@@ -278,6 +272,20 @@ exports.emacsKeys = {
exports.handler.bindKeys(exports.emacsKeys); exports.handler.bindKeys(exports.emacsKeys);
exports.handler.addCommands({ exports.handler.addCommands({
recenterTopBottom: function(editor) {
var renderer = editor.renderer;
var pos = renderer.$cursorLayer.getPixelPosition();
var h = renderer.$size.scrollerHeight - renderer.lineHeight;
var scrollTop = renderer.scrollTop;
if (Math.abs(pos.top - scrollTop) < 2) {
scrollTop = pos.top - h;
} else if (Math.abs(pos.top - scrollTop - h * 0.5) < 2) {
scrollTop = pos.top;
} else {
scrollTop = pos.top - h * 0.5;
}
editor.session.setScrollTop(scrollTop);
},
selectRectangularRegion: function(editor) { selectRectangularRegion: function(editor) {
editor.multiSelect.toggleBlockSelection(); editor.multiSelect.toggleBlockSelection();
}, },
@@ -331,7 +339,7 @@ exports.handler.addCommands({
}, },
killRegion: function(editor) { killRegion: function(editor) {
exports.killRing.add(editor.getCopyText()); exports.killRing.add(editor.getCopyText());
editor.cut(); editor.commands.byName.cut.exec(editor);
}, },
killRingSave: function(editor) { killRingSave: function(editor) {
exports.killRing.add(editor.getCopyText()); exports.killRing.add(editor.getCopyText());
@@ -1,38 +1,30 @@
/* ***** BEGIN LICENSE BLOCK ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Distributed under the BSD license:
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Mozilla Skywriter. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Mozilla. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2009 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Fabian Jakobs <fabian AT ajax DOT org> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* Julian Viereck (julian.viereck@gmail.com) * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -130,32 +122,33 @@ function HashHandler(config, platform) {
this.bindKey(key, command); this.bindKey(key, command);
}; };
// accepts keys in the form ctrl+Enter or ctrl-Enter
// keys without modifiers or shift only
this.parseKeys = function(keys) { this.parseKeys = function(keys) {
var key; var parts = keys.toLowerCase().split(/[\-\+]([\-\+])?/).filter(function(x){return x});
var key = parts.pop();
var keyCode = keyUtil[key];
if (keyUtil.FUNCTION_KEYS[keyCode])
key = keyUtil.FUNCTION_KEYS[keyCode].toLowerCase();
else if (!parts.length)
return {key: key, hashId: -1};
else if (parts.length == 1 && parts[0] == "shift")
return {key: key.toUpperCase(), hashId: -1};
var hashId = 0; var hashId = 0;
var parts = keys.toLowerCase().trim().split(/\s*\-\s*/); for (var i = parts.length; i--;) {
var modifier = keyUtil.KEY_MODS[parts[i]];
for (var i = 0, l = parts.length; i < l; i++) { if (modifier == null)
if (keyUtil.KEY_MODS[parts[i]]) throw "invalid modifier " + parts[i] + " in " + keys;
hashId = hashId | keyUtil.KEY_MODS[parts[i]]; hashId |= modifier;
else
key = parts[i] || "-"; //when empty, the splitSafe removed a '-'
} }
return {key: key, hashId: hashId};
if (parts[0] == "text" && parts.length == 2) {
hashId = -1;
key = parts[1];
}
return {
key: key,
hashId: hashId
};
}; };
this.findKeyCommand = function findKeyCommand(hashId, keyString) { this.findKeyCommand = function findKeyCommand(hashId, keyString) {
var ckbr = this.commmandKeyBinding; var ckbr = this.commmandKeyBinding;
return ckbr[hashId] && ckbr[hashId][keyString.toLowerCase()]; return ckbr[hashId] && ckbr[hashId][keyString];
}; };
this.handleKeyboard = function(data, hashId, keyString, keyCode) { this.handleKeyboard = function(data, hashId, keyString, keyCode) {
@@ -1,39 +1,30 @@
/* ***** BEGIN LICENSE BLOCK ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Distributed under the BSD license:
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Fabian Jakobs <fabian AT ajax DOT org> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* Julian Viereck <julian.viereck@gmail.com> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Harutyun Amirjanyan <amirjanyan@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -1,37 +1,30 @@
/* ***** BEGIN LICENSE BLOCK ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Distributed under the BSD license:
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Mozilla Skywriter. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Mozilla. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2009 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Julian Viereck (julian.viereck@gmail.com) * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -109,7 +102,7 @@ StateHandler.prototype = {
}; };
if (e) { if (e) {
bufferObj.keyIdentifier = e.keyIdentifier bufferObj.keyIdentifier = e.keyIdentifier;
} }
return bufferObj; return bufferObj;
@@ -1,39 +1,30 @@
/* vim:ts=4:sts=4:sw=4: /* ***** BEGIN LICENSE BLOCK *****
* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license:
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Fabian Jakobs <fabian AT ajax DOT org> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* Mihai Sucan <mihai DOT sucan AT gmail DOT com> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -46,6 +37,7 @@ var dom = require("../lib/dom");
var TextInput = function(parentNode, host) { var TextInput = function(parentNode, host) {
var text = dom.createElement("textarea"); var text = dom.createElement("textarea");
text.className = "ace_text-input";
/*/ debug /*/ debug
text.style.opacity = 1 text.style.opacity = 1
text.style.background = "rgba(0, 250, 0, 0.3)" text.style.background = "rgba(0, 250, 0, 0.3)"
@@ -55,71 +47,109 @@ var TextInput = function(parentNode, host) {
if (useragent.isTouchPad) if (useragent.isTouchPad)
text.setAttribute("x-palm-disable-auto-cap", true); text.setAttribute("x-palm-disable-auto-cap", true);
text.setAttribute("wrap", "off"); text.wrap = "off";
text.spellcheck = false;
text.style.top = "-2em"; text.style.top = "-2em";
parentNode.insertBefore(text, parentNode.firstChild); parentNode.insertBefore(text, parentNode.firstChild);
var PLACEHOLDER = useragent.isIE ? "\x01" : "\x01"; var PLACEHOLDER = useragent.isIE || useragent.isOpera ? "\x01\x01" : "\x00\x00";
sendText();
var inCompostion = false; resetValue();
if (isFocused())
host.onFocus();
// Somehow fixes problem with firing onpropertychange on first typed char
if (useragent.isOldIE) {
resetSelection();
resetValue();
setTimeout(resetSelection);
}
var cut = false
var copied = false; var copied = false;
var pasted = false; var pasted = false;
var inCompostion = false;
var resetTimeout = null;
var tempStyle = ''; var tempStyle = '';
function reset(full) { function resetValue() {
try {
if (full) {
text.value = PLACEHOLDER; text.value = PLACEHOLDER;
text.selectionStart = 0; //http://code.google.com/p/chromium/issues/detail?id=76516
text.selectionEnd = 1; if (useragent.isWebKit && !resetTimeout)
} else resetTimeout = setTimeout(function(){
text.select(); text.value = PLACEHOLDER;
} catch (e) {} resetSelection();
} resetTimeout = null;
});
function sendText(valueToSend) {
if (!copied) {
var value = valueToSend || text.value;
if (value) {
if (value.length > 1) {
if (value.charAt(0) == PLACEHOLDER)
value = value.substr(1);
else if (value.charAt(value.length - 1) == PLACEHOLDER)
value = value.slice(0, -1);
}
if (value && value != PLACEHOLDER) {
if (pasted)
host.onPaste(value);
else
host.onTextInput(value);
}
}
}
copied = false;
pasted = false;
// Safari doesn't fire copy events if no text is selected
reset(true);
}
var onTextInput = function(e) {
if (!inCompostion)
sendText(e.data);
setTimeout(function () {
if (!inCompostion)
reset(true);
}, 0);
}; };
var onPropertyChange = function(e) { function resetSelection(isEmpty) {
setTimeout(function() { var selectionStart = isEmpty ? 2 : 1;
if (!inCompostion) var selectionEnd = 2;
sendText(); // on firefox this throws if textarea is hidden
}, 0); try {
if (text.setSelectionRange) {
text.setSelectionRange(selectionStart, selectionEnd);
}
// IE8 does not support setSelectionRange
else if (text.createTextRange) {
var range = text.createTextRange();
range.collapse(true);
range.moveEnd('character', selectionEnd);
range.moveStart('character', selectionStart);
range.select();
}
} catch(e){}
};
var onSelect = function(e) {
if (cut) {
cut = false;
return;
}
if (copied) {
copied = false;
return;
}
if (text.selectionStart === 0 && text.selectionEnd === text.value.length) {
host.selectAll();
resetSelection();
}
};
var onInput = function(e) {
if (inCompostion)
return;
if (pasted) {
var data = text.value;
resetValue();
if (data)
host.onPaste(data);
pasted = false;
return;
}
var data = text.value;
if (data.substring(0, 2) == PLACEHOLDER)
data = data.substr(2);
else
data = data.substr(1);
resetValue();
if (data) {
// can happen if undo in textarea isn't stopped
if (data[data.length - 1] == PLACEHOLDER[0])
data = data.slice(0, -1);
if (data)
host.onTextInput(data);
} else
host.onDelete();
}; };
var onCompositionStart = function(e) { var onCompositionStart = function(e) {
@@ -138,93 +168,130 @@ var TextInput = function(parentNode, host) {
host.onCompositionEnd(); host.onCompositionEnd();
}; };
var onCopy = function(e) { var onCut = function(e) {
copied = true; var data = host.getCopyText();
var copyText = host.getCopyText(); if (!data) {
if(copyText) event.preventDefault(e);
text.value = copyText; return;
else }
e.preventDefault();
reset(); var clipboardData = e.clipboardData || window.clipboardData;
if (clipboardData) {
// Safari 5 has clipboardData object, but does not handle setData()
var supported = clipboardData.setData("Text", data);
if (supported) {
host.onCut();
event.preventDefault(e);
}
}
if (!supported) {
cut = true;
text.value = data;
text.select();
setTimeout(function(){ setTimeout(function(){
sendText(); cut = false;
}, 0); resetValue();
resetSelection();
host.onCut();
});
}
}; };
var onCut = function(e) { var onCopy = function(e) {
var data = host.getCopyText();
if (!data) {
event.preventDefault(e);
return;
}
var clipboardData = e.clipboardData || window.clipboardData;
if (clipboardData) {
// Safari 5 has clipboardData object, but does not handle setData()
var supported = clipboardData.setData("Text", data);
if (supported) {
host.onCopy();
event.preventDefault(e);
}
}
if (!supported) {
copied = true; copied = true;
var copyText = host.getCopyText(); text.value = data;
if(copyText) { text.select();
text.value = copyText;
host.onCut();
} else
e.preventDefault();
reset();
setTimeout(function(){ setTimeout(function(){
sendText(); copied = false;
}, 0); resetValue();
resetSelection();
host.onCopy();
});
}
};
var onPaste = function(e) {
var clipboardData = e.clipboardData || window.clipboardData;
if (clipboardData) {
var data = clipboardData.getData("Text");
if (data)
host.onPaste(data);
event.preventDefault(e);
}
else {
text.value = "";
pasted = true;
}
}; };
event.addCommandKeyListener(text, host.onCommandKey.bind(host)); event.addCommandKeyListener(text, host.onCommandKey.bind(host));
event.addListener(text, "input", useragent.isIE ? onPropertyChange : onTextInput);
event.addListener(text, "paste", function(e) { event.addListener(text, "select", onSelect);
// Mark that the next input text comes from past.
pasted = true;
// Some browsers support the event.clipboardData API. Use this to get
// the pasted content which increases speed if pasting a lot of lines.
if (e.clipboardData && e.clipboardData.getData) {
sendText(e.clipboardData.getData("text/plain"));
e.preventDefault();
}
else {
// If a browser doesn't support any of the things above, use the regular
// method to detect the pasted input.
onPropertyChange();
}
});
if ("onbeforecopy" in text && typeof clipboardData !== "undefined") { event.addListener(text, "input", onInput);
event.addListener(text, "beforecopy", function(e) {
if (tempStyle) event.addListener(text, "cut", onCut);
return; // without this text is copied when contextmenu is shown event.addListener(text, "copy", onCopy);
var copyText = host.getCopyText(); event.addListener(text, "paste", onPaste);
if (copyText)
clipboardData.setData("Text", copyText);
else // Opera has no clipboard events
e.preventDefault(); if (!('oncut' in text) || !('oncopy' in text) || !('onpaste' in text)){
});
event.addListener(parentNode, "keydown", function(e) {
if (e.ctrlKey && e.keyCode == 88) {
var copyText = host.getCopyText();
if (copyText) {
clipboardData.setData("Text", copyText);
host.onCut();
}
event.preventDefault(e);
}
});
event.addListener(text, "cut", onCut); // for ie9 context menu
}
else if (useragent.isOpera) {
event.addListener(parentNode, "keydown", function(e) { event.addListener(parentNode, "keydown", function(e) {
if ((useragent.isMac && !e.metaKey) || !e.ctrlKey) if ((useragent.isMac && !e.metaKey) || !e.ctrlKey)
return; return;
if ((e.keyCode == 88 || e.keyCode == 67)) { switch (e.keyCode) {
var copyText = host.getCopyText(); case 67:
if (copyText) { onCopy(e);
text.value = copyText; break;
text.select(); case 86:
if (e.keyCode == 88) onPaste(e);
host.onCut(); break;
} case 88:
onCut(e);
break;
} }
}); });
} }
else {
event.addListener(text, "copy", onCopy); if (useragent.isOldIE) {
event.addListener(text, "cut", onCut); event.addListener(text, "propertychange", function(e){
if (text.value != "" && text.value != PLACEHOLDER)
onInput(e);
});
var keytable = { 13:1, 27:1 };
event.addListener(text, "keyup", function (e) {
if (inCompostion && (!text.value || keytable[e.keyCode]))
setTimeout(onCompositionEnd, 0);
if ((text.value.charCodeAt(0)|0) < 129) {
return;
}
inCompostion ? onCompositionUpdate() : onCompositionStart();
});
} }
event.addListener(text, "compositionstart", onCompositionStart); event.addListener(text, "compositionstart", onCompositionStart);
@@ -242,11 +309,10 @@ var TextInput = function(parentNode, host) {
event.addListener(text, "focus", function() { event.addListener(text, "focus", function() {
host.onFocus(); host.onFocus();
reset(); resetSelection();
}); });
this.focus = function() { this.focus = function() {
reset();
text.focus(); text.focus();
}; };
@@ -268,11 +334,11 @@ var TextInput = function(parentNode, host) {
tempStyle = text.style.cssText; tempStyle = text.style.cssText;
text.style.cssText = text.style.cssText =
"position:fixed; z-index:100000;" + //"background:rgba(250, 0, 0, 0.3); opacity:1;" + "position:fixed; z-index:100000;" +
(useragent.isIE ? "background:rgba(0, 0, 0, 0.03); opacity:0.1;" : "") + //"background:rgba(250, 0, 0, 0.3); opacity:1;" +
"left:" + (e.clientX - 2) + "px; top:" + (e.clientY - 2) + "px;"; "left:" + (e.clientX - 2) + "px; top:" + (e.clientY - 2) + "px;";
if (host.selection.isEmpty()) resetSelection(host.selection.isEmpty());
text.value = "";
if (e.type != "mousedown") if (e.type != "mousedown")
return; return;
@@ -281,7 +347,7 @@ var TextInput = function(parentNode, host) {
host.renderer.$keepTextAreaAtCursor = null; host.renderer.$keepTextAreaAtCursor = null;
// on windows context menu is opened after mouseup // on windows context menu is opened after mouseup
if (useragent.isGecko && useragent.isWin) if (useragent.isWin)
event.capture(host.container, function(e) { event.capture(host.container, function(e) {
text.style.left = e.clientX - 2 + "px"; text.style.left = e.clientX - 2 + "px";
text.style.top = e.clientY - 2 + "px"; text.style.top = e.clientY - 2 + "px";
@@ -294,7 +360,6 @@ var TextInput = function(parentNode, host) {
text.style.cssText = tempStyle; text.style.cssText = tempStyle;
tempStyle = ''; tempStyle = '';
} }
sendText();
if (host.renderer.$keepTextAreaAtCursor == null) { if (host.renderer.$keepTextAreaAtCursor == null) {
host.renderer.$keepTextAreaAtCursor = true; host.renderer.$keepTextAreaAtCursor = true;
host.renderer.$moveTextAreaToCursor(); host.renderer.$moveTextAreaToCursor();
@@ -307,7 +372,7 @@ var TextInput = function(parentNode, host) {
if (!useragent.isGecko) if (!useragent.isGecko)
event.addListener(text, "contextmenu", function(e) { event.addListener(text, "contextmenu", function(e) {
host.textInput.onContextMenu(e); host.textInput.onContextMenu(e);
onContextMenuClose() onContextMenuClose();
}); });
}; };
@@ -1,48 +1,40 @@
/* ***** BEGIN LICENSE BLOCK ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Distributed under the BSD license:
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Sergi Mansilla <sergi AT c9 DOT io> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* Harutyun Amirjanyan <harutyun AT c9 DOT io> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) { define(function(require, exports, module) {
"use strict"; "use strict";
var keyUtil = require("../lib/keys");
var cmds = require("./vim/commands"); var cmds = require("./vim/commands");
var coreCommands = cmds.coreCommands; var coreCommands = cmds.coreCommands;
var util = require("./vim/maps/util"); var util = require("./vim/maps/util");
var useragent = require("../lib/useragent");
var startCommands = { var startCommands = {
"i": { "i": {
@@ -62,10 +54,32 @@ var startCommands = {
}, },
"ctrl-b": { "ctrl-b": {
command: "gotopageup" command: "gotopageup"
}, }
}; };
exports.handler = { exports.handler = {
// workaround for j not repeating with `defaults write -g ApplePressAndHoldEnabled -bool true`
handleMacRepeat: function(data, hashId, key) {
if (hashId == -1) {
// record key
data.inputChar = key;
data.lastEvent = "input";
} else if (data.inputChar && data.$lastHash == hashId && data.$lastKey == key) {
// check for repeated keypress
if (data.lastEvent == "input") {
data.lastEvent = "input1";
} else if (data.lastEvent == "input1") {
// simulate textinput
return true;
}
} else {
// reset
data.$lastHash = hashId;
data.$lastKey = key;
data.lastEvent = "keypress";
}
},
handleKeyboard: function(data, hashId, key, keyCode, e) { handleKeyboard: function(data, hashId, key, keyCode, e) {
// ignore command keys (shift, ctrl etc.) // ignore command keys (shift, ctrl etc.)
if (hashId != 0 && (key == "" || key == "\x00")) if (hashId != 0 && (key == "" || key == "\x00"))
@@ -74,25 +88,30 @@ exports.handler = {
if (hashId == 1) if (hashId == 1)
key = "ctrl-" + key; key = "ctrl-" + key;
if (data.state == "start") { if ((key == "esc" && hashId == 0) || key == "ctrl-[") {
return {command: coreCommands.stop};
} else if (data.state == "start") {
if (useragent.isMac && this.handleMacRepeat(data, hashId, key)) {
hashId = -1;
key = data.inputChar;
}
if (hashId == -1 || hashId == 1) { if (hashId == -1 || hashId == 1) {
if (cmds.inputBuffer.idle && startCommands[key]) if (cmds.inputBuffer.idle && startCommands[key])
return startCommands[key]; return startCommands[key];
return {
return { command: { command: {
exec: function(editor) {cmds.inputBuffer.push(editor, key);} exec: function(editor) {cmds.inputBuffer.push(editor, key);}
} }; }
} // wait for input };
else if (key.length == 1 && (hashId == 0 || hashId == 4)) { //no modifier || shift } // if no modifier || shift: wait for input.
else if (key.length == 1 && (hashId == 0 || hashId == 4)) {
return {command: "null", passEvent: true}; return {command: "null", passEvent: true};
} else if (key == "esc") { } else if (key == "esc" && hashId == 0) {
return {command: coreCommands.stop}; return {command: coreCommands.stop};
} }
} else { } else {
if (key == "esc" || key == "ctrl-[") { if (key == "ctrl-w") {
data.state = "start";
return {command: coreCommands.stop};
} else if (key == "ctrl-w") {
return {command: "removewordleft"}; return {command: "removewordleft"};
} }
} }
@@ -102,6 +121,7 @@ exports.handler = {
editor.on("click", exports.onCursorMove); editor.on("click", exports.onCursorMove);
if (util.currentMode !== "insert") if (util.currentMode !== "insert")
cmds.coreCommands.stop.exec(editor); cmds.coreCommands.stop.exec(editor);
editor.$vimModeHandler = this;
}, },
detach: function(editor) { detach: function(editor) {
@@ -110,7 +130,14 @@ exports.handler = {
util.currentMode = "normal"; util.currentMode = "normal";
}, },
actions: cmds.actions actions: cmds.actions,
getStatusText: function() {
if (util.currentMode == "insert")
return "INSERT";
if (util.onVisualMode)
return (util.onVisualLineMode ? "VISUAL LINE " : "VISUAL ") + cmds.inputBuffer.status;
return cmds.inputBuffer.status;
}
}; };
@@ -1,38 +1,30 @@
/* ***** BEGIN LICENSE BLOCK ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Distributed under the BSD license:
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Sergi Mansilla <sergi AT c9 DOT io> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* Harutyun Amirjanyan <harutyun AT c9 DOT io> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -82,13 +74,13 @@ var actions = exports.actions = {
fn: function(editor, range, count, param) { fn: function(editor, range, count, param) {
switch (param) { switch (param) {
case "z": case "z":
editor.alignCursor(null, 0.5); editor.renderer.alignCursor(null, 0.5);
break; break;
case "t": case "t":
editor.alignCursor(null, 0); editor.renderer.alignCursor(null, 0);
break; break;
case "b": case "b":
editor.alignCursor(null, 1); editor.renderer.alignCursor(null, 1);
break; break;
} }
} }
@@ -304,6 +296,7 @@ var inputBuffer = exports.inputBuffer = {
currentCmd: null, currentCmd: null,
//currentMode: 0, //currentMode: 0,
currentCount: "", currentCount: "",
status: "",
// Types // Types
operator: null, operator: null,
@@ -311,73 +304,84 @@ var inputBuffer = exports.inputBuffer = {
lastInsertCommands: [], lastInsertCommands: [],
push: function(editor, char, keyId) { push: function(editor, ch, keyId) {
this.idle = false; this.idle = false;
var wObj = this.waitingForParam; var wObj = this.waitingForParam;
if (wObj) { if (wObj) {
this.exec(editor, wObj, char); this.exec(editor, wObj, ch);
} }
// If input is a number (that doesn't start with 0) // If input is a number (that doesn't start with 0)
else if (!(char === "0" && !this.currentCount.length) && else if (!(ch === "0" && !this.currentCount.length) &&
(char.match(/^\d+$/) && this.isAccepting(NUMBER))) { (ch.match(/^\d+$/) && this.isAccepting(NUMBER))) {
// Assuming that char is always of type String, and not Number // Assuming that ch is always of type String, and not Number
this.currentCount += char; this.currentCount += ch;
this.currentCmd = NUMBER; this.currentCmd = NUMBER;
this.accepting = [NUMBER, OPERATOR, MOTION, ACTION]; this.accepting = [NUMBER, OPERATOR, MOTION, ACTION];
} }
else if (!this.operator && this.isAccepting(OPERATOR) && operators[char]) { else if (!this.operator && this.isAccepting(OPERATOR) && operators[ch]) {
this.operator = { this.operator = {
char: char, ch: ch,
count: this.getCount() count: this.getCount()
}; };
this.currentCmd = OPERATOR; this.currentCmd = OPERATOR;
this.accepting = [NUMBER, MOTION, ACTION]; this.accepting = [NUMBER, MOTION, ACTION];
this.exec(editor, { operator: this.operator }); this.exec(editor, { operator: this.operator });
} }
else if (motions[char] && this.isAccepting(MOTION)) { else if (motions[ch] && this.isAccepting(MOTION)) {
this.currentCmd = MOTION; this.currentCmd = MOTION;
var ctx = { var ctx = {
operator: this.operator, operator: this.operator,
motion: { motion: {
char: char, ch: ch,
count: this.getCount() count: this.getCount()
} }
}; };
if (motions[char].param) if (motions[ch].param)
this.waitForParam(ctx); this.waitForParam(ctx);
else else
this.exec(editor, ctx); this.exec(editor, ctx);
} }
else if (alias[char] && this.isAccepting(MOTION)) { else if (alias[ch] && this.isAccepting(MOTION)) {
alias[char].operator.count = this.getCount(); alias[ch].operator.count = this.getCount();
this.exec(editor, alias[char]); this.exec(editor, alias[ch]);
} }
else if (actions[char] && this.isAccepting(ACTION)) { else if (actions[ch] && this.isAccepting(ACTION)) {
var actionObj = { var actionObj = {
action: { action: {
fn: actions[char].fn, fn: actions[ch].fn,
count: this.getCount() count: this.getCount()
} }
}; };
if (actions[char].param) { if (actions[ch].param) {
this.waitForParam(actionObj); this.waitForParam(actionObj);
} }
else { else {
this.exec(editor, actionObj); this.exec(editor, actionObj);
} }
if (actions[char].acceptsMotion) if (actions[ch].acceptsMotion)
this.idle = false; this.idle = false;
} }
else if (this.operator) { else if (this.operator) {
this.exec(editor, { operator: this.operator }, char); this.exec(editor, { operator: this.operator }, ch);
} }
else { else {
this.reset(); this.reset();
} }
if (this.waitingForParam || this.motion || this.operator) {
this.status += ch;
} else if (this.currentCount) {
this.status = this.currentCount;
} else if (this.status) {
this.status = "";
} else {
return;
}
editor._emit("changeStatus");
}, },
waitForParam: function(cmd) { waitForParam: function(cmd) {
@@ -406,18 +410,18 @@ var inputBuffer = exports.inputBuffer = {
} }
if (o && !editor.selection.isEmpty()) { if (o && !editor.selection.isEmpty()) {
if (operators[o.char].selFn) { if (operators[o.ch].selFn) {
operators[o.char].selFn(editor, editor.getSelectionRange(), o.count, param); operators[o.ch].selFn(editor, editor.getSelectionRange(), o.count, param);
this.reset(); this.reset();
} }
return; return;
} }
// There is an operator, but no motion or action. We try to pass the // There is an operator, but no motion or action. We try to pass the
// current char to the operator to see if it responds to it (an example // current ch to the operator to see if it responds to it (an example
// of this is the 'dd' operator). // of this is the 'dd' operator).
else if (!m && !a && o && param) { else if (!m && !a && o && param) {
operators[o.char].fn(editor, null, o.count, param); operators[o.ch].fn(editor, null, o.count, param);
this.reset(); this.reset();
} }
else if (m) { else if (m) {
@@ -430,7 +434,7 @@ var inputBuffer = exports.inputBuffer = {
} }
}; };
var motionObj = motions[m.char]; var motionObj = motions[m.ch];
var selectable = motionObj.sel; var selectable = motionObj.sel;
if (!o) { if (!o) {
@@ -442,7 +446,7 @@ var inputBuffer = exports.inputBuffer = {
else if (selectable) { else if (selectable) {
repeat(function() { repeat(function() {
run(motionObj.sel); run(motionObj.sel);
operators[o.char].fn(editor, editor.getSelectionRange(), o.count, param); operators[o.ch].fn(editor, editor.getSelectionRange(), o.count, param);
}, o.count || 1); }, o.count || 1);
} }
this.reset(); this.reset();
@@ -462,6 +466,7 @@ var inputBuffer = exports.inputBuffer = {
this.operator = null; this.operator = null;
this.motion = null; this.motion = null;
this.currentCount = ""; this.currentCount = "";
this.status = "";
this.accepting = [NUMBER, OPERATOR, MOTION, ACTION]; this.accepting = [NUMBER, OPERATOR, MOTION, ACTION];
this.idle = true; this.idle = true;
this.waitingForParam = null; this.waitingForParam = null;
@@ -1,37 +1,30 @@
/* ***** BEGIN LICENSE BLOCK ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Distributed under the BSD license:
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Sergi Mansilla <sergi AT c9 DOT io> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -41,57 +34,57 @@ define(function(require, exports, module) {
module.exports = { module.exports = {
"x": { "x": {
operator: { operator: {
char: "d", ch: "d",
count: 1 count: 1
}, },
motion: { motion: {
char: "l", ch: "l",
count: 1 count: 1
} }
}, },
"X": { "X": {
operator: { operator: {
char: "d", ch: "d",
count: 1 count: 1
}, },
motion: { motion: {
char: "h", ch: "h",
count: 1 count: 1
} }
}, },
"D": { "D": {
operator: { operator: {
char: "d", ch: "d",
count: 1 count: 1
}, },
motion: { motion: {
char: "$", ch: "$",
count: 1 count: 1
} }
}, },
"C": { "C": {
operator: { operator: {
char: "c", ch: "c",
count: 1 count: 1
}, },
motion: { motion: {
char: "$", ch: "$",
count: 1 count: 1
} }
}, },
"s": { "s": {
operator: { operator: {
char: "c", ch: "c",
count: 1 count: 1
}, },
motion: { motion: {
char: "l", ch: "l",
count: 1 count: 1
} }
}, },
"S": { "S": {
operator: { operator: {
char: "c", ch: "c",
count: 1 count: 1
}, },
param: "c" param: "c"
@@ -1,44 +1,36 @@
/* ***** BEGIN LICENSE BLOCK ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Distributed under the BSD license:
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Sergi Mansilla <sergi AT c9 DOT io> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* Harutyun Amirjanyan <harutyun AT c9 DOT io> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
"use strict"
define(function(require, exports, module) { define(function(require, exports, module) {
"use strict";
var util = require("./util"); var util = require("./util");
@@ -50,42 +42,27 @@ var keepScrollPosition = function(editor, fn) {
editor.renderer.scrollToRow(editor.getCursorPosition().row - diff); editor.renderer.scrollToRow(editor.getCursorPosition().row - diff);
}; };
function Motion(getRange, type){ function Motion(m) {
if (type == 'extend') if (typeof m == "function") {
var extend = true; var getPos = m;
else m = this;
var reverse = type; } else {
var getPos = m.getPos;
this.nav = function(editor) { }
var r = getRange(editor); m.nav = function(editor, range, count, param) {
if (!r) var a = getPos(editor, range, count, param, false);
if (!a)
return; return;
if (!r.end)
var a = r;
else if (reverse)
var a = r.start;
else
var a = r.end;
editor.clearSelection(); editor.clearSelection();
editor.moveCursorTo(a.row, a.column); editor.moveCursorTo(a.row, a.column);
} };
this.sel = function(editor){ m.sel = function(editor, range, count, param) {
var r = getRange(editor); var a = getPos(editor, range, count, param, true);
if (!r) if (!a)
return; return;
if (extend)
return editor.selection.setSelectionRange(r);
if (!r.end)
var a = r;
else if (reverse)
var a = r.start;
else
var a = r.end;
editor.selection.selectTo(a.row, a.column); editor.selection.selectTo(a.row, a.column);
} };
return m;
} }
var nonWordRe = /[\s.\/\\()\"'-:,.;<>~!@#$%^&*|+=\[\]{}`~?]/; var nonWordRe = /[\s.\/\\()\"'-:,.;<>~!@#$%^&*|+=\[\]{}`~?]/;
@@ -98,20 +75,20 @@ var StringStream = function(editor, cursor) {
this.row = cursor.row; this.row = cursor.row;
this.col = cursor.column; this.col = cursor.column;
var line = editor.session.getLine(this.row); var line = editor.session.getLine(this.row);
var maxRow = editor.session.getLength() var maxRow = editor.session.getLength();
this.ch = line[this.col] || '\n' this.ch = line[this.col] || '\n';
this.skippedLines = 0; this.skippedLines = 0;
this.next = function() { this.next = function() {
this.ch = line[++this.col] || this.handleNewLine(1); this.ch = line[++this.col] || this.handleNewLine(1);
//this.debug() //this.debug()
return this.ch; return this.ch;
} };
this.prev = function() { this.prev = function() {
this.ch = line[--this.col] || this.handleNewLine(-1); this.ch = line[--this.col] || this.handleNewLine(-1);
//this.debug() //this.debug()
return this.ch; return this.ch;
} };
this.peek = function(dir) { this.peek = function(dir) {
var ch = line[this.col + dir]; var ch = line[this.col + dir];
if (ch) if (ch)
@@ -121,7 +98,7 @@ var StringStream = function(editor, cursor) {
if (this.col == line.length - 1) if (this.col == line.length - 1)
return '\n'; return '\n';
return editor.session.getLine(this.row + 1)[0] || '\n'; return editor.session.getLine(this.row + 1)[0] || '\n';
} };
this.handleNewLine = function(dir) { this.handleNewLine = function(dir) {
if (dir == 1){ if (dir == 1){
@@ -136,7 +113,7 @@ var StringStream = function(editor, cursor) {
return line[0] || '\n'; return line[0] || '\n';
} }
if (dir == -1) { if (dir == -1) {
if (this.row == 0) if (this.row === 0)
return ''; return '';
this.row --; this.row --;
line = editor.session.getLine(this.row); line = editor.session.getLine(this.row);
@@ -144,13 +121,13 @@ var StringStream = function(editor, cursor) {
this.skippedLines--; this.skippedLines--;
return '\n'; return '\n';
} }
} };
this.debug = function() { this.debug = function() {
console.log(line.substring(0, this.col)+'|'+this.ch+'\''+this.col+'\''+line.substr(this.col+1)); console.log(line.substring(0, this.col)+'|'+this.ch+'\''+this.col+'\''+line.substr(this.col+1));
} };
} };
var Search = require("ace/search").Search; var Search = require("../../../search").Search;
var search = new Search(); var search = new Search();
function find(editor, needle, dir) { function find(editor, needle, dir) {
@@ -159,7 +136,7 @@ function find(editor, needle, dir) {
return search.find(editor.session); return search.find(editor.session);
} }
var Range = require("ace/range").Range; var Range = require("../../../range").Range;
module.exports = { module.exports = {
"w": new Motion(function(editor) { "w": new Motion(function(editor) {
@@ -187,7 +164,7 @@ module.exports = {
else else
str.next(); str.next();
return {column: str.col, row: str.row} return {column: str.col, row: str.row};
}), }),
"b": new Motion(function(editor) { "b": new Motion(function(editor) {
var str = new StringStream(editor); var str = new StringStream(editor);
@@ -207,7 +184,7 @@ module.exports = {
return {column: str.col, row: str.row}; return {column: str.col, row: str.row};
}), }),
"B": new Motion(function(editor) { "B": new Motion(function(editor) {
var str = new StringStream(editor) var str = new StringStream(editor);
str.prev(); str.prev();
while(str.ch && !(!whiteRe.test(str.ch) && whiteRe.test(str.peek(-1))) && str.skippedLines > -2) while(str.ch && !(!whiteRe.test(str.ch) && whiteRe.test(str.peek(-1))) && str.skippedLines > -2)
str.prev(); str.prev();
@@ -216,7 +193,7 @@ module.exports = {
str.next(); str.next();
return {column: str.col, row: str.row}; return {column: str.col, row: str.row};
}, true), }),
"e": new Motion(function(editor) { "e": new Motion(function(editor) {
var str = new StringStream(editor); var str = new StringStream(editor);
@@ -270,6 +247,40 @@ module.exports = {
editor.selection.selectLeft(); editor.selection.selectLeft();
} }
}, },
"H": {
nav: function(editor) {
var row = editor.renderer.getScrollTopRow();
editor.moveCursorTo(row);
},
sel: function(editor) {
var row = editor.renderer.getScrollTopRow();
editor.selection.selectTo(row);
}
},
"M": {
nav: function(editor) {
var topRow = editor.renderer.getScrollTopRow();
var bottomRow = editor.renderer.getScrollBottomRow();
var row = topRow + ((bottomRow - topRow) / 2);
editor.moveCursorTo(row);
},
sel: function(editor) {
var topRow = editor.renderer.getScrollTopRow();
var bottomRow = editor.renderer.getScrollBottomRow();
var row = topRow + ((bottomRow - topRow) / 2);
editor.selection.selectTo(row);
}
},
"L": {
nav: function(editor) {
var row = editor.renderer.getScrollBottomRow();
editor.moveCursorTo(row);
},
sel: function(editor) {
var row = editor.renderer.getScrollBottomRow();
editor.selection.selectTo(row);
}
},
"k": { "k": {
nav: function(editor) { nav: function(editor) {
editor.navigateUp(); editor.navigateUp();
@@ -363,99 +374,58 @@ module.exports = {
} }
}, },
"f": { "f": new Motion({
param: true, param: true,
handlesCount: true, handlesCount: true,
nav: function(editor, range, count, param) { getPos: function(editor, range, count, param, isSel) {
var ed = editor; var cursor = editor.getCursorPosition();
var cursor = ed.getCursorPosition();
var column = util.getRightNthChar(editor, cursor, param, count || 1); var column = util.getRightNthChar(editor, cursor, param, count || 1);
if (typeof column === "number") { if (typeof column === "number") {
ed.selection.clearSelection(); // Why does it select in the first place? cursor.column += column + (isSel ? 2 : 1);
ed.moveCursorTo(cursor.row, column + cursor.column + 1); return cursor;
}
},
sel: function(editor, range, count, param) {
var ed = editor;
var cursor = ed.getCursorPosition();
var column = util.getRightNthChar(editor, cursor, param, count || 1);
if (typeof column === "number") {
ed.moveCursorTo(cursor.row, column + cursor.column + 1);
} }
} }
}, }),
"F": { "F": new Motion({
param: true, param: true,
handlesCount: true, handlesCount: true,
nav: function(editor, range, count, param) { getPos: function(editor, range, count, param, isSel) {
count = parseInt(count, 10) || 1; var cursor = editor.getCursorPosition();
var ed = editor;
var cursor = ed.getCursorPosition();
var column = util.getLeftNthChar(editor, cursor, param, count);
if (typeof column === "number") {
ed.selection.clearSelection(); // Why does it select in the first place?
ed.moveCursorTo(cursor.row, cursor.column - column - 1);
}
},
sel: function(editor, range, count, param) {
var ed = editor;
var cursor = ed.getCursorPosition();
var column = util.getLeftNthChar(editor, cursor, param, count || 1); var column = util.getLeftNthChar(editor, cursor, param, count || 1);
if (typeof column === "number") { if (typeof column === "number") {
ed.moveCursorTo(cursor.row, cursor.column - column - 1); cursor.column -= column + 1;
return cursor;
} }
} }
}, }),
"t": { "t": new Motion({
param: true, param: true,
handlesCount: true, handlesCount: true,
nav: function(editor, range, count, param) { getPos: function(editor, range, count, param, isSel) {
var ed = editor; var cursor = editor.getCursorPosition();
var cursor = ed.getCursorPosition();
var column = util.getRightNthChar(editor, cursor, param, count || 1); var column = util.getRightNthChar(editor, cursor, param, count || 1);
if (typeof column === "number") { if (typeof column === "number") {
ed.selection.clearSelection(); // Why does it select in the first place? cursor.column += column + (isSel ? 1 : 0);
ed.moveCursorTo(cursor.row, column + cursor.column); return cursor;
}
},
sel: function(editor, range, count, param) {
var ed = editor;
var cursor = ed.getCursorPosition();
var column = util.getRightNthChar(editor, cursor, param, count || 1);
if (typeof column === "number") {
ed.moveCursorTo(cursor.row, column + cursor.column);
} }
} }
}, }),
"T": { "T": new Motion({
param: true, param: true,
handlesCount: true, handlesCount: true,
nav: function(editor, range, count, param) { getPos: function(editor, range, count, param, isSel) {
var ed = editor; var cursor = editor.getCursorPosition();
var cursor = ed.getCursorPosition();
var column = util.getLeftNthChar(editor, cursor, param, count || 1); var column = util.getLeftNthChar(editor, cursor, param, count || 1);
if (typeof column === "number") { if (typeof column === "number") {
ed.selection.clearSelection(); // Why does it select in the first place? cursor.column -= column;
ed.moveCursorTo(cursor.row, -column + cursor.column); return cursor;
}
},
sel: function(editor, range, count, param) {
var ed = editor;
var cursor = ed.getCursorPosition();
var column = util.getLeftNthChar(editor, cursor, param, count || 1);
if (typeof column === "number") {
ed.moveCursorTo(cursor.row, -column + cursor.column);
} }
} }
}, }),
"^": { "^": {
nav: function(editor) { nav: function(editor) {
@@ -473,16 +443,9 @@ module.exports = {
editor.selection.selectLineEnd(); editor.selection.selectLineEnd();
} }
}, },
"0": { "0": new Motion(function(ed) {
nav: function(editor) { return {row: ed.selection.lead.row, column: 0};
var ed = editor; }),
ed.navigateTo(ed.selection.selectionLead.row, 0);
},
sel: function(editor) {
var ed = editor;
ed.selectTo(ed.selection.selectionLead.row, 0);
}
},
"G": { "G": {
nav: function(editor, range, count, param) { nav: function(editor, range, count, param) {
if (!count && count !== 0) { // Stupid JS if (!count && count !== 0) { // Stupid JS
@@ -580,6 +543,25 @@ module.exports = {
return match; return match;
}), }),
"{": new Motion(function(ed) {
var session = ed.session;
var row = session.selection.lead.row;
while(row > 0 && !/\S/.test(session.getLine(row)))
row--;
while(/\S/.test(session.getLine(row)))
row--;
return {column: 0, row: row};
}),
"}": new Motion(function(ed) {
var session = ed.session;
var l = session.getLength();
var row = session.selection.lead.row;
while(row < l && !/\S/.test(session.getLine(row)))
row++;
while(/\S/.test(session.getLine(row)))
row++;
return {column: 0, row: row};
}),
"ctrl-d": { "ctrl-d": {
nav: function(editor, range, count, param) { nav: function(editor, range, count, param) {
editor.selection.clearSelection(); editor.selection.clearSelection();
@@ -598,7 +580,7 @@ module.exports = {
sel: function(editor, range, count, param) { sel: function(editor, range, count, param) {
keepScrollPosition(editor, editor.selectPageUp); keepScrollPosition(editor, editor.selectPageUp);
} }
}, }
}; };
module.exports.backspace = module.exports.left = module.exports.h; module.exports.backspace = module.exports.left = module.exports.h;
@@ -1,37 +1,30 @@
/* ***** BEGIN LICENSE BLOCK ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Distributed under the BSD license:
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Sergi Mansilla <sergi AT c9 DOT io> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -63,6 +56,16 @@ module.exports = {
editor.selection.selectLine(); editor.selection.selectLine();
registers._default.text += editor.getCopyText(); registers._default.text += editor.getCopyText();
var selRange = editor.getSelectionRange(); var selRange = editor.getSelectionRange();
// check if end of the document was reached
if (!selRange.isMultiLine()) {
lastLineReached = true
var row = selRange.start.row - 1;
var col = editor.session.getLine(row).length
selRange.setStart(row, col);
editor.session.remove(selRange);
editor.selection.clearSelection();
break;
}
editor.session.remove(selRange); editor.session.remove(selRange);
editor.selection.clearSelection(); editor.selection.clearSelection();
} }
@@ -22,7 +22,7 @@ module.exports = {
editor.unsetStyle('insert-mode'); editor.unsetStyle('insert-mode');
editor.unsetStyle('normal-mode'); editor.unsetStyle('normal-mode');
if (editor.commands.recording) if (editor.commands.recording)
editor.commands.toggleRecording(); editor.commands.toggleRecording(editor);
editor.setOverwrite(false); editor.setOverwrite(false);
}, },
insertMode: function(editor) { insertMode: function(editor) {
@@ -43,10 +43,10 @@ module.exports = {
this.onInsertReplaySequence = null; this.onInsertReplaySequence = null;
this.normalMode(editor); this.normalMode(editor);
} else { } else {
editor._emit("vimMode", "insert"); editor._emit("changeStatus");
// Record any movements, insertions in insert mode // Record any movements, insertions in insert mode
if(!editor.commands.recording) if(!editor.commands.recording)
editor.commands.toggleRecording(); editor.commands.toggleRecording(editor);
} }
}, },
normalMode: function(editor) { normalMode: function(editor) {
@@ -69,10 +69,10 @@ module.exports = {
editor.keyBinding.$data.state = "start"; editor.keyBinding.$data.state = "start";
this.onVisualMode = false; this.onVisualMode = false;
this.onVisualLineMode = false; this.onVisualLineMode = false;
editor._emit("changeVimMode", "normal"); editor._emit("changeStatus");
// Save recorded keystrokes // Save recorded keystrokes
if (editor.commands.recording) { if (editor.commands.recording) {
editor.commands.toggleRecording(); editor.commands.toggleRecording(editor);
return editor.commands.macro; return editor.commands.macro;
} }
else { else {
@@ -91,7 +91,7 @@ module.exports = {
editor.setStyle('insert-mode'); editor.setStyle('insert-mode');
editor.unsetStyle('normal-mode'); editor.unsetStyle('normal-mode');
editor._emit("changeVimMode", "visual"); editor._emit("changeStatus");
if (lineMode) { if (lineMode) {
this.onVisualLineMode = true; this.onVisualLineMode = true;
} else { } else {
@@ -99,24 +99,24 @@ module.exports = {
this.onVisualLineMode = false; this.onVisualLineMode = false;
} }
}, },
getRightNthChar: function(editor, cursor, char, n) { getRightNthChar: function(editor, cursor, ch, n) {
var line = editor.getSession().getLine(cursor.row); var line = editor.getSession().getLine(cursor.row);
var matches = line.substr(cursor.column + 1).split(char); var matches = line.substr(cursor.column + 1).split(ch);
return n < matches.length ? matches.slice(0, n).join(char).length : null; return n < matches.length ? matches.slice(0, n).join(ch).length : null;
}, },
getLeftNthChar: function(editor, cursor, char, n) { getLeftNthChar: function(editor, cursor, ch, n) {
var line = editor.getSession().getLine(cursor.row); var line = editor.getSession().getLine(cursor.row);
var matches = line.substr(0, cursor.column).split(char); var matches = line.substr(0, cursor.column).split(ch);
return n < matches.length ? matches.slice(-1 * n).join(char).length : null; return n < matches.length ? matches.slice(-1 * n).join(ch).length : null;
}, },
toRealChar: function(char) { toRealChar: function(ch) {
if (char.length === 1) if (ch.length === 1)
return char; return ch;
if (/^shift-./.test(char)) if (/^shift-./.test(ch))
return char[char.length - 1].toUpperCase(); return ch[ch.length - 1].toUpperCase();
else else
return ""; return "";
}, },
@@ -1,37 +1,30 @@
/* ***** BEGIN LICENSE BLOCK ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Distributed under the BSD license:
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Sergi Mansilla <sergi AT c9 DOT io> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -1,39 +1,30 @@
/* vim:ts=4:sts=4:sw=4: /* ***** BEGIN LICENSE BLOCK *****
* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license:
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Fabian Jakobs <fabian AT ajax DOT org> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* Julian Viereck <julian.viereck@gmail.com> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -48,9 +39,13 @@ var Cursor = function(parentEl) {
parentEl.appendChild(this.element); parentEl.appendChild(this.element);
this.isVisible = false; this.isVisible = false;
this.isBlinking = true;
this.blinkInterval = 1000;
this.smoothBlinking = false;
this.cursors = []; this.cursors = [];
this.cursor = this.addCursor(); this.cursor = this.addCursor();
dom.addCssClass(this.element, "ace_hidden-cursors");
}; };
(function() { (function() {
@@ -64,15 +59,34 @@ var Cursor = function(parentEl) {
this.session = session; this.session = session;
}; };
this.setBlinking = function(blinking) {
if (blinking != this.isBlinking){
this.isBlinking = blinking;
this.restartTimer();
}
};
this.setBlinkInterval = function(blinkInterval) {
if (blinkInterval != this.blinkInterval){
this.blinkInterval = blinkInterval;
this.restartTimer();
}
};
this.setSmoothBlinking = function(smoothBlinking) {
if (smoothBlinking != this.smoothBlinking) {
this.smoothBlinking = smoothBlinking;
if (smoothBlinking)
dom.addCssClass(this.element, "ace_smooth-blinking");
else
dom.removeCssClass(this.element, "ace_smooth-blinking");
this.restartTimer();
}
};
this.addCursor = function() { this.addCursor = function() {
var el = dom.createElement("div"); var el = dom.createElement("div");
var className = "ace_cursor"; el.className = "ace_cursor";
if (!this.isVisible)
className += " ace_hidden";
if (this.overwrite)
className += " ace_overwrite";
el.className = className;
this.element.appendChild(el); this.element.appendChild(el);
this.cursors.push(el); this.cursors.push(el);
return el; return el;
@@ -88,66 +102,80 @@ var Cursor = function(parentEl) {
this.hideCursor = function() { this.hideCursor = function() {
this.isVisible = false; this.isVisible = false;
for (var i = this.cursors.length; i--; ) dom.addCssClass(this.element, "ace_hidden-cursors");
dom.addCssClass(this.cursors[i], "ace_hidden"); this.restartTimer();
clearInterval(this.blinkId);
}; };
this.showCursor = function() { this.showCursor = function() {
this.isVisible = true; this.isVisible = true;
for (var i = this.cursors.length; i--; ) dom.removeCssClass(this.element, "ace_hidden-cursors");
dom.removeCssClass(this.cursors[i], "ace_hidden");
this.element.style.visibility = "";
this.restartTimer(); this.restartTimer();
}; };
this.restartTimer = function() { this.restartTimer = function() {
clearInterval(this.blinkId); clearInterval(this.intervalId);
if (!this.isVisible) clearTimeout(this.timeoutId);
if (this.smoothBlinking)
dom.removeCssClass(this.element, "ace_smooth-blinking");
for (var i = this.cursors.length; i--; )
this.cursors[i].style.opacity = "";
if (!this.isBlinking || !this.blinkInterval || !this.isVisible)
return; return;
var element = this.cursors.length == 1 ? this.cursor : this.element; if (this.smoothBlinking)
this.blinkId = setInterval(function() {
element.style.visibility = "hidden";
setTimeout(function(){ setTimeout(function(){
element.style.visibility = ""; dom.addCssClass(this.element, "ace_smooth-blinking");
}, 400); }.bind(this));
}, 1000);
var blink = function(){
this.timeoutId = setTimeout(function() {
for (var i = this.cursors.length; i--; ) {
this.cursors[i].style.opacity = 0;
}
}.bind(this), 0.6 * this.blinkInterval);
}.bind(this);
this.intervalId = setInterval(function() {
for (var i = this.cursors.length; i--; ) {
this.cursors[i].style.opacity = "";
}
blink();
}.bind(this), this.blinkInterval);
blink();
}; };
this.getPixelPosition = function(position, onScreen) { this.getPixelPosition = function(position, onScreen) {
if (!this.config || !this.session) { if (!this.config || !this.session)
return { return {left : 0, top : 0};
left : 0,
top : 0
};
}
if (!position) if (!position)
position = this.session.selection.getCursor(); position = this.session.selection.getCursor();
var pos = this.session.documentToScreenPosition(position); var pos = this.session.documentToScreenPosition(position);
var cursorLeft = Math.round(this.$padding + var cursorLeft = this.$padding + pos.column * this.config.characterWidth;
pos.column * this.config.characterWidth);
var cursorTop = (pos.row - (onScreen ? this.config.firstRowScreen : 0)) * var cursorTop = (pos.row - (onScreen ? this.config.firstRowScreen : 0)) *
this.config.lineHeight; this.config.lineHeight;
return { return {left : cursorLeft, top : cursorTop};
left : cursorLeft,
top : cursorTop
};
}; };
this.update = function(config) { this.update = function(config) {
this.config = config; this.config = config;
if (this.session.selectionMarkerCount > 0) {
var selections = this.session.$selectionMarkers; var selections = this.session.$selectionMarkers;
var i = 0, sel, cursorIndex = 0; var i = 0, cursorIndex = 0;
if (selections === undefined || selections.length === 0){
selections = [{cursor: null}];
}
for (var i = selections.length; i--; ) { for (var i = selections.length; i--; ) {
sel = selections[i]; var pixelPos = this.getPixelPosition(selections[i].cursor, true);
var pixelPos = this.getPixelPosition(sel.cursor, true); if ((pixelPos.top > config.height + config.offset ||
pixelPos.top < -config.offset) && i > 1) {
continue;
}
var style = (this.cursors[cursorIndex++] || this.addCursor()).style; var style = (this.cursors[cursorIndex++] || this.addCursor()).style;
@@ -156,44 +184,31 @@ var Cursor = function(parentEl) {
style.width = config.characterWidth + "px"; style.width = config.characterWidth + "px";
style.height = config.lineHeight + "px"; style.height = config.lineHeight + "px";
} }
if (cursorIndex > 1)
while (this.cursors.length > cursorIndex) while (this.cursors.length > cursorIndex)
this.removeCursor(); this.removeCursor();
} else {
var pixelPos = this.getPixelPosition(null, true);
var style = this.cursor.style;
style.left = pixelPos.left + "px";
style.top = pixelPos.top + "px";
style.width = config.characterWidth + "px";
style.height = config.lineHeight + "px";
while (this.cursors.length > 1)
this.removeCursor();
}
var overwrite = this.session.getOverwrite(); var overwrite = this.session.getOverwrite();
if (overwrite != this.overwrite) this.$setOverwrite(overwrite);
this.$setOverite(overwrite);
// cache for textarea and gutter highlight // cache for textarea and gutter highlight
this.$pixelPos = pixelPos; this.$pixelPos = pixelPos;
this.restartTimer(); this.restartTimer();
}; };
this.$setOverite = function(overwrite) { this.$setOverwrite = function(overwrite) {
if (overwrite != this.overwrite) {
this.overwrite = overwrite; this.overwrite = overwrite;
for (var i = this.cursors.length; i--; ) {
if (overwrite) if (overwrite)
dom.addCssClass(this.cursors[i], "ace_overwrite"); dom.addCssClass(this.element, "ace_overwrite-cursors");
else else
dom.removeCssClass(this.cursors[i], "ace_overwrite"); dom.removeCssClass(this.element, "ace_overwrite-cursors");
} }
}; };
this.destroy = function() { this.destroy = function() {
clearInterval(this.blinkId); clearInterval(this.intervalId);
} clearTimeout(this.timeoutId);
};
}).call(Cursor.prototype); }).call(Cursor.prototype);
@@ -1,39 +1,30 @@
/* vim:ts=4:sts=4:sw=4: /* ***** BEGIN LICENSE BLOCK *****
* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license:
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Fabian Jakobs <fabian AT ajax DOT org> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* Julian Viereck <julian DOT viereck AT gmail DOT com> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -42,6 +33,7 @@ define(function(require, exports, module) {
var dom = require("../lib/dom"); var dom = require("../lib/dom");
var oop = require("../lib/oop"); var oop = require("../lib/oop");
var lang = require("../lib/lang");
var EventEmitter = require("../lib/event_emitter").EventEmitter; var EventEmitter = require("../lib/event_emitter").EventEmitter;
var Gutter = function(parentEl) { var Gutter = function(parentEl) {
@@ -52,9 +44,8 @@ var Gutter = function(parentEl) {
this.gutterWidth = 0; this.gutterWidth = 0;
this.$breakpoints = [];
this.$annotations = []; this.$annotations = [];
this.$decorations = []; this.$updateAnnotations = this.$updateAnnotations.bind(this);
}; };
(function() { (function() {
@@ -62,35 +53,41 @@ var Gutter = function(parentEl) {
oop.implement(this, EventEmitter); oop.implement(this, EventEmitter);
this.setSession = function(session) { this.setSession = function(session) {
if (this.session)
this.session.removeEventListener("change", this.$updateAnnotations);
this.session = session; this.session = session;
session.on("change", this.$updateAnnotations);
}; };
this.addGutterDecoration = function(row, className){ this.addGutterDecoration = function(row, className){
if (!this.$decorations[row]) if (window.console)
this.$decorations[row] = ""; console.warn && console.warn("deprecated use session.addGutterDecoration");
this.$decorations[row] += " " + className; this.session.addGutterDecoration(row, className);
}; };
this.removeGutterDecoration = function(row, className){ this.removeGutterDecoration = function(row, className){
this.$decorations[row] = (this.$decorations[row] || "").replace(" " + className, ""); if (window.console)
console.warn && console.warn("deprecated use session.removeGutterDecoration");
this.session.removeGutterDecoration(row, className);
}; };
this.setAnnotations = function(annotations) { this.setAnnotations = function(annotations) {
// iterate over sparse array // iterate over sparse array
this.$annotations = []; this.$annotations = []
for (var row in annotations) if (annotations.hasOwnProperty(row)) { var rowInfo, row;
var rowAnnotations = annotations[row]; for (var i = 0; i < annotations.length; i++) {
if (!rowAnnotations) var annotation = annotations[i];
continue; var row = annotation.row;
var rowInfo = this.$annotations[row];
if (!rowInfo)
rowInfo = this.$annotations[row] = {text: []};
var annoText = annotation.text;
annoText = annoText ? lang.escapeHTML(annoText) : annotation.html || "";
var rowInfo = this.$annotations[row] = {
text: []
};
for (var i=0; i<rowAnnotations.length; i++) {
var annotation = rowAnnotations[i];
var annoText = annotation.text.replace(/"/g, "&quot;").replace(/'/g, "&#8217;").replace(/</, "&lt;");
if (rowInfo.text.indexOf(annoText) === -1) if (rowInfo.text.indexOf(annoText) === -1)
rowInfo.text.push(annoText); rowInfo.text.push(annoText);
var type = annotation.type; var type = annotation.type;
if (type == "error") if (type == "error")
rowInfo.className = " ace_error"; rowInfo.className = " ace_error";
@@ -99,13 +96,28 @@ var Gutter = function(parentEl) {
else if (type == "info" && (!rowInfo.className)) else if (type == "info" && (!rowInfo.className))
rowInfo.className = " ace_info"; rowInfo.className = " ace_info";
} }
};
this.$updateAnnotations = function (e) {
if (!this.$annotations.length)
return;
var delta = e.data;
var range = delta.range;
var firstRow = range.start.row;
var len = range.end.row - firstRow;
if (len === 0) {
// do nothing
} else if (delta.action == "removeText" || delta.action == "removeLines") {
this.$annotations.splice(firstRow, len + 1, null);
} else {
var args = Array(len + 1);
args.unshift(firstRow, 1);
this.$annotations.splice.apply(this.$annotations, args);
} }
}; };
this.update = function(config) { this.update = function(config) {
this.$config = config; var emptyAnno = {className: ""};
var emptyAnno = {className: "", text: []};
var html = []; var html = [];
var i = config.firstRow; var i = config.firstRow;
var lastRow = config.lastRow; var lastRow = config.lastRow;
@@ -113,6 +125,8 @@ var Gutter = function(parentEl) {
var foldStart = fold ? fold.start.row : Infinity; var foldStart = fold ? fold.start.row : Infinity;
var foldWidgets = this.$showFoldWidgets && this.session.foldWidgets; var foldWidgets = this.$showFoldWidgets && this.session.foldWidgets;
var breakpoints = this.session.$breakpoints; var breakpoints = this.session.$breakpoints;
var decorations = this.session.$decorations;
var lastLineNumber = 0;
while (true) { while (true) {
if(i > foldStart) { if(i > foldStart) {
@@ -124,12 +138,12 @@ var Gutter = function(parentEl) {
break; break;
var annotation = this.$annotations[i] || emptyAnno; var annotation = this.$annotations[i] || emptyAnno;
html.push("<div class='ace_gutter-cell", html.push(
this.$decorations[i] || "", "<div class='ace_gutter-cell ",
breakpoints[i] ? " ace_breakpoint " : " ", breakpoints[i] || "", decorations[i] || "", annotation.className,
annotation.className, "' style='height:", this.session.getRowLength(i) * config.lineHeight, "px;'>",
"' title='", annotation.text.join("\n"), lastLineNumber = i + 1
"' style='height:", this.session.getRowLength(i) * config.lineHeight, "px;'>", (i+1)); );
if (foldWidgets) { if (foldWidgets) {
var c = foldWidgets[i]; var c = foldWidgets[i];
@@ -138,8 +152,9 @@ var Gutter = function(parentEl) {
c = foldWidgets[i] = this.session.getFoldWidget(i); c = foldWidgets[i] = this.session.getFoldWidget(i);
if (c) if (c)
html.push( html.push(
"<span class='ace_fold-widget ", c, "<span class='ace_fold-widget ace_", c,
c == "start" && i == foldStart && i < fold.end.row ? " closed" : " open", c == "start" && i == foldStart && i < fold.end.row ? " ace_closed" : " ace_open",
"' style='height:", config.lineHeight, "px",
"'></span>" "'></span>"
); );
} }
@@ -149,19 +164,18 @@ var Gutter = function(parentEl) {
i++; i++;
} }
if (this.session.$useWrapMode)
html.push(
"<div class='ace_gutter-cell' style='pointer-events:none;opacity:0'>",
this.session.getLength() - 1,
"</div>"
);
this.element = dom.setInnerHtml(this.element, html.join("")); this.element = dom.setInnerHtml(this.element, html.join(""));
this.element.style.height = config.minHeight + "px"; this.element.style.height = config.minHeight + "px";
var gutterWidth = this.element.offsetWidth; if (this.session.$useWrapMode)
lastLineNumber = this.session.getLength();
var gutterWidth = ("" + lastLineNumber).length * config.characterWidth;
var padding = this.$padding || this.$computePadding();
gutterWidth += padding.left + padding.right;
if (gutterWidth !== this.gutterWidth) { if (gutterWidth !== this.gutterWidth) {
this.gutterWidth = gutterWidth; this.gutterWidth = gutterWidth;
this.element.style.width = Math.ceil(this.gutterWidth) + "px";
this._emit("changeGutterWidth", gutterWidth); this._emit("changeGutterWidth", gutterWidth);
} }
}; };
@@ -174,12 +188,32 @@ var Gutter = function(parentEl) {
dom.removeCssClass(this.element, "ace_folding-enabled"); dom.removeCssClass(this.element, "ace_folding-enabled");
this.$showFoldWidgets = show; this.$showFoldWidgets = show;
this.$padding = null;
}; };
this.getShowFoldWidgets = function() { this.getShowFoldWidgets = function() {
return this.$showFoldWidgets; return this.$showFoldWidgets;
}; };
this.$computePadding = function() {
if (!this.element.firstChild)
return {left: 0, right: 0};
var style = dom.computedStyle(this.element.firstChild);
this.$padding = {}
this.$padding.left = parseInt(style.paddingLeft) + 1;
this.$padding.right = parseInt(style.paddingRight);
return this.$padding;
};
this.getRegion = function(point) {
var padding = this.$padding || this.$computePadding();
var rect = this.element.getBoundingClientRect();
if (point.x < padding.left + rect.left)
return "markers";
if (this.$showFoldWidgets && point.x > rect.right - padding.right)
return "foldWidgets";
};
}).call(Gutter.prototype); }).call(Gutter.prototype);
exports.Gutter = Gutter; exports.Gutter = Gutter;
@@ -1,39 +1,30 @@
/* vim:ts=4:sts=4:sw=4: /* ***** BEGIN LICENSE BLOCK *****
* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license:
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Fabian Jakobs <fabian AT ajax DOT org> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* Julian Viereck <julian.viereck@gmail.com> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -87,26 +78,17 @@ var Marker = function(parentEl) {
range = range.toScreenRange(this.session); range = range.toScreenRange(this.session);
if (marker.renderer) { if (marker.renderer) {
var top = this.$getTop(range.start.row, config); var top = this.$getTop(range.start.row, config);
var left = Math.round( var left = this.$padding + range.start.column * config.characterWidth;
this.$padding + range.start.column * config.characterWidth
);
marker.renderer(html, range, left, top, config); marker.renderer(html, range, left, top, config);
} } else if (marker.type == "fullLine") {
else if (range.isMultiLine()) { this.drawFullLineMarker(html, range, marker.clazz, config);
if (marker.type == "text") { } else if (range.isMultiLine()) {
if (marker.type == "text")
this.drawTextMarker(html, range, marker.clazz, config); this.drawTextMarker(html, range, marker.clazz, config);
else
this.drawMultiLineMarker(html, range, marker.clazz, config);
} else { } else {
this.drawMultiLineMarker( this.drawSingleLineMarker(html, range, marker.clazz + " ace_start", config);
html, range, marker.clazz, config,
marker.type
);
}
}
else {
this.drawSingleLineMarker(
html, range, marker.clazz + " start", config,
null, marker.type
);
} }
} }
this.element = dom.setInnerHtml(this.element, html.join("")); this.element = dom.setInnerHtml(this.element, html.join(""));
@@ -125,7 +107,7 @@ var Marker = function(parentEl) {
row, range.start.column, row, range.start.column,
row, this.session.getScreenLastRowColumn(row) row, this.session.getScreenLastRowColumn(row)
); );
this.drawSingleLineMarker(stringBuilder, lineRange, clazz + " start", layerConfig, 1, "text"); this.drawSingleLineMarker(stringBuilder, lineRange, clazz + " ace_start", layerConfig, 1, "text");
// selection end // selection end
row = range.end.row; row = range.end.row;
@@ -142,14 +124,14 @@ var Marker = function(parentEl) {
// Draws a multi line marker, where lines span the full width // Draws a multi line marker, where lines span the full width
this.drawMultiLineMarker = function(stringBuilder, range, clazz, config, type) { this.drawMultiLineMarker = function(stringBuilder, range, clazz, config, type) {
var padding = type === "background" ? 0 : this.$padding;
// from selection start to the end of the line // from selection start to the end of the line
var padding = this.$padding;
var height = config.lineHeight; var height = config.lineHeight;
var top = this.$getTop(range.start.row, config); var top = this.$getTop(range.start.row, config);
var left = Math.round(padding + range.start.column * config.characterWidth); var left = padding + range.start.column * config.characterWidth;
stringBuilder.push( stringBuilder.push(
"<div class='", clazz, " start' style='", "<div class='", clazz, " ace_start' style='",
"height:", height, "px;", "height:", height, "px;",
"right:0;", "right:0;",
"top:", top, "px;", "top:", top, "px;",
@@ -158,7 +140,7 @@ var Marker = function(parentEl) {
// from start of the last line to the selection end // from start of the last line to the selection end
top = this.$getTop(range.end.row, config); top = this.$getTop(range.end.row, config);
var width = Math.round(range.end.column * config.characterWidth); var width = range.end.column * config.characterWidth;
stringBuilder.push( stringBuilder.push(
"<div class='", clazz, "' style='", "<div class='", clazz, "' style='",
@@ -184,19 +166,12 @@ var Marker = function(parentEl) {
}; };
// Draws a marker which covers part or whole width of a single screen line // Draws a marker which covers part or whole width of a single screen line
this.drawSingleLineMarker = function(stringBuilder, range, clazz, layerConfig, extraLength, type) { this.drawSingleLineMarker = function(stringBuilder, range, clazz, config, extraLength) {
var padding = type === "background" ? 0 : this.$padding; var height = config.lineHeight;
var height = layerConfig.lineHeight; var width = (range.end.column + (extraLength || 0) - range.start.column) * config.characterWidth;
if (type === "background") var top = this.$getTop(range.start.row, config);
var width = layerConfig.width; var left = this.$padding + range.start.column * config.characterWidth;
else
width = Math.round((range.end.column + (extraLength || 0) - range.start.column) * layerConfig.characterWidth);
var top = this.$getTop(range.start.row, layerConfig);
var left = Math.round(
padding + range.start.column * layerConfig.characterWidth
);
stringBuilder.push( stringBuilder.push(
"<div class='", clazz, "' style='", "<div class='", clazz, "' style='",
@@ -207,6 +182,20 @@ var Marker = function(parentEl) {
); );
}; };
this.drawFullLineMarker = function(stringBuilder, range, clazz, config) {
var top = this.$getTop(range.start.row, config);
var height = config.lineHeight;
if (range.start.row != range.end.row)
height += this.$getTop(range.end.row, config) - top;
stringBuilder.push(
"<div class='", clazz, "' style='",
"height:", height, "px;",
"top:", top, "px;",
"left:0;right:0;'></div>"
);
}
}).call(Marker.prototype); }).call(Marker.prototype);
exports.Marker = Marker; exports.Marker = Marker;
@@ -1,41 +1,30 @@
/* vim:ts=4:sts=4:sw=4: /* ***** BEGIN LICENSE BLOCK *****
* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license:
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Fabian Jakobs <fabian AT ajax DOT org> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* Julian Viereck <julian DOT viereck AT gmail DOT com> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Mihai Sucan <mihai.sucan@gmail.com>
* Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -53,7 +42,8 @@ var Text = function(parentEl) {
this.element.className = "ace_layer ace_text-layer"; this.element.className = "ace_layer ace_text-layer";
parentEl.appendChild(this.element); parentEl.appendChild(this.element);
this.$characterSize = this.$measureSizes() || {width: 0, height: 0}; this.$characterSize = {width: 0, height: 0};
this.checkForSizeChanges();
this.$pollSizeChanges(); this.$pollSizeChanges();
}; };
@@ -83,7 +73,11 @@ var Text = function(parentEl) {
this.checkForSizeChanges = function() { this.checkForSizeChanges = function() {
var size = this.$measureSizes(); var size = this.$measureSizes();
if (size && (this.$characterSize.width !== size.width || this.$characterSize.height !== size.height)) { if (size && (this.$characterSize.width !== size.width || this.$characterSize.height !== size.height)) {
this.$measureNode.style.fontWeight = "bold";
var boldSize = this.$measureSizes();
this.$measureNode.style.fontWeight = "";
this.$characterSize = size; this.$characterSize = size;
this.allowBoldFonts = boldSize && boldSize.width === size.width && boldSize.height === size.height;
this._emit("changeCharacterSize", {data: size}); this._emit("changeCharacterSize", {data: size});
} }
}; };
@@ -196,6 +190,7 @@ var Text = function(parentEl) {
this.setSession = function(session) { this.setSession = function(session) {
this.session = session; this.session = session;
this.$computeTabString();
}; };
this.showInvisibles = false; this.showInvisibles = false;
@@ -204,28 +199,52 @@ var Text = function(parentEl) {
return false; return false;
this.showInvisibles = showInvisibles; this.showInvisibles = showInvisibles;
this.$computeTabString();
return true;
};
this.displayIndentGuides = true;
this.setDisplayIndentGuides = function(display) {
if (this.displayIndentGuides == display)
return false;
this.displayIndentGuides = display;
this.$computeTabString();
return true; return true;
}; };
this.$tabStrings = []; this.$tabStrings = [];
this.onChangeTabSize =
this.$computeTabString = function() { this.$computeTabString = function() {
var tabSize = this.session.getTabSize(); var tabSize = this.session.getTabSize();
this.tabSize = tabSize;
var tabStr = this.$tabStrings = [0]; var tabStr = this.$tabStrings = [0];
for (var i = 1; i < tabSize + 1; i++) { for (var i = 1; i < tabSize + 1; i++) {
if (this.showInvisibles) { if (this.showInvisibles) {
tabStr.push("<span class='ace_invisible'>" tabStr.push("<span class='ace_invisible'>"
+ this.TAB_CHAR + this.TAB_CHAR
+ new Array(i).join("&#160;") + Array(i).join("&#160;")
+ "</span>"); + "</span>");
} else { } else {
tabStr.push(new Array(i+1).join("&#160;")); tabStr.push(new Array(i+1).join("&#160;"));
} }
} }
if (this.displayIndentGuides) {
this.$indentGuideRe = /\s\S| \t|\t |\s$/;
var className = "ace_indent-guide";
var content = Array(this.tabSize + 1).join("&#160;");
var tabContent = content;
if (this.showInvisibles) {
className += " ace_invisible";
tabContent = this.TAB_CHAR + content.substr(6);
}
this.$tabStrings[" "] = "<span class='" + className + "'>" + content + "</span>";
this.$tabStrings["\t"] = "<span class='" + className + "'>" + tabContent + "</span>";
}
}; };
this.updateLines = function(config, firstRow, lastRow) { this.updateLines = function(config, firstRow, lastRow) {
this.$computeTabString();
// Due to wrap line changes there can be new lines if e.g. // Due to wrap line changes there can be new lines if e.g.
// the line to updated wrapped in the meantime. // the line to updated wrapped in the meantime.
if (this.config.lastRow != config.lastRow || if (this.config.lastRow != config.lastRow ||
@@ -253,22 +272,32 @@ var Text = function(parentEl) {
lineElementsIdx ++; lineElementsIdx ++;
} }
for (var i=first; i<=last; i++) { var row = first;
var foldLine = this.session.getNextFoldLine(row);
var foldStart = foldLine ? foldLine.start.row : Infinity;
while (true) {
if (row > foldStart) {
row = foldLine.end.row+1;
foldLine = this.session.getNextFoldLine(row, foldLine);
foldStart = foldLine ? foldLine.start.row :Infinity;
}
if (row > last)
break;
var lineElement = lineElements[lineElementsIdx++]; var lineElement = lineElements[lineElementsIdx++];
if (!lineElement) if (lineElement) {
continue;
var html = []; var html = [];
var tokens = this.session.getTokens(i); this.$renderLine(
this.$renderLine(html, i, tokens, !this.$useLineGroups()); html, row, !this.$useLineGroups(), row == foldStart ? foldLine : false
lineElement = dom.setInnerHtml(lineElement, html.join("")); );
dom.setInnerHtml(lineElement, html.join(""));
i = this.session.getRowFoldEnd(i); }
row++;
} }
}; };
this.scrollLines = function(config) { this.scrollLines = function(config) {
this.$computeTabString();
var oldConfig = this.config; var oldConfig = this.config;
this.config = config; this.config = config;
@@ -321,8 +350,7 @@ var Text = function(parentEl) {
var html = []; var html = [];
// Get the tokens per line as there might be some lines in between // Get the tokens per line as there might be some lines in between
// beeing folded. // beeing folded.
var tokens = this.session.getTokens(row); this.$renderLine(html, row, false, row == foldStart ? foldLine : false);
this.$renderLine(html, row, tokens, false);
// don't use setInnerHtml since we are working with an empty DIV // don't use setInnerHtml since we are working with an empty DIV
container.innerHTML = html.join(""); container.innerHTML = html.join("");
@@ -341,7 +369,6 @@ var Text = function(parentEl) {
}; };
this.update = function(config) { this.update = function(config) {
this.$computeTabString();
this.config = config; this.config = config;
var html = []; var html = [];
@@ -363,10 +390,7 @@ var Text = function(parentEl) {
if (this.$useLineGroups()) if (this.$useLineGroups())
html.push("<div class='ace_line_group'>") html.push("<div class='ace_line_group'>")
// Get the tokens per line as there might be some lines in between this.$renderLine(html, row, false, row == foldStart ? foldLine : false);
// beeing folded.
var tokens = this.session.getTokens(row);
this.$renderLine(html, row, tokens, false);
if (this.$useLineGroups()) if (this.$useLineGroups())
html.push("</div>"); // end the line group html.push("</div>"); // end the line group
@@ -384,7 +408,7 @@ var Text = function(parentEl) {
this.$renderToken = function(stringBuilder, screenColumn, token, value) { this.$renderToken = function(stringBuilder, screenColumn, token, value) {
var self = this; var self = this;
var replaceReg = /\t|&|<|( +)|([\u0000-\u0019\u00a0\u1680\u180E\u2000-\u200b\u2028\u2029\u202F\u205F\u3000\uFEFF])|[\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3000-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]/g; var replaceReg = /\t|&|<|( +)|([\x00-\x1f\x80-\xa0\u1680\u180E\u2000-\u200f\u2028\u2029\u202F\u205F\u3000\uFEFF])|[\u1100-\u115F\u11A3-\u11A7\u11FA-\u11FF\u2329-\u232A\u2E80-\u2E99\u2E9B-\u2EF3\u2F00-\u2FD5\u2FF0-\u2FFB\u3000-\u303E\u3041-\u3096\u3099-\u30FF\u3105-\u312D\u3131-\u318E\u3190-\u31BA\u31C0-\u31E3\u31F0-\u321E\u3220-\u3247\u3250-\u32FE\u3300-\u4DBF\u4E00-\uA48C\uA490-\uA4C6\uA960-\uA97C\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFAFF\uFE10-\uFE19\uFE30-\uFE52\uFE54-\uFE66\uFE68-\uFE6B\uFF01-\uFF60\uFFE0-\uFFE6]/g;
var replaceFunc = function(c, a, b, tabIdx, idx4) { var replaceFunc = function(c, a, b, tabIdx, idx4) {
if (a) { if (a) {
return new Array(c.length+1).join("&#160;"); return new Array(c.length+1).join("&#160;");
@@ -429,38 +453,44 @@ var Text = function(parentEl) {
return screenColumn + value.length; return screenColumn + value.length;
}; };
this.$renderLineCore = function(stringBuilder, lastRow, tokens, splits, onlyContents) { this.renderIndentGuide = function(stringBuilder, value) {
var cols = value.search(this.$indentGuideRe);
if (cols <= 0)
return value;
if (value[0] == " ") {
cols -= cols % this.tabSize;
stringBuilder.push(Array(cols/this.tabSize + 1).join(this.$tabStrings[" "]));
return value.substr(cols);
} else if (value[0] == "\t") {
stringBuilder.push(Array(cols + 1).join(this.$tabStrings["\t"]));
return value.substr(cols);
}
return value;
};
this.$renderWrappedLine = function(stringBuilder, tokens, splits, onlyContents) {
var chars = 0; var chars = 0;
var split = 0; var split = 0;
var splitChars; var splitChars = splits[0];
var screenColumn = 0; var screenColumn = 0;
var self = this;
if (!splits || splits.length == 0)
splitChars = Number.MAX_VALUE;
else
splitChars = splits[0];
if (!onlyContents) {
stringBuilder.push("<div class='ace_line' style='height:",
this.config.lineHeight, "px",
"'>"
);
}
for (var i = 0; i < tokens.length; i++) { for (var i = 0; i < tokens.length; i++) {
var token = tokens[i]; var token = tokens[i];
var value = token.value; var value = token.value;
if (i == 0 && this.displayIndentGuides) {
chars = value.length;
value = this.renderIndentGuide(stringBuilder, value);
if (!value)
continue;
chars -= value.length;
}
if (chars + value.length < splitChars) { if (chars + value.length < splitChars) {
screenColumn = self.$renderToken( screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value);
stringBuilder, screenColumn, token, value
);
chars += value.length; chars += value.length;
} } else {
else {
while (chars + value.length >= splitChars) { while (chars + value.length >= splitChars) {
screenColumn = self.$renderToken( screenColumn = this.$renderToken(
stringBuilder, screenColumn, stringBuilder, screenColumn,
token, value.substring(0, splitChars - chars) token, value.substring(0, splitChars - chars)
); );
@@ -470,8 +500,7 @@ var Text = function(parentEl) {
if (!onlyContents) { if (!onlyContents) {
stringBuilder.push("</div>", stringBuilder.push("</div>",
"<div class='ace_line' style='height:", "<div class='ace_line' style='height:",
this.config.lineHeight, "px", this.config.lineHeight, "px'>"
"'>"
); );
} }
@@ -481,37 +510,70 @@ var Text = function(parentEl) {
} }
if (value.length != 0) { if (value.length != 0) {
chars += value.length; chars += value.length;
screenColumn = self.$renderToken( screenColumn = this.$renderToken(
stringBuilder, screenColumn, token, value stringBuilder, screenColumn, token, value
); );
} }
} }
} }
};
this.$renderSimpleLine = function(stringBuilder, tokens) {
var screenColumn = 0;
var token = tokens[0];
var value = token.value;
if (this.displayIndentGuides)
value = this.renderIndentGuide(stringBuilder, value);
if (value)
screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value);
for (var i = 1; i < tokens.length; i++) {
token = tokens[i];
value = token.value;
screenColumn = this.$renderToken(stringBuilder, screenColumn, token, value);
}
};
// row is either first row of foldline or not in fold
this.$renderLine = function(stringBuilder, row, onlyContents, foldLine) {
if (!foldLine && foldLine != false)
foldLine = this.session.getFoldLine(row);
if (foldLine)
var tokens = this.$getFoldLineTokens(row, foldLine);
else
var tokens = this.session.getTokens(row);
if (!onlyContents) {
stringBuilder.push(
"<div class='ace_line' style='height:", this.config.lineHeight, "px'>"
);
}
if (tokens.length) {
var splits = this.session.getRowSplitData(row);
if (splits && splits.length)
this.$renderWrappedLine(stringBuilder, tokens, splits, onlyContents);
else
this.$renderSimpleLine(stringBuilder, tokens);
}
if (this.showInvisibles) { if (this.showInvisibles) {
if (lastRow !== this.session.getLength() - 1) if (foldLine)
stringBuilder.push("<span class='ace_invisible'>" + this.EOL_CHAR + "</span>"); row = foldLine.end.row
else
stringBuilder.push("<span class='ace_invisible'>" + this.EOF_CHAR + "</span>"); stringBuilder.push(
"<span class='ace_invisible'>",
row == this.session.getLength() - 1 ? this.EOF_CHAR : this.EOL_CHAR,
"</span>"
);
} }
if (!onlyContents) if (!onlyContents)
stringBuilder.push("</div>"); stringBuilder.push("</div>");
}; };
this.$renderLine = function(stringBuilder, row, tokens, onlyContents) { this.$getFoldLineTokens = function(row, foldLine) {
// Check if the line to render is folded or not. If not, things are
// simple, otherwise, we need to fake some things...
if (!this.session.isRowFolded(row)) {
var splits = this.session.getRowSplitData(row);
this.$renderLineCore(stringBuilder, row, tokens, splits, onlyContents);
} else {
this.$renderFoldLine(stringBuilder, row, tokens, onlyContents);
}
};
this.$renderFoldLine = function(stringBuilder, row, tokens, onlyContents) {
var session = this.session; var session = this.session;
var foldLine = session.getFoldLine(row);
var renderTokens = []; var renderTokens = [];
function addTokens(tokens, from, to) { function addTokens(tokens, from, to) {
@@ -552,8 +614,9 @@ var Text = function(parentEl) {
} }
} }
var tokens = session.getTokens(row);
foldLine.walk(function(placeholder, row, column, lastColumn, isNewRow) { foldLine.walk(function(placeholder, row, column, lastColumn, isNewRow) {
if (placeholder) { if (placeholder != null) {
renderTokens.push({ renderTokens.push({
type: "fold", type: "fold",
value: placeholder value: placeholder
@@ -567,9 +630,7 @@ var Text = function(parentEl) {
} }
}, foldLine.end.row, this.session.getLine(foldLine.end.row).length); }, foldLine.end.row, this.session.getLine(foldLine.end.row).length);
// splits for foldline are stored at its' first row return renderTokens;
var splits = this.session.$useWrapMode ? this.session.$wrapData[row] : null;
this.$renderLineCore(stringBuilder, row, renderTokens, splits, onlyContents);
}; };
this.$useLineGroups = function() { this.$useLineGroups = function() {
@@ -1,37 +1,30 @@
/* ***** BEGIN LICENSE BLOCK ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Distributed under the BSD license:
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Fabian Jakobs <fabian AT ajax DOT org> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -67,35 +60,61 @@ module.exports = {
this.textLayer.$computeTabString(); this.textLayer.$computeTabString();
// row with hard tabs // row with hard tabs
var row = 0;
var tokens = this.session.getTokens(row);
var stringBuilder = []; var stringBuilder = [];
this.textLayer.$renderLine(stringBuilder, row, tokens); this.textLayer.$renderLine(stringBuilder, 0);
// row with soft tabs // row with soft tabs
row = 1;
tokens = this.session.getTokens(row);
var stringBuilder2 = []; var stringBuilder2 = [];
this.textLayer.$renderLine(stringBuilder2, row, tokens); this.textLayer.$renderLine(stringBuilder2, 1);
assert.equal(stringBuilder.join(""), stringBuilder2.join("")); assert.equal(stringBuilder.join(""), stringBuilder2.join(""));
}, },
"test rendering width of ideographic space (U+3000)" : function() { "test rendering width of ideographic space (U+3000)" : function() {
this.session.setValue("\u3000"); this.session.setValue("\u3000");
var tokens = this.session.getTokens(0);
var stringBuilder = []; var stringBuilder = [];
this.textLayer.$renderLine(stringBuilder, 0, tokens, true); this.textLayer.$renderLine(stringBuilder, 0, true);
assert.equal(stringBuilder.join(""), "<span class='ace_cjk' style='width:20px'></span>"); assert.equal(stringBuilder.join(""), "<span class='ace_cjk' style='width:20px'></span>");
this.textLayer.setShowInvisibles(true); this.textLayer.setShowInvisibles(true);
var stringBuilder = []; var stringBuilder = [];
this.textLayer.$renderLine(stringBuilder, 0, tokens, true); this.textLayer.$renderLine(stringBuilder, 0, true);
assert.equal( assert.equal(
stringBuilder.join(""), stringBuilder.join(""),
"<span class='ace_cjk ace_invisible' style='width:20px'>" + this.textLayer.SPACE_CHAR + "</span>" "<span class='ace_cjk ace_invisible' style='width:20px'>" + this.textLayer.SPACE_CHAR + "</span>"
+ "<span class='ace_invisible'>\xB6</span>" + "<span class='ace_invisible'>\xB6</span>"
); );
},
"test rendering of indent guides" : function() {
var textLayer = this.textLayer
var EOL = "<span class='ace_invisible'>" + textLayer.EOL_CHAR + "</span>";
var SPACE = function(i) {return Array(i+1).join("&#160;")}
var TAB = function(i) {return textLayer.TAB_CHAR + SPACE(i-1)}
function testRender(results) {
for (var i = results.length; i--; ) {
var stringBuilder = [];
textLayer.$renderLine(stringBuilder, i, true);
assert.equal(stringBuilder.join(""), results[i]);
}
}
this.session.setValue(" \n\t\tf\n ");
testRender([
"<span class='ace_indent-guide'>" + SPACE(4) + "</span>" + SPACE(2),
"<span class='ace_indent-guide'>" + SPACE(4) + "</span>" + SPACE(4) + "<span class='ace_identifier'>f</span>",
SPACE(3)
]);
this.textLayer.setShowInvisibles(true);
testRender([
"<span class='ace_indent-guide ace_invisible'>" + SPACE(4) + "</span>" + SPACE(2) + EOL,
"<span class='ace_indent-guide ace_invisible'>" + TAB(4) + "</span><span class='ace_invisible'>" + TAB(4) + "</span><span class='ace_identifier'>f</span>" + EOL,
]);
this.textLayer.setDisplayIndentGuides(false);
testRender([
SPACE(6) + EOL,
"<span class='ace_invisible'>" + TAB(4) + "</span><span class='ace_invisible'>" + TAB(4) + "</span><span class='ace_identifier'>f</span>" + EOL
]);
} }
}; };
@@ -1,40 +1,30 @@
/* vim:ts=4:sts=4:sw=4: /* ***** BEGIN LICENSE BLOCK *****
* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license:
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Fabian Jakobs <fabian AT ajax DOT org> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com) * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Julian Viereck <julian.viereck@gmail.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -1,40 +1,30 @@
/* vim:ts=4:sts=4:sw=4: /* ***** BEGIN LICENSE BLOCK *****
* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license:
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Fabian Jakobs <fabian AT ajax DOT org> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* Mihai Sucan <mihai AT sucan AT gmail ODT com> * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com)
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -543,10 +543,33 @@ if (!Object.getOwnPropertyNames) {
// ES5 15.2.3.5 // ES5 15.2.3.5
// http://es5.github.com/#x15.2.3.5 // http://es5.github.com/#x15.2.3.5
if (!Object.create) { if (!Object.create) {
var createEmpty;
if (Object.prototype.__proto__ === null) {
createEmpty = function () {
return { "__proto__": null };
};
} else {
// In old IE __proto__ can't be used to manually set `null`
createEmpty = function () {
var empty = {};
for (var i in empty)
empty[i] = null;
empty.constructor =
empty.hasOwnProperty =
empty.propertyIsEnumerable =
empty.isPrototypeOf =
empty.toLocaleString =
empty.toString =
empty.valueOf =
empty.__proto__ = null;
return empty;
}
}
Object.create = function create(prototype, properties) { Object.create = function create(prototype, properties) {
var object; var object;
if (prototype === null) { if (prototype === null) {
object = { "__proto__": null }; object = createEmpty();
} else { } else {
if (typeof prototype != "object") if (typeof prototype != "object")
throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'"); throw new TypeError("typeof prototype["+(typeof prototype)+"] != 'object'");
@@ -1,37 +1,30 @@
/* ***** BEGIN LICENSE BLOCK ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Distributed under the BSD license:
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Fabian Jakobs <fabian AT ajax DOT org> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -108,11 +101,6 @@ exports.getButton = function(e) {
if (document.documentElement.setCapture) { if (document.documentElement.setCapture) {
exports.capture = function(el, eventHandler, releaseCaptureHandler) { exports.capture = function(el, eventHandler, releaseCaptureHandler) {
function onMouseMove(e) {
eventHandler(e);
return exports.stopPropagation(e);
}
var called = false; var called = false;
function onReleaseCapture(e) { function onReleaseCapture(e) {
eventHandler(e); eventHandler(e);
@@ -137,22 +125,17 @@ if (document.documentElement.setCapture) {
} }
else { else {
exports.capture = function(el, eventHandler, releaseCaptureHandler) { exports.capture = function(el, eventHandler, releaseCaptureHandler) {
function onMouseMove(e) {
eventHandler(e);
e.stopPropagation();
}
function onMouseUp(e) { function onMouseUp(e) {
eventHandler && eventHandler(e); eventHandler && eventHandler(e);
releaseCaptureHandler && releaseCaptureHandler(e); releaseCaptureHandler && releaseCaptureHandler(e);
document.removeEventListener("mousemove", onMouseMove, true); document.removeEventListener("mousemove", eventHandler, true);
document.removeEventListener("mouseup", onMouseUp, true); document.removeEventListener("mouseup", onMouseUp, true);
e.stopPropagation(); e.stopPropagation();
} }
document.addEventListener("mousemove", onMouseMove, true); document.addEventListener("mousemove", eventHandler, true);
document.addEventListener("mouseup", onMouseUp, true); document.addEventListener("mouseup", onMouseUp, true);
}; };
} }
@@ -193,7 +176,7 @@ exports.addMultiMouseDownListener = function(el, timeouts, eventHandler, callbac
4: "quadclick" 4: "quadclick"
}; };
var listener = function(e) { exports.addListener(el, "mousedown", function(e) {
if (exports.getButton(e) != 0) { if (exports.getButton(e) != 0) {
clicks = 0; clicks = 0;
} else { } else {
@@ -219,10 +202,18 @@ exports.addMultiMouseDownListener = function(el, timeouts, eventHandler, callbac
clicks = 0; clicks = 0;
else if (clicks > 1) else if (clicks > 1)
return eventHandler[callbackName](eventNames[clicks], e); return eventHandler[callbackName](eventNames[clicks], e);
}; });
exports.addListener(el, "mousedown", listener); if (useragent.isOldIE) {
useragent.isOldIE && exports.addListener(el, "dblclick", listener); exports.addListener(el, "dblclick", function(e) {
clicks = 2;
if (timer)
clearTimeout(timer);
timer = setTimeout(function() {timer = null}, timeouts[clicks - 1] || 600);
eventHandler[callbackName]("mousedown", e);
eventHandler[callbackName](eventNames[clicks], e);
});
}
}; };
function normalizeCommandKeys(callback, e, keyCode) { function normalizeCommandKeys(callback, e, keyCode) {
@@ -292,7 +283,7 @@ exports.addCommandKeyListener = function(el, callback) {
} }
}; };
if (window.postMessage) { if (window.postMessage && !useragent.isOldIE) {
var postMessageId = 1; var postMessageId = 1;
exports.nextTick = function(callback, win) { exports.nextTick = function(callback, win) {
win = win || window; win = win || window;
@@ -307,11 +298,18 @@ if (window.postMessage) {
win.postMessage(messageName, "*"); win.postMessage(messageName, "*");
}; };
} }
else {
exports.nextTick = function(callback, win) {
win = win || window;
window.setTimeout(callback, 0);
};
}
exports.nextFrame = window.requestAnimationFrame ||
window.oRequestAnimationFrame ||
window.msRequestAnimationFrame ||
window.mozRequestAnimationFrame ||
window.webkitRequestAnimationFrame;
if (exports.nextFrame)
exports.nextFrame = exports.nextFrame.bind(window);
else
exports.nextFrame = function(callback) {
setTimeout(callback, 17);
};
}); });
@@ -1,40 +1,30 @@
/* vim:ts=4:sts=4:sw=4: /* ***** BEGIN LICENSE BLOCK *****
* ***** BEGIN LICENSE BLOCK ***** * Distributed under the BSD license:
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Fabian Jakobs <fabian AT ajax DOT org> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* Irakli Gozalishvili <rfobic@gmail.com> (http://jeditoolkit.com) * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Mike de Boer <mike AT ajax DOT org>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -53,7 +43,10 @@ EventEmitter._dispatchEvent = function(eventName, e) {
if (!listeners.length && !defaultHandler) if (!listeners.length && !defaultHandler)
return; return;
e = e || {}; if (typeof e != "object" || !e)
e = {};
if (!e.type)
e.type = eventName; e.type = eventName;
if (!e.stopPropagation) { if (!e.stopPropagation) {
@@ -93,7 +86,7 @@ EventEmitter.addEventListener = function(eventName, callback) {
var listeners = this._eventRegistry[eventName]; var listeners = this._eventRegistry[eventName];
if (!listeners) if (!listeners)
var listeners = this._eventRegistry[eventName] = []; listeners = this._eventRegistry[eventName] = [];
if (listeners.indexOf(callback) == -1) if (listeners.indexOf(callback) == -1)
listeners.push(callback); listeners.push(callback);
@@ -1,37 +1,30 @@
/* ***** BEGIN LICENSE BLOCK ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Distributed under the BSD license:
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Fabian Jakobs <fabian AT ajax DOT org> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -108,7 +108,7 @@ var Keys = (function() {
// A reverse map of FUNCTION_KEYS // A reverse map of FUNCTION_KEYS
for (var i in ret.FUNCTION_KEYS) { for (var i in ret.FUNCTION_KEYS) {
var name = ret.FUNCTION_KEYS[i].toUpperCase(); var name = ret.FUNCTION_KEYS[i].toLowerCase();
ret[name] = parseInt(i, 10); ret[name] = parseInt(i, 10);
} }
@@ -118,6 +118,14 @@ var Keys = (function() {
oop.mixin(ret, ret.PRINTABLE_KEYS); oop.mixin(ret, ret.PRINTABLE_KEYS);
oop.mixin(ret, ret.FUNCTION_KEYS); oop.mixin(ret, ret.FUNCTION_KEYS);
// aliases
ret.enter = ret["return"];
ret.escape = ret.esc;
ret.del = ret["delete"];
// workaround for firefox bug
ret[173] = '-';
return ret; return ret;
})(); })();
oop.mixin(exports, Keys); oop.mixin(exports, Keys);
@@ -1,37 +1,30 @@
/* ***** BEGIN LICENSE BLOCK ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Distributed under the BSD license:
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Fabian Jakobs <fabian AT ajax DOT org> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -101,6 +94,14 @@ exports.arrayToMap = function(arr) {
}; };
exports.createMap = function(props) {
var map = Object.create(null);
for (var i in props) {
map[i] = props[i];
}
return map;
};
/* /*
* splice out of 'array' anything that === 'value' * splice out of 'array' anything that === 'value'
*/ */
@@ -116,6 +117,10 @@ exports.escapeRegExp = function(str) {
return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1'); return str.replace(/([.*+?^${}()|[\]\/\\])/g, '\\$1');
}; };
exports.escapeHTML = function(str) {
return str.replace(/&/g, "&#38;").replace(/"/g, "&#34;").replace(/'/g, "&#39;").replace(/</g, "&#60;");
};
exports.getMatchOffsets = function(string, regExp) { exports.getMatchOffsets = function(string, regExp) {
var matches = []; var matches = [];
@@ -129,7 +134,7 @@ exports.getMatchOffsets = function(string, regExp) {
return matches; return matches;
}; };
/* deprecated */
exports.deferredCall = function(fcn) { exports.deferredCall = function(fcn) {
var timer = null; var timer = null;
@@ -161,4 +166,39 @@ exports.deferredCall = function(fcn) {
return deferred; return deferred;
}; };
exports.delayedCall = function(fcn, defaultTimeout) {
var timer = null;
var callback = function() {
timer = null;
fcn();
};
var _self = function(timeout) {
timer && clearTimeout(timer);
timer = setTimeout(callback, timeout || defaultTimeout);
};
_self.delay = delayed;
_self.schedule = function(timeout) {
if (timer == null)
timer = setTimeout(callback, timeout || 0);
};
_self.call = function() {
this.cancel();
fcn();
};
_self.cancel = function() {
timer && clearTimeout(timer);
timer = null;
};
_self.isPending = function() {
return timer;
};
return _self;
};
}); });
@@ -8,6 +8,8 @@
define(function(require, exports, module) { define(function(require, exports, module) {
"use strict"; "use strict";
var useragent = require("./useragent");
exports.get = function (url, callback) { exports.get = function (url, callback) {
var xhr = exports.createXhr(); var xhr = exports.createXhr();
xhr.open('GET', url, true); xhr.open('GET', url, true);
@@ -56,6 +58,11 @@ exports.loadScript = function(path, callback) {
s.src = path; s.src = path;
head.appendChild(s); head.appendChild(s);
if (useragent.isOldIE)
s.onreadystatechange = function () {
this.readyState == 'loaded' && callback();
};
else
s.onload = callback; s.onload = callback;
}; };
@@ -1,37 +1,30 @@
/* ***** BEGIN LICENSE BLOCK ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Distributed under the BSD license:
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Fabian Jakobs <fabian AT ajax DOT org> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
@@ -98,7 +98,7 @@ define(function(require, exports, module) {
(regex.multiline ? "m" : "") + (regex.multiline ? "m" : "") +
(regex.extended ? "x" : "") + // Proposed for ES4; included in AS3 (regex.extended ? "x" : "") + // Proposed for ES4; included in AS3
(regex.sticky ? "y" : ""); (regex.sticky ? "y" : "");
}; }
function indexOf (array, item, from) { function indexOf (array, item, from) {
if (Array.prototype.indexOf) // Use the native array method if available if (Array.prototype.indexOf) // Use the native array method if available
@@ -108,6 +108,6 @@ define(function(require, exports, module) {
return i; return i;
} }
return -1; return -1;
}; }
}); });
@@ -1,43 +1,66 @@
/* ***** BEGIN LICENSE BLOCK ***** /* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1 * Distributed under the BSD license:
* *
* The contents of this file are subject to the Mozilla Public License Version * Copyright (c) 2010, Ajax.org B.V.
* 1.1 (the "License"); you may not use this file except in compliance with * All rights reserved.
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
* *
* Software distributed under the License is distributed on an "AS IS" basis, * Redistribution and use in source and binary forms, with or without
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License * modification, are permitted provided that the following conditions are met:
* for the specific language governing rights and limitations under the * * Redistributions of source code must retain the above copyright
* License. * notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* * Neither the name of Ajax.org B.V. nor the
* names of its contributors may be used to endorse or promote products
* derived from this software without specific prior written permission.
* *
* The Original Code is Ajax.org Code Editor (ACE). * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* The Initial Developer of the Original Code is * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* Ajax.org B.V. * DISCLAIMED. IN NO EVENT SHALL AJAX.ORG B.V. BE LIABLE FOR ANY
* Portions created by the Initial Developer are Copyright (C) 2010 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* the Initial Developer. All Rights Reserved. * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* Contributor(s): * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* Fabian Jakobs <fabian AT ajax DOT org> * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
* *
* ***** END LICENSE BLOCK ***** */ * ***** END LICENSE BLOCK ***** */
define(function(require, exports, module) { define(function(require, exports, module) {
"use strict"; "use strict";
/*
* I hate doing this, but we need some way to determine if the user is on a Mac
* The reason is that users have different expectations of their key combinations.
*
* Take copy as an example, Mac people expect to use CMD or APPLE + C
* Windows folks expect to use CTRL + C
*/
exports.OS = {
LINUX: "LINUX",
MAC: "MAC",
WINDOWS: "WINDOWS"
};
/*
* Return an exports.OS constant
*/
exports.getOS = function() {
if (exports.isMac) {
return exports.OS.MAC;
} else if (exports.isLinux) {
return exports.OS.LINUX;
} else {
return exports.OS.WINDOWS;
}
};
// this can be called in non browser environments (e.g. from ace/requirejs/text)
if (typeof navigator != "object")
return;
var os = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase(); var os = (navigator.platform.match(/mac|win|linux/i) || ["other"])[0].toLowerCase();
var ua = navigator.userAgent; var ua = navigator.userAgent;
@@ -76,30 +99,4 @@ exports.isIPad = ua.indexOf("iPad") >= 0;
exports.isTouchPad = ua.indexOf("TouchPad") >= 0; exports.isTouchPad = ua.indexOf("TouchPad") >= 0;
/*
* I hate doing this, but we need some way to determine if the user is on a Mac
* The reason is that users have different expectations of their key combinations.
*
* Take copy as an example, Mac people expect to use CMD or APPLE + C
* Windows folks expect to use CTRL + C
*/
exports.OS = {
LINUX: "LINUX",
MAC: "MAC",
WINDOWS: "WINDOWS"
};
/*
* Return an exports.OS constant
*/
exports.getOS = function() {
if (exports.isMac) {
return exports.OS.MAC;
} else if (exports.isLinux) {
return exports.OS.LINUX;
} else {
return exports.OS.WINDOWS;
}
};
}); });
@@ -0,0 +1,8 @@
{
"name": "ace-mode-creator",
"version": "0.1.0",
"dependencies": {
"connect": "",
"socket.io": ""
}
}
@@ -0,0 +1,144 @@
var fs = require("fs");
if (!fs.existsSync)
fs.existsSync = require("path").existsSync;
require("amd-loader");
var cwd = __dirname + "/";
function generateTestData() {
var root = Array(5).join("../") + "/demo/kitchen-sink/docs";
var docs = fs.readdirSync(cwd + root);
var specialDocs = fs.readdirSync(cwd);
var modes = fs.readdirSync(cwd + "../").filter(function(x){
return /^\w+_highlight_rules.js$/.test(x);
}).map(function(x) {
return x.replace(/_highlight_rules.js$/, "");
});
console.log("Docs:", docs);
console.log("Modes:", modes);
docs.forEach(function(docName) {
var p = docName.toLowerCase().split(".");
if (!p[1])
return;
var modeName;
if (modes.indexOf(p[0]) != -1)
modeName = p[0];
else if (modes.indexOf(p[1]) != -1)
modeName = p[1];
else
modeName = {"txt": "text", cpp: "c_cpp"}[p[1]];
var filePath = "text_" + modeName + ".txt";
if (specialDocs.indexOf(filePath) == -1) {
filePath = root + "/" + docName;
}
var text = fs.readFileSync(cwd + filePath, "utf8");
try {
var Mode = require("../" + modeName).Mode;
} catch(e) {
console.warn("Can't load mode :" + modeName, e);
return;
}
var tokenizer = new Mode().getTokenizer();
var state = "start";
var data = text.split(/\n|\r|\r\n/).map(function(line) {
var tokens = tokenizer.getLineTokens(line, state);
state = tokens.state;
tokens = tokens.tokens;
return {
state: state,
data: tokens.map(function(x) {return [x.type, x.value]})
};
});
var jsonStr = JSON.stringify(data, null, 1);
jsonStr = jsonStr.replace(/\n {4}/g, " ").replace(/\n {3}]/g, " ]");
fs.writeFileSync(cwd + "tokens_" + modeName + ".json", jsonStr, "utf8");
});
}
function test(startAt) {
var docs = fs.readdirSync(cwd).filter(function(x) {
return /^tokens_\w+.json$/.test(x);
});
if (startAt && startAt > 1)
docs = docs.slice(startAt - 1);
docs.forEach(function(x, i) {
var modeName = x.match(/tokens_(.*).json/)[1];
console.log(padNumber(i+1, 3) + ") testing: \u001b[33m" + modeName + "\u001b[0m");
var text = fs.readFileSync(cwd + x, "utf8");
var data = JSON.parse(text);
var Mode = require("../" + modeName).Mode;
var tokenizer = new Mode().getTokenizer();
var state = "start";
data.forEach(function(lineData) {
lineData.values = [];
lineData.types = [];
lineData.data.forEach(function(x) {
lineData.types.push(x[0]);
lineData.values.push(x[1]);
});
var line = lineData.values.join("");
var tokens = tokenizer.getLineTokens(line, state);
var values = tokens.tokens.map(function(x) {return x.value;});
var types = tokens.tokens.map(function(x) {return x.type;});
var success = true;
testEqual([
lineData.state, tokens.state,
lineData.types, types,
lineData.values, values]);
state = lineData.state;
});
});
console.log("\u001b[32m" + "all ok" + "\u001b[0m");
function testEqual(a) {
var err;
if (a[0] !== a[1]) {
console.log(a[0],a[1]);
err = 1;
}
if ( a[2] + "" !== a[3] + "" || a[4] + "" !== a[5] + "") {
arrayDiff(a[2],a[3]);
arrayDiff(a[4],a[5]);
err = 1;
}
if (err) {
throw "error";
}
}
function arrayDiff(a1, a2) {
var l = Math.max(a1.length, a2.length);
var out = [];
for (var i = 0; i < l; i++) {
out.push("\n", padNumber(i+1, 3), ") ");
if (a1[i] !== a2[i])
out.push("\u001b[31m", a1[i], " != ", a2[i], "\u001b[0m");
else
out.push(a1[i]);
}
console.log(out.join(""));
}
function padNumber(num, digits) {
return (" " + num).slice(-digits);
}
}
if (process.argv[2] == "gen")
generateTestData(process.argv.splice(3));
else
test(parseInt(process.argv[2],10) || 0);
@@ -0,0 +1,52 @@
function foo(items, nada) {
for (var i=0; i<items.length; i++) {
alert(items[i] + "juhu\n");
} // Real Tab.
}
regexp = /p|p/ // ends here
r = /d{1,2}?f{e}++r*?\d+?[]r[^r-o\f\f[\f]?r{7}+r\{7}+rr--rr$^(?:d|s)(?=a|)(?!y)[]|$?|^*/ o
a=/a/ jk = / / / / /
/************************************/
/** total mess, tricky to highlight**/
function () {
/**
* docComment
**/
r = /u\t*/
g = 1.00E^1, y = 1.2 + .2 + 052 + 0x25
t = ['d', '']
}
function () {
/* eee */
}
"s\
s\u7824sss\u1"
'\
string'
'
string'
"trailing space\
" " /not a regexp/g
/**
*doc
*/
a = {
'a': b,
'g': function(t)
gta:function(a,b)
}
foo.protoype.d = function(a, b,
c, d)
foo.d =function(a, b)
foo.d =function(a, /*****/ d"string"
@@ -0,0 +1,175 @@
[
{
"state": "start",
"data": [
[ "text", "Searching for 'var' in /workspace/configs" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "string", "configs/default.js" ],
[ "text", ":" ]
]
},
{
"state": "start",
"data": [
[ "c9searchresults.constant.numeric", " 1" ],
[ "c9searchresults.text", ": " ],
[ "c9searchresults.text", "var fs = require(\"fs\");" ]
]
},
{
"state": "start",
"data": [
[ "c9searchresults.constant.numeric", "\t2" ],
[ "c9searchresults.text", ": " ],
[ "c9searchresults.text", "var argv = require('optimist').argv;" ]
]
},
{
"state": "start",
"data": [
[ "c9searchresults.constant.numeric", "\t3" ],
[ "c9searchresults.text", ": " ],
[ "c9searchresults.text", "var path = require(\"path\");" ]
]
},
{
"state": "start",
"data": [
[ "c9searchresults.constant.numeric", "\t5" ],
[ "c9searchresults.text", ": " ],
[ "c9searchresults.text", "var clientExtensions = {};" ]
]
},
{
"state": "start",
"data": [
[ "c9searchresults.constant.numeric", "\t6" ],
[ "c9searchresults.text", ": " ],
[ "c9searchresults.text", "var clientDirs = fs.readdirSync(__dirname + \"/../plugins-client\");" ]
]
},
{
"state": "start",
"data": [
[ "c9searchresults.constant.numeric", "\t7" ],
[ "c9searchresults.text", ": " ],
[ "c9searchresults.text", "for (var i = 0; i < clientDirs.length; i++) {" ]
]
},
{
"state": "start",
"data": [
[ "c9searchresults.constant.numeric", "\t8" ],
[ "c9searchresults.text", ": " ],
[ "c9searchresults.text", "var dir = clientDirs[i];" ]
]
},
{
"state": "start",
"data": [
[ "c9searchresults.constant.numeric", "\t12" ],
[ "c9searchresults.text", ": " ],
[ "c9searchresults.text", "var name = dir.split(\".\")[1];" ]
]
},
{
"state": "start",
"data": [
[ "c9searchresults.constant.numeric", "\t16" ],
[ "c9searchresults.text", ": " ],
[ "c9searchresults.text", "var projectDir = (argv.w && path.resolve(process.cwd(), argv.w)) || process.cwd();" ]
]
},
{
"state": "start",
"data": [
[ "c9searchresults.constant.numeric", "\t17" ],
[ "c9searchresults.text", ": " ],
[ "c9searchresults.text", "var fsUrl = \"/workspace\";" ]
]
},
{
"state": "start",
"data": [
[ "c9searchresults.constant.numeric", "\t19" ],
[ "c9searchresults.text", ": " ],
[ "c9searchresults.text", "var port = argv.p || process.env.PORT || 3131;" ]
]
},
{
"state": "start",
"data": [
[ "c9searchresults.constant.numeric", "\t20" ],
[ "c9searchresults.text", ": " ],
[ "c9searchresults.text", "var host = argv.l || \"localhost\";" ]
]
},
{
"state": "start",
"data": [
[ "c9searchresults.constant.numeric", "\t22" ],
[ "c9searchresults.text", ": " ],
[ "c9searchresults.text", "var config = {" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "string", "configs/local.js" ],
[ "text", ":" ]
]
},
{
"state": "start",
"data": [
[ "c9searchresults.constant.numeric", "\t2" ],
[ "c9searchresults.text", ": " ],
[ "c9searchresults.text", "var config = require(\"./default\");" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "string", "configs/packed.js" ],
[ "text", ":" ]
]
},
{
"state": "start",
"data": [
[ "c9searchresults.constant.numeric", "\t1" ],
[ "c9searchresults.text", ": " ],
[ "c9searchresults.text", "var config = require(\"./default\");" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "text", "Found 15 matches in 3 files" ]
]
}
]
@@ -0,0 +1,124 @@
[
{
"state": "start",
"data": [
[ "comment", "// compound assignment operators" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "#include" ],
[ "text", " " ],
[ "constant", "<iostream>" ]
]
},
{
"state": "start",
"data": [
[ "keyword.control", "using" ],
[ "text", " " ],
[ "keyword.operator", "namespace" ],
[ "text", " " ],
[ "identifier", "std" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "storage.type", "int" ],
[ "text", " " ],
[ "entity.name.function", "main" ],
[ "text", " " ],
[ "paren.lparen", "(" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "storage.type", "int" ],
[ "text", " " ],
[ "identifier", "a" ],
[ "punctuation.operator", "," ],
[ "text", " " ],
[ "identifier", "b" ],
[ "keyword.operator", "=" ],
[ "constant.numeric", "3" ],
[ "punctuation.operator", ";" ],
[ "text", " " ],
[ "comment", "/*" ],
[ "comment", " foobar */" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "a" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "identifier", "b" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "a" ],
[ "keyword.operator", "+" ],
[ "keyword.operator", "=" ],
[ "constant.numeric", "2" ],
[ "punctuation.operator", ";" ],
[ "text", " " ],
[ "comment", "// equivalent to a=a+2" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "cout" ],
[ "text", " " ],
[ "keyword.operator", "<" ],
[ "keyword.operator", "<" ],
[ "text", " " ],
[ "identifier", "a" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword.control", "return" ],
[ "text", " " ],
[ "constant.numeric", "0" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
}
]
@@ -0,0 +1,248 @@
[
{
"state": "start",
"data": [
[ "keyword", "(" ],
[ "support.function", "defn" ],
[ "text", " " ],
[ "identifier", "parting" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "string", "\"returns a String parting in a given language" ],
[ "string", "\"" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "(" ],
[ "keyword", "[" ],
[ "keyword", "]" ],
[ "text", " " ],
[ "keyword", "(" ],
[ "identifier", "parting" ],
[ "text", " " ],
[ "string", "\"World" ],
[ "string", "\"" ],
[ "keyword", ")" ],
[ "keyword", ")" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "(" ],
[ "keyword", "[" ],
[ "support.function", "name" ],
[ "keyword", "]" ],
[ "text", " " ],
[ "keyword", "(" ],
[ "identifier", "parting" ],
[ "text", " " ],
[ "support.function", "name" ],
[ "text", " " ],
[ "string", "\"en" ],
[ "string", "\"" ],
[ "keyword", ")" ],
[ "keyword", ")" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "(" ],
[ "keyword", "[" ],
[ "support.function", "name" ],
[ "text", " " ],
[ "identifier", "language" ],
[ "keyword", "]" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "comment", "; condp is similar to a case statement in other languages." ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "comment", "; It is described in more detail later." ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "comment", "; It is used here to take different actions based on whether the" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "comment", "; parameter \"language\" is set to \"en\", \"es\" or something else." ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "(" ],
[ "support.function", "condp" ],
[ "text", " " ],
[ "constant.language", "=" ],
[ "text", " " ],
[ "identifier", "language" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "string", "\"en" ],
[ "string", "\"" ],
[ "text", " " ],
[ "keyword", "(" ],
[ "support.function", "str" ],
[ "text", " " ],
[ "string", "\"Goodbye, " ],
[ "string", "\"" ],
[ "text", " " ],
[ "support.function", "name" ],
[ "keyword", ")" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "string", "\"es" ],
[ "string", "\"" ],
[ "text", " " ],
[ "keyword", "(" ],
[ "support.function", "str" ],
[ "text", " " ],
[ "string", "\"Adios, " ],
[ "string", "\"" ],
[ "text", " " ],
[ "support.function", "name" ],
[ "keyword", ")" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "(" ],
[ "keyword", "throw" ],
[ "text", " " ],
[ "keyword", "(" ],
[ "identifier", "IllegalArgumentException" ],
[ "text", "." ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "(" ],
[ "support.function", "str" ],
[ "text", " " ],
[ "string", "\"unsupported language " ],
[ "string", "\"" ],
[ "text", " " ],
[ "identifier", "language" ],
[ "keyword", ")" ],
[ "keyword", ")" ],
[ "keyword", ")" ],
[ "keyword", ")" ],
[ "keyword", ")" ],
[ "keyword", ")" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "(" ],
[ "support.function", "println" ],
[ "text", " " ],
[ "keyword", "(" ],
[ "identifier", "parting" ],
[ "keyword", ")" ],
[ "keyword", ")" ],
[ "text", " " ],
[ "comment", "; -> Goodbye, World" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "(" ],
[ "support.function", "println" ],
[ "text", " " ],
[ "keyword", "(" ],
[ "identifier", "parting" ],
[ "text", " " ],
[ "string", "\"Mark" ],
[ "string", "\"" ],
[ "keyword", ")" ],
[ "keyword", ")" ],
[ "text", " " ],
[ "comment", "; -> Goodbye, Mark" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "(" ],
[ "support.function", "println" ],
[ "text", " " ],
[ "keyword", "(" ],
[ "identifier", "parting" ],
[ "text", " " ],
[ "string", "\"Mark" ],
[ "string", "\"" ],
[ "text", " " ],
[ "string", "\"es" ],
[ "string", "\"" ],
[ "keyword", ")" ],
[ "keyword", ")" ],
[ "text", " " ],
[ "comment", "; -> Adios, Mark" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "(" ],
[ "support.function", "println" ],
[ "text", " " ],
[ "keyword", "(" ],
[ "identifier", "parting" ],
[ "text", " " ],
[ "string", "\"Mark" ],
[ "string", "\"" ],
[ "text", ", " ],
[ "string", "\"xy" ],
[ "string", "\"" ],
[ "keyword", ")" ],
[ "keyword", ")" ],
[ "text", " " ],
[ "comment", "; -> java.lang.IllegalArgumentException: unsupported language xy" ]
]
}
]
@@ -0,0 +1,188 @@
[
{
"state": "start",
"data": [
[ "comment", "#!/usr/bin/env coffee" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "try" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "throw" ],
[ "text", " " ],
[ "language.support.class", "URIError" ],
[ "text", " " ],
[ "language.support.function", "decodeURI" ],
[ "paren.lparen", "(" ],
[ "constant.numeric", "0xC0ffee" ],
[ "text", " " ],
[ "keyword.operator", "*" ],
[ "text", " " ],
[ "constant.numeric", "123456.7e-8" ],
[ "text", " " ],
[ "keyword.operator", "/" ],
[ "text", " " ],
[ "constant.numeric", ".9" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "catch" ],
[ "text", " " ],
[ "identifier", "e" ]
]
},
{
"state": "qdoc",
"data": [
[ "text", " " ],
[ "identifier", "console" ],
[ "identifier", ".log" ],
[ "text", " " ],
[ "string", "'qstring'" ],
[ "text", " " ],
[ "keyword.operator", "+" ],
[ "text", " " ],
[ "string", "\"qqstring\"" ],
[ "text", " " ],
[ "keyword.operator", "+" ],
[ "text", " " ],
[ "string", "'''" ]
]
},
{
"state": "qdoc",
"data": [
[ "string", " qdoc" ]
]
},
{
"state": "qqdoc",
"data": [
[ "string", " '''" ],
[ "text", " " ],
[ "keyword.operator", "+" ],
[ "text", " " ],
[ "string", "\"\"\"" ]
]
},
{
"state": "qqdoc",
"data": [
[ "string", " qqdoc" ]
]
},
{
"state": "start",
"data": [
[ "string", " \"\"\"" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "do" ],
[ "text", " " ],
[ "keyword.operator", "->" ]
]
},
{
"state": "comment",
"data": [
[ "text", " " ],
[ "comment", "###" ]
]
},
{
"state": "comment",
"data": [
[ "comment", " herecomment" ]
]
},
{
"state": "start",
"data": [
[ "comment", " ###" ]
]
},
{
"state": "heregex",
"data": [
[ "text", " " ],
[ "identifier", "re" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "string.regex", "/regex/imgy" ],
[ "identifier", ".test" ],
[ "text", " " ],
[ "string.regex", "///" ]
]
},
{
"state": "heregex",
"data": [
[ "comment.regex", " " ],
[ "string.regex", "heregex" ],
[ "comment.regex", " # comment" ]
]
},
{
"state": "start",
"data": [
[ "string.regex", " ///imgy" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "this" ],
[ "text", " " ],
[ "keyword", "isnt" ],
[ "punctuation.operator", ":" ],
[ "text", " " ],
[ "string", "`just JavaScript`" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "constant.language", "undefined" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ]
]
},
{
"state": "start",
"data": [
[ "identifier", "sentence" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "string", "\"#{ 22 / 7 } is a decent approximation of π\"" ]
]
}
]
@@ -0,0 +1,41 @@
[
{
"state": "start",
"data": [
[ "comment", "<!--" ],
[ "comment", "- hello world --->" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "cfset" ],
[ "text", " " ],
[ "entity.other.attribute-name", "welcome" ],
[ "keyword.operator", "=" ],
[ "string", "\"Hello World!\"" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "cfoutput" ],
[ "meta.tag", ">" ],
[ "text", "#welcome#" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "cfoutput" ],
[ "meta.tag", ">" ]
]
}
]
@@ -0,0 +1,42 @@
[
{
"state": "start",
"data": [
[ "keyword", "public" ],
[ "text", " " ],
[ "keyword", "void" ],
[ "text", " " ],
[ "identifier", "HelloWorld" ],
[ "paren.lparen", "(" ],
[ "paren.rparen", ")" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "comment", "//Say Hello!" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "Console" ],
[ "punctuation.operator", "." ],
[ "identifier", "WriteLine" ],
[ "paren.lparen", "(" ],
[ "string", "\"Hello World\"" ],
[ "paren.rparen", ")" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
}
]
@@ -0,0 +1,231 @@
[
{
"state": "ruleset",
"data": [
[ "variable", ".text-layer" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "ruleset",
"data": [
[ "text", " " ],
[ "support.type", "font-family" ],
[ "text", ": Monaco, " ],
[ "string", "\"Courier New\"" ],
[ "text", ", " ],
[ "support.constant.fonts", "monospace" ],
[ "text", ";" ]
]
},
{
"state": "ruleset",
"data": [
[ "text", " " ],
[ "support.type", "font-size" ],
[ "text", ": " ],
[ "constant.numeric", "12" ],
[ "keyword", "px" ],
[ "text", ";" ]
]
},
{
"state": "ruleset",
"data": [
[ "text", " " ],
[ "support.type", "cursor" ],
[ "text", ": " ],
[ "support.constant", "text" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "ruleset",
"data": [
[ "variable", ".blinker" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "ruleset",
"data": [
[ "text", " " ],
[ "support.type", "animation-duration" ],
[ "text", ": " ],
[ "constant.numeric", "1" ],
[ "keyword", "s" ],
[ "text", ";" ]
]
},
{
"state": "ruleset",
"data": [
[ "text", " " ],
[ "support.type", "animation-name" ],
[ "text", ": blink;" ]
]
},
{
"state": "ruleset",
"data": [
[ "text", " " ],
[ "support.type", "animation-iteration-count" ],
[ "text", ": infinite;" ]
]
},
{
"state": "ruleset",
"data": [
[ "text", " " ],
[ "support.type", "animation-direction" ],
[ "text", ": alternate;" ]
]
},
{
"state": "ruleset",
"data": [
[ "text", " " ],
[ "support.type", "animation-timing-function" ],
[ "text", ": " ],
[ "support.constant", "linear" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "media",
"data": [
[ "string", "@keyframes blink {" ]
]
},
{
"state": "media_ruleset",
"data": [
[ "text", " " ],
[ "constant", "0" ],
[ "text", "% " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "media_ruleset",
"data": [
[ "text", " " ],
[ "support.type", "opacity" ],
[ "text", ": " ],
[ "constant.numeric", "0" ],
[ "text", ";" ]
]
},
{
"state": "media",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "media_ruleset",
"data": [
[ "text", " " ],
[ "constant", "40" ],
[ "text", "% " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "media_ruleset",
"data": [
[ "text", " " ],
[ "support.type", "opacity" ],
[ "text", ": " ],
[ "constant.numeric", "0" ],
[ "text", ";" ]
]
},
{
"state": "media",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "media_ruleset",
"data": [
[ "text", " " ],
[ "constant", "40" ],
[ "variable", ".5" ],
[ "text", "% " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "media_ruleset",
"data": [
[ "text", " " ],
[ "support.type", "opacity" ],
[ "text", ": " ],
[ "constant.numeric", "1" ]
]
},
{
"state": "media",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "media_ruleset",
"data": [
[ "text", " " ],
[ "constant", "100" ],
[ "text", "% " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "media_ruleset",
"data": [
[ "text", " " ],
[ "support.type", "opacity" ],
[ "text", ": " ],
[ "constant.numeric", "1" ]
]
},
{
"state": "media",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "string", "}" ]
]
}
]
@@ -0,0 +1,732 @@
[
{
"state": "start",
"data": [
[ "variable", "diff" ],
[ "variable", " --git" ],
[ "keyword", " a/lib/ace/edit_session.js" ],
[ "variable", " b/lib/ace/edit_session.js" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "variable", "index 23fc3fc..ed3b273 100644" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "constant.numeric", "---" ],
[ "meta.tag", " a/lib/ace/edit_session.js" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "constant.numeric", "+++" ],
[ "meta.tag", " b/lib/ace/edit_session.js" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "constant", "@@" ],
[ "constant.numeric", " -51,6 +51,7 " ],
[ "constant", "@@" ],
[ "comment.doc.tag", " var TextMode = require(\"./mode/text\").Mode;" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " var Range = require(\"./range\").Range;" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " var Document = require(\"./document\").Document;" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " var BackgroundTokenizer = require(\"./background_tokenizer\").BackgroundTokenizer;" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.constant", "+" ],
[ "text", "var SearchHighlight = require(\"./search_highlight\").SearchHighlight;" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " /**" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " * class EditSession" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "constant", "@@" ],
[ "constant.numeric", " -307,6 +308,13 " ],
[ "constant", "@@" ],
[ "comment.doc.tag", " var EditSession = function(text, mode) {" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " return token;" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " };" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.constant", "+" ],
[ "text", " this.highlight = function(re) {" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.constant", "+" ],
[ "text", " if (!this.$searchHighlight) {" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.constant", "+" ],
[ "text", " var highlight = new SearchHighlight(null, \"ace_selected-word\", \"text\");" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.constant", "+" ],
[ "text", " this.$searchHighlight = this.addDynamicMarker(highlight);" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.constant", "+" ],
[ "text", " }" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.constant", "+" ],
[ "text", " this.$searchHighlight.setRegexp(re);" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.constant", "+" ],
[ "text", " }" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " /**" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " * EditSession.setUndoManager(undoManager)" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " * - undoManager (UndoManager): The new undo manager" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "constant", "@@" ],
[ "constant.numeric", " -556,7 +564,8 " ],
[ "constant", "@@" ],
[ "comment.doc.tag", " var EditSession = function(text, mode) {" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " type : type || \"line\"," ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " renderer: typeof type == \"function\" ? type : null," ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " clazz : clazz," ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.function", "-" ],
[ "string", " inFront: !!inFront" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.constant", "+" ],
[ "text", " inFront: !!inFront," ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.constant", "+" ],
[ "text", " id: id" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " }" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " if (inFront) {" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "variable", "diff" ],
[ "variable", " --git" ],
[ "keyword", " a/lib/ace/editor.js" ],
[ "variable", " b/lib/ace/editor.js" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "variable", "index 834e603..b27ec73 100644" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "constant.numeric", "---" ],
[ "meta.tag", " a/lib/ace/editor.js" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "constant.numeric", "+++" ],
[ "meta.tag", " b/lib/ace/editor.js" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "constant", "@@" ],
[ "constant.numeric", " -494,7 +494,7 " ],
[ "constant", "@@" ],
[ "comment.doc.tag", " var Editor = function(renderer, session) {" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " * Emitted when a selection has changed." ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " **/" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " this.onSelectionChange = function(e) {" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.function", "-" ],
[ "string", " var session = this.getSession();" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.constant", "+" ],
[ "text", " var session = this.session;" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " if (session.$selectionMarker) {" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " session.removeMarker(session.$selectionMarker);" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "constant", "@@" ],
[ "constant.numeric", " -509,12 +509,40 " ],
[ "constant", "@@" ],
[ "comment.doc.tag", " var Editor = function(renderer, session) {" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " this.$updateHighlightActiveLine();" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " }" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.function", "-" ],
[ "string", " var self = this;" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.function", "-" ],
[ "string", " if (this.$highlightSelectedWord && !this.$wordHighlightTimer)" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.function", "-" ],
[ "string", " this.$wordHighlightTimer = setTimeout(function() {" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.function", "-" ],
[ "string", " self.session.$mode.highlightSelection(self);" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.function", "-" ],
[ "string", " self.$wordHighlightTimer = null;" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.function", "-" ],
[ "string", " }, 30, this);" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.constant", "+" ],
[ "text", " var re = this.$highlightSelectedWord && this.$getSelectionHighLightRegexp()" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", " };" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "variable", "diff" ],
[ "variable", " --git" ],
[ "keyword", " a/lib/ace/search_highlight.js" ],
[ "variable", " b/lib/ace/search_highlight.js" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "invisible", "new file mode 100644" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "variable", "index 0000000..b2df779" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "constant.numeric", "---" ],
[ "meta.tag", " /dev/null" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "constant.numeric", "+++" ],
[ "meta.tag", " b/lib/ace/search_highlight.js" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "constant", "@@" ],
[ "constant.numeric", " -0,0 +1,3 " ],
[ "constant", "@@" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.constant", "+" ],
[ "text", "new" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "support.constant", "+" ],
[ "text", "empty file" ]
]
}
]
@@ -0,0 +1,185 @@
[
{
"state": "start",
"data": [
[ "keyword", "uniform" ],
[ "text", " " ],
[ "keyword", "float" ],
[ "text", " " ],
[ "identifier", "amplitude" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "attribute" ],
[ "text", " " ],
[ "keyword", "float" ],
[ "text", " " ],
[ "identifier", "displacement" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "varying" ],
[ "text", " " ],
[ "keyword", "vec3" ],
[ "text", " " ],
[ "identifier", "vNormal" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "void" ],
[ "text", " " ],
[ "entity.name.function", "main" ],
[ "paren.lparen", "(" ],
[ "paren.rparen", ")" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "vNormal" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "identifier", "normal" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "comment", "// multiply our displacement by the" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "comment", "// amplitude. The amp will get animated" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "comment", "// so we'll have animated displacement" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "vec3" ],
[ "text", " " ],
[ "identifier", "newPosition" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "identifier", "position" ],
[ "text", " " ],
[ "keyword.operator", "+" ],
[ "text", " " ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "normal" ],
[ "text", " " ],
[ "keyword.operator", "*" ],
[ "text", " " ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "vec3" ],
[ "paren.lparen", "(" ],
[ "identifier", "displacement" ],
[ "text", " " ],
[ "keyword.operator", "*" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "amplitude" ],
[ "paren.rparen", ")" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "constant.language", "gl_Position" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "identifier", "projectionMatrix" ],
[ "text", " " ],
[ "keyword.operator", "*" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "modelViewMatrix" ],
[ "text", " " ],
[ "keyword.operator", "*" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "vec4" ],
[ "paren.lparen", "(" ],
[ "identifier", "newPosition" ],
[ "punctuation.operator", "," ],
[ "constant.numeric", "1.0" ],
[ "paren.rparen", ")" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
}
]
@@ -0,0 +1,362 @@
[
{
"state": "start",
"data": [
[ "comment", "// Concurrent computation of pi." ]
]
},
{
"state": "start",
"data": [
[ "comment", "// See http://goo.gl/ZuTZM." ]
]
},
{
"state": "start",
"data": [
[ "comment", "//" ]
]
},
{
"state": "start",
"data": [
[ "comment", "// This demonstrates Go's ability to handle" ]
]
},
{
"state": "start",
"data": [
[ "comment", "// large numbers of concurrent processes." ]
]
},
{
"state": "start",
"data": [
[ "comment", "// It is an unreasonable way to calculate pi." ]
]
},
{
"state": "start",
"data": [
[ "keyword", "package" ],
[ "text", " " ],
[ "identifier", "main" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "import" ],
[ "text", " " ],
[ "paren.lparen", "(" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "string", "\"fmt\"" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "string", "\"math\"" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "func" ],
[ "text", " " ],
[ "identifier", "main" ],
[ "paren.lparen", "(" ],
[ "paren.rparen", ")" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "fmt" ],
[ "punctuation.operator", "." ],
[ "identifier", "Println" ],
[ "paren.lparen", "(" ],
[ "identifier", "pi" ],
[ "paren.lparen", "(" ],
[ "constant.numeric", "5000" ],
[ "paren.rparen", ")" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "comment", "// pi launches n goroutines to compute an" ]
]
},
{
"state": "start",
"data": [
[ "comment", "// approximation of pi." ]
]
},
{
"state": "start",
"data": [
[ "keyword", "func" ],
[ "text", " " ],
[ "identifier", "pi" ],
[ "paren.lparen", "(" ],
[ "identifier", "n" ],
[ "text", " " ],
[ "identifier", "int" ],
[ "paren.rparen", ")" ],
[ "text", " " ],
[ "identifier", "float64" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "ch" ],
[ "text", " " ],
[ "punctuation.operator", ":" ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "identifier", "make" ],
[ "paren.lparen", "(" ],
[ "keyword", "chan" ],
[ "text", " " ],
[ "identifier", "float64" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "for" ],
[ "text", " " ],
[ "identifier", "k" ],
[ "text", " " ],
[ "punctuation.operator", ":" ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "constant.numeric", "0" ],
[ "punctuation.operator", ";" ],
[ "text", " " ],
[ "identifier", "k" ],
[ "text", " " ],
[ "keyword.operator", "<=" ],
[ "text", " " ],
[ "identifier", "n" ],
[ "punctuation.operator", ";" ],
[ "text", " " ],
[ "identifier", "k" ],
[ "keyword.operator", "++" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "go" ],
[ "text", " " ],
[ "identifier", "term" ],
[ "paren.lparen", "(" ],
[ "identifier", "ch" ],
[ "punctuation.operator", "," ],
[ "text", " " ],
[ "identifier", "float64" ],
[ "paren.lparen", "(" ],
[ "identifier", "k" ],
[ "paren.rparen", ")" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "f" ],
[ "text", " " ],
[ "punctuation.operator", ":" ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "constant.numeric", "0.0" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "for" ],
[ "text", " " ],
[ "identifier", "k" ],
[ "text", " " ],
[ "punctuation.operator", ":" ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "constant.numeric", "0" ],
[ "punctuation.operator", ";" ],
[ "text", " " ],
[ "identifier", "k" ],
[ "text", " " ],
[ "keyword.operator", "<=" ],
[ "text", " " ],
[ "identifier", "n" ],
[ "punctuation.operator", ";" ],
[ "text", " " ],
[ "identifier", "k" ],
[ "keyword.operator", "++" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "f" ],
[ "text", " " ],
[ "keyword.operator", "+" ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "keyword.operator", "<" ],
[ "keyword.operator", "-" ],
[ "identifier", "ch" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "return" ],
[ "text", " " ],
[ "identifier", "f" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "func" ],
[ "text", " " ],
[ "identifier", "term" ],
[ "paren.lparen", "(" ],
[ "identifier", "ch" ],
[ "text", " " ],
[ "keyword", "chan" ],
[ "text", " " ],
[ "identifier", "float64" ],
[ "punctuation.operator", "," ],
[ "text", " " ],
[ "identifier", "k" ],
[ "text", " " ],
[ "identifier", "float64" ],
[ "paren.rparen", ")" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "ch" ],
[ "text", " " ],
[ "keyword.operator", "<" ],
[ "keyword.operator", "-" ],
[ "text", " " ],
[ "constant.numeric", "4" ],
[ "text", " " ],
[ "keyword.operator", "*" ],
[ "text", " " ],
[ "identifier", "math" ],
[ "punctuation.operator", "." ],
[ "identifier", "Pow" ],
[ "paren.lparen", "(" ],
[ "constant.numeric", "-1" ],
[ "punctuation.operator", "," ],
[ "text", " " ],
[ "identifier", "k" ],
[ "paren.rparen", ")" ],
[ "text", " / " ],
[ "paren.lparen", "(" ],
[ "constant.numeric", "2" ],
[ "keyword.operator", "*" ],
[ "identifier", "k" ],
[ "text", " " ],
[ "keyword.operator", "+" ],
[ "text", " " ],
[ "constant.numeric", "1" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": []
}
]
@@ -0,0 +1,529 @@
[
{
"state": "start",
"data": [
[ "comment", "//http://groovy.codehaus.org/Martin+Fowler%27s+closure+examples+in+Groovy" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "class" ],
[ "text", " " ],
[ "identifier", "Employee" ],
[ "text", " " ],
[ "lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "def" ],
[ "text", " " ],
[ "identifier", "name" ],
[ "text", ", " ],
[ "identifier", "salary" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "boolean" ],
[ "text", " " ],
[ "identifier", "manager" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "support.function", "String" ],
[ "text", " " ],
[ "identifier", "toString" ],
[ "lparen", "(" ],
[ "rparen", ")" ],
[ "text", " " ],
[ "lparen", "{" ],
[ "text", " " ],
[ "keyword", "return" ],
[ "text", " " ],
[ "identifier", "name" ],
[ "text", " " ],
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "def" ],
[ "text", " " ],
[ "identifier", "emps" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "lparen", "[" ],
[ "keyword", "new" ],
[ "text", " " ],
[ "identifier", "Employee" ],
[ "lparen", "(" ],
[ "identifier", "name" ],
[ "text", ":" ],
[ "string", "'Guillaume'" ],
[ "text", ", " ],
[ "identifier", "manager" ],
[ "text", ":" ],
[ "constant.language.boolean", "true" ],
[ "text", ", " ],
[ "identifier", "salary" ],
[ "text", ":" ],
[ "constant.numeric", "200" ],
[ "rparen", ")" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "new" ],
[ "text", " " ],
[ "identifier", "Employee" ],
[ "lparen", "(" ],
[ "identifier", "name" ],
[ "text", ":" ],
[ "string", "'Graeme'" ],
[ "text", ", " ],
[ "identifier", "manager" ],
[ "text", ":" ],
[ "constant.language.boolean", "true" ],
[ "text", ", " ],
[ "identifier", "salary" ],
[ "text", ":" ],
[ "constant.numeric", "200" ],
[ "rparen", ")" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "new" ],
[ "text", " " ],
[ "identifier", "Employee" ],
[ "lparen", "(" ],
[ "identifier", "name" ],
[ "text", ":" ],
[ "string", "'Dierk'" ],
[ "text", ", " ],
[ "identifier", "manager" ],
[ "text", ":" ],
[ "constant.language.boolean", "false" ],
[ "text", ", " ],
[ "identifier", "salary" ],
[ "text", ":" ],
[ "constant.numeric", "151" ],
[ "rparen", ")" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "new" ],
[ "text", " " ],
[ "identifier", "Employee" ],
[ "lparen", "(" ],
[ "identifier", "name" ],
[ "text", ":" ],
[ "string", "'Bernd'" ],
[ "text", ", " ],
[ "identifier", "manager" ],
[ "text", ":" ],
[ "constant.language.boolean", "false" ],
[ "text", ", " ],
[ "identifier", "salary" ],
[ "text", ":" ],
[ "constant.numeric", "50" ],
[ "rparen", ")" ],
[ "rparen", "]" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "def" ],
[ "text", " " ],
[ "identifier", "managers" ],
[ "lparen", "(" ],
[ "identifier", "emps" ],
[ "rparen", ")" ],
[ "text", " " ],
[ "lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "emps" ],
[ "text", "." ],
[ "identifier", "findAll" ],
[ "text", " " ],
[ "lparen", "{" ],
[ "text", " " ],
[ "identifier", "e" ],
[ "text", " " ],
[ "keyword.operator", "-" ],
[ "keyword.operator", ">" ],
[ "text", " " ],
[ "identifier", "e" ],
[ "text", "." ],
[ "identifier", "isManager" ],
[ "lparen", "(" ],
[ "rparen", ")" ],
[ "text", " " ],
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "assert" ],
[ "text", " " ],
[ "identifier", "emps" ],
[ "lparen", "[" ],
[ "constant.numeric", "0" ],
[ "text", ".." ],
[ "constant.numeric", "1" ],
[ "rparen", "]" ],
[ "text", " " ],
[ "keyword.operator", "==" ],
[ "text", " " ],
[ "identifier", "managers" ],
[ "lparen", "(" ],
[ "identifier", "emps" ],
[ "rparen", ")" ],
[ "text", " " ],
[ "comment", "// [Guillaume, Graeme]" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "def" ],
[ "text", " " ],
[ "identifier", "highPaid" ],
[ "lparen", "(" ],
[ "identifier", "emps" ],
[ "rparen", ")" ],
[ "text", " " ],
[ "lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "threshold" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "constant.numeric", "150" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "identifier", "emps" ],
[ "text", "." ],
[ "identifier", "findAll" ],
[ "text", " " ],
[ "lparen", "{" ],
[ "text", " " ],
[ "identifier", "e" ],
[ "text", " " ],
[ "keyword.operator", "-" ],
[ "keyword.operator", ">" ],
[ "text", " " ],
[ "identifier", "e" ],
[ "text", "." ],
[ "identifier", "salary" ],
[ "text", " " ],
[ "keyword.operator", ">" ],
[ "text", " " ],
[ "identifier", "threshold" ],
[ "text", " " ],
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "assert" ],
[ "text", " " ],
[ "identifier", "emps" ],
[ "lparen", "[" ],
[ "constant.numeric", "0" ],
[ "text", ".." ],
[ "constant.numeric", "2" ],
[ "rparen", "]" ],
[ "text", " " ],
[ "keyword.operator", "==" ],
[ "text", " " ],
[ "identifier", "highPaid" ],
[ "lparen", "(" ],
[ "identifier", "emps" ],
[ "rparen", ")" ],
[ "text", " " ],
[ "comment", "// [Guillaume, Graeme, Dierk]" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "def" ],
[ "text", " " ],
[ "identifier", "paidMore" ],
[ "lparen", "(" ],
[ "identifier", "amount" ],
[ "rparen", ")" ],
[ "text", " " ],
[ "lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "lparen", "{" ],
[ "text", " " ],
[ "identifier", "e" ],
[ "text", " " ],
[ "keyword.operator", "-" ],
[ "keyword.operator", ">" ],
[ "text", " " ],
[ "identifier", "e" ],
[ "text", "." ],
[ "identifier", "salary" ],
[ "text", " " ],
[ "keyword.operator", ">" ],
[ "text", " " ],
[ "identifier", "amount" ],
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "def" ],
[ "text", " " ],
[ "identifier", "highPaid" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "identifier", "paidMore" ],
[ "lparen", "(" ],
[ "constant.numeric", "150" ],
[ "rparen", ")" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "assert" ],
[ "text", " " ],
[ "identifier", "highPaid" ],
[ "lparen", "(" ],
[ "identifier", "emps" ],
[ "lparen", "[" ],
[ "constant.numeric", "0" ],
[ "rparen", "]" ],
[ "rparen", ")" ],
[ "text", " " ],
[ "comment", "// true" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "assert" ],
[ "text", " " ],
[ "identifier", "emps" ],
[ "lparen", "[" ],
[ "constant.numeric", "0" ],
[ "text", ".." ],
[ "constant.numeric", "2" ],
[ "rparen", "]" ],
[ "text", " " ],
[ "keyword.operator", "==" ],
[ "text", " " ],
[ "identifier", "emps" ],
[ "text", "." ],
[ "identifier", "findAll" ],
[ "lparen", "(" ],
[ "identifier", "highPaid" ],
[ "rparen", ")" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "def" ],
[ "text", " " ],
[ "identifier", "filename" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "string", "'test.txt'" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "new" ],
[ "text", " " ],
[ "identifier", "File" ],
[ "lparen", "(" ],
[ "identifier", "filename" ],
[ "rparen", ")" ],
[ "text", "." ],
[ "identifier", "withReader" ],
[ "lparen", "{" ],
[ "text", " " ],
[ "identifier", "reader" ],
[ "text", " " ],
[ "keyword.operator", "-" ],
[ "keyword.operator", ">" ],
[ "text", " " ],
[ "identifier", "doSomethingWith" ],
[ "lparen", "(" ],
[ "identifier", "reader" ],
[ "rparen", ")" ],
[ "text", " " ],
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "def" ],
[ "text", " " ],
[ "identifier", "readersText" ]
]
},
{
"state": "start",
"data": [
[ "keyword", "def" ],
[ "text", " " ],
[ "identifier", "doSomethingWith" ],
[ "lparen", "(" ],
[ "identifier", "reader" ],
[ "rparen", ")" ],
[ "text", " " ],
[ "lparen", "{" ],
[ "text", " " ],
[ "identifier", "readersText" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "identifier", "reader" ],
[ "text", "." ],
[ "identifier", "text" ],
[ "text", " " ],
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "keyword", "assert" ],
[ "text", " " ],
[ "keyword", "new" ],
[ "text", " " ],
[ "identifier", "File" ],
[ "lparen", "(" ],
[ "identifier", "filename" ],
[ "rparen", ")" ],
[ "text", "." ],
[ "identifier", "text" ],
[ "text", " " ],
[ "keyword.operator", "==" ],
[ "text", " " ],
[ "identifier", "readersText" ]
]
}
]
@@ -0,0 +1,195 @@
[
{
"state": "start",
"data": [
[ "keyword", "class" ],
[ "text", " " ],
[ "identifier", "Haxe" ],
[ "text", " " ]
]
},
{
"state": "start",
"data": [
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "public" ],
[ "text", " " ],
[ "keyword", "static" ],
[ "text", " " ],
[ "keyword", "function" ],
[ "text", " " ],
[ "identifier", "main" ],
[ "paren.lparen", "(" ],
[ "paren.rparen", ")" ],
[ "text", " " ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "comment", "// Say Hello!" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "var" ],
[ "text", " " ],
[ "identifier", "greeting" ],
[ "punctuation.operator", ":" ],
[ "keyword", "String" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "string", "\"Hello World\"" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "trace" ],
[ "paren.lparen", "(" ],
[ "identifier", "greeting" ],
[ "paren.rparen", ")" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "var" ],
[ "text", " " ],
[ "identifier", "targets" ],
[ "punctuation.operator", ":" ],
[ "keyword", "Array" ],
[ "keyword.operator", "<" ],
[ "keyword", "String" ],
[ "keyword.operator", ">" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "paren.lparen", "[" ],
[ "string", "\"Flash\"" ],
[ "punctuation.operator", "," ],
[ "string", "\"Javascript\"" ],
[ "punctuation.operator", "," ],
[ "string", "\"PHP\"" ],
[ "punctuation.operator", "," ],
[ "string", "\"Neko\"" ],
[ "punctuation.operator", "," ],
[ "string", "\"C++\"" ],
[ "punctuation.operator", "," ],
[ "string", "\"iOS\"" ],
[ "punctuation.operator", "," ],
[ "string", "\"Android\"" ],
[ "punctuation.operator", "," ],
[ "string", "\"webOS\"" ],
[ "paren.rparen", "]" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "trace" ],
[ "paren.lparen", "(" ],
[ "string", "\"Haxe is a great language that can target:\"" ],
[ "paren.rparen", ")" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "for" ],
[ "text", " " ],
[ "paren.lparen", "(" ],
[ "identifier", "target" ],
[ "text", " " ],
[ "keyword", "in" ],
[ "text", " " ],
[ "identifier", "targets" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "trace" ],
[ "text", " " ],
[ "paren.lparen", "(" ],
[ "string", "\" - \"" ],
[ "text", " " ],
[ "keyword.operator", "+" ],
[ "text", " " ],
[ "identifier", "target" ],
[ "paren.rparen", ")" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "trace" ],
[ "paren.lparen", "(" ],
[ "string", "\"And many more!\"" ],
[ "paren.rparen", ")" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
}
]
@@ -0,0 +1,150 @@
[
{
"state": "start",
"data": [
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "html" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "head" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "css-start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name.style", "style" ],
[ "text", " " ],
[ "entity.other.attribute-name", "type" ],
[ "keyword.operator", "=" ],
[ "string", "\"text/css\"" ],
[ "meta.tag", ">" ]
]
},
{
"state": "css-ruleset",
"data": [
[ "text", " " ],
[ "variable", ".text-layer" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "css-ruleset",
"data": [
[ "text", " " ],
[ "support.type", "font-family" ],
[ "text", ": Monaco, " ],
[ "string", "\"Courier New\"" ],
[ "text", ", " ],
[ "support.constant.fonts", "monospace" ],
[ "text", ";" ]
]
},
{
"state": "css-ruleset",
"data": [
[ "text", " " ],
[ "support.type", "font-size" ],
[ "text", ": " ],
[ "constant.numeric", "12" ],
[ "keyword", "px" ],
[ "text", ";" ]
]
},
{
"state": "css-ruleset",
"data": [
[ "text", " " ],
[ "support.type", "cursor" ],
[ "text", ": " ],
[ "support.constant", "text" ],
[ "text", ";" ]
]
},
{
"state": "css-start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name.style", "style" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "head" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "body" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "<" ],
[ "meta.tag.tag-name", "h1" ],
[ "text", " " ],
[ "entity.other.attribute-name", "style" ],
[ "keyword.operator", "=" ],
[ "string", "\"color:red\"" ],
[ "meta.tag", ">" ],
[ "text", "Juhu Kinners" ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "h1" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "body" ],
[ "meta.tag", ">" ]
]
},
{
"state": "start",
"data": [
[ "meta.tag", "</" ],
[ "meta.tag.tag-name", "html" ],
[ "meta.tag", ">" ]
]
}
]
@@ -0,0 +1,139 @@
[
{
"state": "start",
"data": [
[ "keyword", "public" ],
[ "text", " " ],
[ "keyword", "class" ],
[ "text", " " ],
[ "identifier", "InfiniteLoop" ],
[ "text", " " ],
[ "lparen", "{" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "comment",
"data": [
[ "text", " " ],
[ "comment", "/*" ]
]
},
{
"state": "comment",
"data": [
[ "comment", " * This will cause the program to hang..." ]
]
},
{
"state": "comment",
"data": [
[ "comment", " *" ]
]
},
{
"state": "comment",
"data": [
[ "comment", " * Taken from:" ]
]
},
{
"state": "comment",
"data": [
[ "comment", " * http://www.exploringbinary.com/java-hangs-when-converting-2-2250738585072012e-308/" ]
]
},
{
"state": "start",
"data": [
[ "comment", " */" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "public" ],
[ "text", " " ],
[ "keyword", "static" ],
[ "text", " " ],
[ "keyword", "void" ],
[ "text", " " ],
[ "identifier", "main" ],
[ "lparen", "(" ],
[ "support.function", "String" ],
[ "lparen", "[" ],
[ "rparen", "]" ],
[ "text", " " ],
[ "identifier", "args" ],
[ "rparen", ")" ],
[ "text", " " ],
[ "lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "keyword", "double" ],
[ "text", " " ],
[ "identifier", "d" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "support.function", "Double" ],
[ "text", "." ],
[ "identifier", "parseDouble" ],
[ "lparen", "(" ],
[ "string", "\"2.2250738585072012e-308\"" ],
[ "rparen", ")" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "comment", "// unreachable code" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "support.function", "System" ],
[ "text", "." ],
[ "identifier", "out" ],
[ "text", "." ],
[ "identifier", "println" ],
[ "lparen", "(" ],
[ "string", "\"Value: \"" ],
[ "text", " " ],
[ "keyword.operator", "+" ],
[ "text", " " ],
[ "identifier", "d" ],
[ "rparen", ")" ],
[ "text", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "rparen", "}" ]
]
}
]
@@ -0,0 +1,555 @@
[
{
"state": "regex_allowed",
"data": [
[ "storage.type", "function" ],
[ "text", " " ],
[ "entity.name.function", "foo" ],
[ "paren.lparen", "(" ],
[ "variable.parameter", "items" ],
[ "punctuation.operator", ", " ],
[ "variable.parameter", "nada" ],
[ "paren.rparen", ")" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "regex_allowed",
"data": [
[ "text", " " ],
[ "keyword", "for" ],
[ "text", " " ],
[ "paren.lparen", "(" ],
[ "storage.type", "var" ],
[ "text", " " ],
[ "identifier", "i" ],
[ "keyword.operator", "=" ],
[ "constant.numeric", "0" ],
[ "punctuation.operator", ";" ],
[ "text", " " ],
[ "identifier", "i" ],
[ "keyword.operator", "<" ],
[ "identifier", "items" ],
[ "punctuation.operator", "." ],
[ "support.constant", "length" ],
[ "punctuation.operator", ";" ],
[ "text", " " ],
[ "identifier", "i" ],
[ "keyword.operator", "++" ],
[ "paren.rparen", ")" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "regex_allowed",
"data": [
[ "text", " " ],
[ "identifier", "alert" ],
[ "paren.lparen", "(" ],
[ "identifier", "items" ],
[ "paren.lparen", "[" ],
[ "identifier", "i" ],
[ "paren.rparen", "]" ],
[ "text", " " ],
[ "keyword.operator", "+" ],
[ "text", " " ],
[ "string", "\"juhu" ],
[ "constant.language.escape", "\\n" ],
[ "string", "\"" ],
[ "paren.rparen", ")" ],
[ "punctuation.operator", ";" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ],
[ "text", "\t" ],
[ "comment", "// Real Tab." ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "identifier", "regexp" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "string.regexp", "/p" ],
[ "constant.language.escape", "|" ],
[ "string.regexp", "p/" ],
[ "text", " " ],
[ "comment", "// ends here" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "identifier", "r" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "string.regexp", "/d" ],
[ "constant.language.escape", "{1,2}" ],
[ "constant.language.escape", "?" ],
[ "string.regexp", "f{e}" ],
[ "invalid", "++" ],
[ "string.regexp", "r" ],
[ "constant.language.escape", "*?" ],
[ "regexp.keyword.operator", "\\d" ],
[ "constant.language.escape", "+?[]" ],
[ "string.regexp", "r" ],
[ "constant.language.escape", "[^" ],
[ "string.regexp.charachterclass", "r" ],
[ "constant.language.escape", "-" ],
[ "string.regexp.charachterclass", "o" ],
[ "regexp.keyword.operator", "\\f" ],
[ "regexp.keyword.operator", "\\f" ],
[ "string.regexp.charachterclass", "[" ],
[ "regexp.keyword.operator", "\\f" ],
[ "constant.language.escape", "]" ],
[ "constant.language.escape", "?" ],
[ "string.regexp", "r" ],
[ "invalid", "{7}+" ],
[ "string.regexp", "r" ],
[ "regexp.keyword.operator", "\\{" ],
[ "string.regexp", "7}" ],
[ "constant.language.escape", "+" ],
[ "string.regexp", "rr--rr" ],
[ "constant.language.escape", "$" ],
[ "constant.language.escape", "^" ],
[ "constant.language.escape", "(?:" ],
[ "string.regexp", "d" ],
[ "constant.language.escape", "|" ],
[ "string.regexp", "s" ],
[ "constant.language.escape", ")" ],
[ "constant.language.escape", "(?=" ],
[ "string.regexp", "a" ],
[ "constant.language.escape", "|" ],
[ "constant.language.escape", ")" ],
[ "constant.language.escape", "(?!" ],
[ "string.regexp", "y" ],
[ "constant.language.escape", ")[]" ],
[ "constant.language.escape", "|" ],
[ "constant.language.escape", "$" ],
[ "constant.language.escape", "?" ],
[ "constant.language.escape", "|" ],
[ "invalid", "^*" ],
[ "string.regexp", "/" ],
[ "text", " " ],
[ "identifier", "o" ]
]
},
{
"state": "start",
"data": [
[ "identifier", "a" ],
[ "keyword.operator", "=" ],
[ "string.regexp", "/a/" ],
[ "text", " " ],
[ "identifier", "jk" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "string.regexp", "/ /" ],
[ "text", " " ],
[ "keyword.operator", "/" ],
[ "text", " " ],
[ "string.regexp", "/ /" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "comment.doc", "/************************************/" ]
]
},
{
"state": "start",
"data": [
[ "comment.doc", "/** total mess, tricky to highlight**/" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "regex_allowed",
"data": [
[ "storage.type", "function" ],
[ "text", " " ],
[ "paren.lparen", "(" ],
[ "paren.rparen", ")" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "doc-start",
"data": [
[ "text", "\t" ],
[ "comment.doc", "/**" ]
]
},
{
"state": "doc-start",
"data": [
[ "comment.doc", "\t * docComment" ]
]
},
{
"state": "start",
"data": [
[ "comment.doc", "\t **/" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t" ],
[ "identifier", "r" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "string.regexp", "/u" ],
[ "regexp.keyword.operator", "\\t" ],
[ "constant.language.escape", "*" ],
[ "string.regexp", "/" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t" ],
[ "identifier", "g" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "constant.numeric", "1." ],
[ "text", "00" ],
[ "identifier", "E" ],
[ "text", "^" ],
[ "constant.numeric", "1" ],
[ "punctuation.operator", "," ],
[ "text", " " ],
[ "identifier", "y" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "constant.numeric", "1.2" ],
[ "text", " " ],
[ "keyword.operator", "+" ],
[ "text", " " ],
[ "punctuation.operator", "." ],
[ "constant.numeric", "2" ],
[ "text", " " ],
[ "keyword.operator", "+" ],
[ "text", " " ],
[ "constant.numeric", "052" ],
[ "text", " " ],
[ "keyword.operator", "+" ],
[ "text", " " ],
[ "constant.numeric", "0x25" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t" ],
[ "identifier", "t" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "paren.lparen", "[" ],
[ "string", "'d'" ],
[ "punctuation.operator", "," ],
[ "text", " " ],
[ "string", "''" ],
[ "paren.rparen", "]" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
},
{
"state": "regex_allowed",
"data": [
[ "storage.type", "function" ],
[ "text", " " ],
[ "paren.lparen", "(" ],
[ "paren.rparen", ")" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "regex_allowed",
"data": [
[ "text", "\t" ],
[ "comment", "/* eee */" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "qqstring",
"data": [
[ "string", "\"s\\" ]
]
},
{
"state": "start",
"data": [
[ "string", "s" ],
[ "constant.language.escape", "\\u7824" ],
[ "string", "sss" ],
[ "constant.language.escape", "\\u" ],
[ "string", "1\"" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "qstring",
"data": [
[ "string", "'\\" ]
]
},
{
"state": "start",
"data": [
[ "string", "string'" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "text", "'" ]
]
},
{
"state": "start",
"data": [
[ "identifier", "string" ],
[ "text", "'" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": [
[ "string", "\"trailing space" ],
[ "constant.language.escape", "\\ " ],
[ "string", " " ]
]
},
{
"state": "start",
"data": [
[ "string", "\" \"" ],
[ "text", " " ],
[ "keyword.operator", "/" ],
[ "identifier", "not" ],
[ "text", " " ],
[ "identifier", "a" ],
[ "text", " " ],
[ "identifier", "regexp" ],
[ "keyword.operator", "/" ],
[ "identifier", "g" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "doc-start",
"data": [
[ "comment.doc", "/**" ]
]
},
{
"state": "doc-start",
"data": [
[ "comment.doc", " *doc" ]
]
},
{
"state": "start",
"data": [
[ "comment.doc", " */" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "regex_allowed",
"data": [
[ "identifier", "a" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "regex_allowed",
"data": [
[ "text", "\t" ],
[ "string", "'a'" ],
[ "punctuation.operator", ":" ],
[ "text", " " ],
[ "identifier", "b" ],
[ "punctuation.operator", "," ]
]
},
{
"state": "start",
"data": [
[ "text", "\t" ],
[ "string", "'g'" ],
[ "text", ": " ],
[ "storage.type", "function" ],
[ "paren.lparen", "(" ],
[ "variable.parameter", "t" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "text", "\t" ],
[ "entity.name.function", "gta" ],
[ "punctuation.operator", ":" ],
[ "storage.type", "function" ],
[ "paren.lparen", "(" ],
[ "variable.parameter", "a" ],
[ "punctuation.operator", "," ],
[ "variable.parameter", "b" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": []
},
{
"state": "start",
"data": []
},
{
"state": "function_arguments",
"data": [
[ "identifier", "foo" ],
[ "punctuation.operator", "." ],
[ "storage.type", "protoype" ],
[ "punctuation.operator", "." ],
[ "entity.name.function", "d" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "text", " " ],
[ "storage.type", "function" ],
[ "paren.lparen", "(" ],
[ "variable.parameter", "a" ],
[ "punctuation.operator", ", " ],
[ "variable.parameter", "b" ],
[ "punctuation.operator", "," ]
]
},
{
"state": "start",
"data": [
[ "punctuation.operator", " " ],
[ "variable.parameter", "c" ],
[ "punctuation.operator", ", " ],
[ "variable.parameter", "d" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "storage.type", "foo" ],
[ "punctuation.operator", "." ],
[ "entity.name.function", "d" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "storage.type", "function" ],
[ "paren.lparen", "(" ],
[ "variable.parameter", "a" ],
[ "punctuation.operator", ", " ],
[ "variable.parameter", "b" ],
[ "paren.rparen", ")" ]
]
},
{
"state": "start",
"data": [
[ "storage.type", "foo" ],
[ "punctuation.operator", "." ],
[ "entity.name.function", "d" ],
[ "text", " " ],
[ "keyword.operator", "=" ],
[ "storage.type", "function" ],
[ "paren.lparen", "(" ],
[ "variable.parameter", "a" ],
[ "punctuation.operator", ", " ],
[ "comment.doc", "/*****/" ],
[ "text", " " ],
[ "identifier", "d" ],
[ "string", "\"string\"" ],
[ "text", " " ]
]
},
{
"state": "start",
"data": []
}
]
@@ -0,0 +1,611 @@
[
{
"state": "start",
"data": [
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"query\"" ],
[ "text", ": " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"count\"" ],
[ "text", ": " ],
[ "constant.numeric", "10" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"created\"" ],
[ "text", ": " ],
[ "string", "\"2011-06-21T08:10:46Z\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"lang\"" ],
[ "text", ": " ],
[ "string", "\"en-US\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"results\"" ],
[ "text", ": " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"photo\"" ],
[ "text", ": " ],
[ "paren.lparen", "[" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"farm\"" ],
[ "text", ": " ],
[ "string", "\"6\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"id\"" ],
[ "text", ": " ],
[ "string", "\"5855620975\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"isfamily\"" ],
[ "text", ": " ],
[ "string", "\"0\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"isfriend\"" ],
[ "text", ": " ],
[ "string", "\"0\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"ispublic\"" ],
[ "text", ": " ],
[ "string", "\"1\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"owner\"" ],
[ "text", ": " ],
[ "string", "\"32021554@N04\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"secret\"" ],
[ "text", ": " ],
[ "string", "\"f1f5e8515d\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"server\"" ],
[ "text", ": " ],
[ "string", "\"5110\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"title\"" ],
[ "text", ": " ],
[ "string", "\"7087 bandit cat\"" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"farm\"" ],
[ "text", ": " ],
[ "string", "\"4\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"id\"" ],
[ "text", ": " ],
[ "string", "\"5856170534\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"isfamily\"" ],
[ "text", ": " ],
[ "string", "\"0\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"isfriend\"" ],
[ "text", ": " ],
[ "string", "\"0\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"ispublic\"" ],
[ "text", ": " ],
[ "string", "\"1\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"owner\"" ],
[ "text", ": " ],
[ "string", "\"32021554@N04\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"secret\"" ],
[ "text", ": " ],
[ "string", "\"ff1efb2a6f\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"server\"" ],
[ "text", ": " ],
[ "string", "\"3217\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"title\"" ],
[ "text", ": " ],
[ "string", "\"6975 rusty cat\"" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"farm\"" ],
[ "text", ": " ],
[ "string", "\"6\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"id\"" ],
[ "text", ": " ],
[ "string", "\"5856172972\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"isfamily\"" ],
[ "text", ": " ],
[ "string", "\"0\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"isfriend\"" ],
[ "text", ": " ],
[ "string", "\"0\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"ispublic\"" ],
[ "text", ": " ],
[ "string", "\"1\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"owner\"" ],
[ "text", ": " ],
[ "string", "\"51249875@N03\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"secret\"" ],
[ "text", ": " ],
[ "string", "\"6c6887347c\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"server\"" ],
[ "text", ": " ],
[ "string", "\"5192\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"title\"" ],
[ "text", ": " ],
[ "string", "\"watermarked-cats\"" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"farm\"" ],
[ "text", ": " ],
[ "string", "\"6\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"id\"" ],
[ "text", ": " ],
[ "string", "\"5856168328\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"isfamily\"" ],
[ "text", ": " ],
[ "string", "\"0\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"isfriend\"" ],
[ "text", ": " ],
[ "string", "\"0\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"ispublic\"" ],
[ "text", ": " ],
[ "string", "\"1\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"owner\"" ],
[ "text", ": " ],
[ "string", "\"32021554@N04\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"secret\"" ],
[ "text", ": " ],
[ "string", "\"0c1cfdf64c\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"server\"" ],
[ "text", ": " ],
[ "string", "\"5078\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"title\"" ],
[ "text", ": " ],
[ "string", "\"7020 mandy cat\"" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.lparen", "{" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"farm\"" ],
[ "text", ": " ],
[ "string", "\"3\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"id\"" ],
[ "text", ": " ],
[ "string", "\"5856171774\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"isfamily\"" ],
[ "text", ": " ],
[ "string", "\"0\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"isfriend\"" ],
[ "text", ": " ],
[ "string", "\"0\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"ispublic\"" ],
[ "text", ": " ],
[ "string", "\"1\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"owner\"" ],
[ "text", ": " ],
[ "string", "\"32021554@N04\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"secret\"" ],
[ "text", ": " ],
[ "string", "\"7f5a3180ab\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"server\"" ],
[ "text", ": " ],
[ "string", "\"2696\"" ],
[ "text", "," ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "variable", "\"title\"" ],
[ "text", ": " ],
[ "string", "\"7448 bobby cat\"" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "]" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "text", " " ],
[ "paren.rparen", "}" ]
]
},
{
"state": "start",
"data": [
[ "paren.rparen", "}" ]
]
}
]

Some files were not shown because too many files have changed in this diff Show More