Commit Graph

255 Commits

Author SHA1 Message Date
Daniel Imms
fe905bace5 Prevent the page from scrolling when the terminal scrolls 2016-08-03 12:49:12 -07:00
Daniel Imms
e7e1434293 Clean up, refresh sizes when font-size changes 2016-08-03 12:47:36 -07:00
Daniel Imms
363c647a5f Sync scroll bar on more sensible events 2016-08-03 11:27:16 -07:00
Daniel Imms
aac60eb029 Add support for WheelEvent.deltaMode 2016-08-03 10:16:08 -07:00
Daniel Imms
06ca03ae9c Get it working 2016-08-02 18:36:24 -07:00
Daniel Imms
ff927b8e79 Implement basic scroll bar 2016-08-02 16:59:50 -07:00
Daniel Imms
670b0d58c7 Add base viewport, set line height
Fixes #149
2016-08-02 12:42:13 -07:00
Daniel Imms
d62bd5f748 Get rid of rogue whitespace 2016-07-28 11:15:20 -07:00
Daniel Imms
e6fd1381ce Hide textarea off-screen when not composing
Fixes #209
2016-07-28 11:13:24 -07:00
Daniel Imms
495b2d7fbb Merge remote-tracking branch 'upstream/master' into 118_support_custom_keydown_handler 2016-07-22 05:12:52 -07:00
Daniel Imms
892db98c96 Correct blur/focus delegation
Focus and blur events on the Terminal object are delegated to the textarea
which handles everything.
2016-07-22 04:14:05 -07:00
Paris Kasidiaris
10fbf0dccc Merge pull request #175 from Tyriar/124_add_textarea_back
Add textarea back and support IMEs
2016-07-22 11:50:23 +03:00
Daniel Imms
4595a18197 Tidy up blur/focus handlers 2016-07-21 10:51:43 -07:00
Daniel Imms
577a3d81e5 Use explicit boolean comparison 2016-07-21 10:32:20 -07:00
Jörg Breitbart
ec7130b46f fixing arrow key sequences 2016-07-21 12:39:36 +02:00
Daniel Imms
0010a5a109 Explicitly return from keydown 2016-07-15 16:33:30 -07:00
Daniel Imms
9cb5b005bb Add tests 2016-07-15 16:31:57 -07:00
Daniel Imms
06a3aa6cf8 Merge remote-tracking branch 'upstream/master' into 118_support_custom_keydown_handler 2016-07-15 16:21:06 -07:00
Daniel Imms
d4e9d34d2d Allow custom keydown handler to be attached
Fixes #118
2016-07-15 16:16:37 -07:00
Daniel Imms
fedc1fd325 Fix keydown conditional 2016-07-15 10:17:29 -07:00
Daniel Imms
11d5f51e67 Merge remote-tracking branch 'upstream/master' into 124_add_textarea_back 2016-07-15 10:13:56 -07:00
Daniel Imms
534a9e7f5a Big clean up
Move keydown event to CompositionHelper
Move call in refresh to be handled with an event
2016-07-13 21:50:00 -07:00
Daniel Imms
89d29bbc10 Fix non-composition char input after composition char + test 2016-07-13 21:02:43 -07:00
Daniel Imms
ac8db6e8ec jsdoc handleAnyTextareaChanges 2016-07-13 20:52:55 -07:00
Daniel Imms
0a7c1bfd98 Position the textarea below the cursor during a composition
This will position any IME helper in the correct position
2016-07-13 20:46:43 -07:00
Daniel Imms
38d08873bc Don't finalize composition on modifier key presses 2016-07-13 20:34:43 -07:00
Daniel Imms
8074d754d3 Only position composition view if a cursor is visible 2016-07-13 20:12:49 -07:00
Daniel Imms
e1c1b07a0b Add test cases for Korean 2016-07-13 08:37:24 -07:00
Paris
42ec3b492a Clarify isThirdLevelShift 2016-07-13 17:53:33 +03:00
Daniel Imms
c18794f202 Merge remote-tracking branch 'upstream/master' into 124_add_textarea_back 2016-07-13 07:14:14 -07:00
Paris
0862fd1f59 Fix thirdLevelKey clause 2016-07-13 17:10:45 +03:00
Paris
3e8bb98197 Fix #169 2016-07-13 16:35:57 +03:00
Paris
11a7cd6983 Fix all leading whitespaces (eliminate tabs) 2016-07-13 13:24:53 +03:00
Paris
7d904e455d Fix leading whitespaces (eliminate tabs) 2016-07-13 13:22:51 +03:00
Paris
c3cf6a22e9 Document all public methods 2016-07-13 13:14:02 +03:00
Paris
12a150a438 Document more public methods and transform comments to JSDoc compatible 2016-07-13 13:03:40 +03:00
Daniel Imms
8b46e84263 Use correct .terminal-cursor for composition view 2016-07-12 21:42:10 -07:00
Daniel Imms
8faea59e31 Handle non-composition input when IME is active 2016-07-12 20:51:55 -07:00
Daniel Imms
cab79c473f jsdoc and tidy up 2016-07-12 20:26:18 -07:00
Daniel Imms
c656ed04b0 Use handler not write, fix other edge cases 2016-07-12 20:19:26 -07:00
Daniel Imms
29000fb79e Refactor into CompositionHelper object 2016-07-12 19:14:56 -07:00
Daniel Imms
26af6ffd4d Get IMEs working 2016-07-12 18:48:08 -07:00
Daniel Imms
7d8e28a7dd Merge remote-tracking branch 'upstream/master' into 124_add_textarea_back 2016-07-12 17:02:11 -07:00
Daniel Imms
a52b7e7a4e Add starting point for IME support 2016-07-12 16:50:07 -07:00
Daniel Imms
aaedcfc700 Support focus class on the .xterm element 2016-07-12 16:18:05 -07:00
Daniel Imms
fc7b22dc48 Manually revert textarea changes 2016-07-12 16:03:31 -07:00
Paris
f3cf646bbf Better document scrollDisp 2016-07-06 12:37:45 +03:00
Paris
a39b309b74 Remove most public directives 2016-07-06 12:36:11 +03:00
Paris
1aeb562066 progress 2016-07-06 09:32:40 +00:00
Paris
107d1a1496 First chunk of documentation 2016-07-06 09:32:40 +00:00
Paris Kasidiaris
39edbfb655 Merge pull request #163 from jerch/fix_147_162
fixing #147 and #162
2016-07-06 12:29:01 +03:00
Jörg Breitbart
4afa08da8d fixing #147 and #162 2016-07-05 23:54:15 +02:00
Paris Kasidiaris
30251e5d7c Merge pull request #160 from Tyriar/159_fix_nbsp_resize
Have ' ' chars get inserted correctly after a resize
2016-07-05 13:53:34 +03:00
Paris Kasidiaris
81e231ea20 Merge pull request #155 from Tyriar/154_fix_resize_at_top_exception
Fix exception when increasing size when viewport is at top of buffer
2016-07-05 12:56:45 +03:00
Daniel Imms
838c11b69c Have ' ' chars get inserted correctly after a resize
Since the character spec didn't contain a character width it was being skipped
during refresh.

Fixes #159
2016-07-04 13:17:08 -07:00
Daniel Imms
05041722f1 Correct if condition 2016-07-04 12:15:47 -07:00
Daniel Imms
87c9370e8c Fix exception when increasing size when viewport is at top of buffer
Fixes #154
2016-06-30 02:05:06 -07:00
TDaglis
0b018fd4e9 Fix Ctrl+Shift+V pasting 2016-06-30 10:58:00 +03:00
Benjamin Fischer
59b79e9b04 Fix MouseEvent cloning
Cloneing MouseEvent instances via __proto__ (lline 1099) caused the cloned object to be broken and throw "TypeError: Illegal invocation" during property access ("ev.shiftKey" line 1020).
2016-06-27 13:27:19 +02:00
Jörg Breitbart
c3bc59b5e1 adding unicode test cases 2016-06-26 12:50:06 +02:00
Jörg Breitbart
e3126ba3f8 cleanup 2016-06-25 10:12:21 +02:00
Jörg Breitbart
f951abb7a9 wcwidth only for printables 2016-06-24 16:25:00 +02:00
Jörg Breitbart
874ba72f4e wcwidth calculation 2016-06-24 14:16:12 +02:00
Paris
3217a4bee4 Fix cumbersome pasting with Cmd + V
For some reason, setting the element's contentEditable value to true within a keyboard event, while the element has focus, did not allow pasting with clipboard, unless the element gets clicked explicitly.
2016-06-19 06:12:25 +03:00
Paris
af7588ef16 On big refreshes remove term.rowContainer instead of term.element from DOM
Fix #120
2016-06-16 11:47:05 +03:00
Paris
a6e85ad5f5 Progress with #120 2016-06-16 11:41:41 +03:00
Paris Kasidiaris
d5e83902a5 Merge pull request #133 from Tyriar/132_fix_constant_focus
Only refresh when asked
2016-06-15 12:53:31 +03:00
Daniel Imms
0d803ac895 Use CSS animations 2016-06-14 10:52:49 -07:00
Daniel Imms
253babff62 Merge remote-tracking branch 'upstream/master' into 119_fix_cursor_blink 2016-06-14 10:36:56 -07:00
Daniel Imms
fac964bcf5 Only refresh when asked
Fixes #132
2016-06-14 10:33:24 -07:00
Paris Kasidiaris
02d809c194 Merge pull request #117 from Tyriar/86_protect_max_refresh
Bound refresh max rows to this.rows not this.lines
2016-06-14 11:11:04 +03:00
Paris Kasidiaris
e37a9b62b7 Merge pull request #128 from Tyriar/127_debounce_refresh
Allow refresh to execute 30 times a second maximum
2016-06-14 10:49:53 +03:00
Daniel Imms
af29effbf3 Allow refresh to execute 30 times a second maximum
For commands that pass a significant amount of output to the write function,
this prevents the terminal maxing out the CPU and making the UI unresponsive.
While commands can still run beyond what they do on the terminal, it is far
better with a debounce in place as every single terminal manipulation does not
need to be constructed in the DOM.

A side-effect of this is that it makes ^C to interrupt a process seem more
responsive.

Fixes #127
Fixes #126
2016-06-13 12:40:56 -07:00
Paris
57300f5159 Implement addon loader (CommonJS + RequireJS)
Closes #96
2016-06-13 19:07:29 +03:00
Daniel Imms
fd5be55d81 Add some jsdoc for important functions
Part of #13
2016-06-10 20:05:26 -07:00
Daniel Imms
cb4728f8f5 Tidy up code 2016-06-10 18:05:24 -07:00
Daniel Imms
4a71a41380 Fix cursor blinking when enabled
Fixes #119
2016-06-10 18:05:13 -07:00
Daniel Imms
edf897182e Bound refresh max rows to this.rows not this.lines
this.row is the size of rows in the viewport, this.lines is the buffer. It's
only possible to refresh `0` to `this.rows - 1`.

Fixes #86
2016-06-10 13:08:43 -07:00
runarberg
b01165c1f8 Fix third level shifts for Mac OS and windows
ISO third level keys were not working. That prevented some inputting
important characters (like pipe `|` and caret `^`) on some keyboard
layouts.

Instead of parsing the user-agent string to find the users os, we now
look into the `platform` attribute of the `navigator` object.

Removed the hijacking of the command key `⌘` on Mac OS as the `Alt` key
on other systems.
2016-06-10 16:14:31 +00:00
Paris
5a56849df8 Stop using binary literals. Non ES6 compatible 2016-06-10 19:02:49 +03:00
Paris
fed92ac5c8 Implement tests 2016-06-10 16:35:56 +03:00
Paris
00f4232ecc Export copied text processing to static method 2016-06-10 16:27:58 +03:00
Paris
fa1cd89aa9 Fix copying of non-breaking spaces 2016-06-10 16:17:14 +03:00
Daniel Imms
740ae96f5f Merge remote-tracking branch 'upstream/master' into 65_send_ctrl_l_r_key 2016-06-10 03:00:22 -07:00
Paris Kasidiaris
55ca998224 Merge pull request #110 from Tyriar/64_cursor_disappears_when_scrolling
Draw cursor at correct position when scrolling
2016-06-10 12:22:28 +03:00
Paris Kasidiaris
fdff1ca793 Merge pull request #107 from runarberg/fix/ctrl-or-shift-insert-copy-pasting
Allow Ctrl/Shift + insert to copy/paste on windows and linux
2016-06-10 11:57:15 +03:00
Daniel Imms
eee99f62e1 Improve scroll to work with blank lines after the cursor
This commit works fixes scrolling when there were blank lines after the cursor.
Here is what it does (blank rows are those added by running `clear`):

when increasing rows:
  if there are blank rows below the cursor:
    add a blank row to the bottom
  else if there is room in the buffer above the viewport
    scroll up
  else
    add a blank row to the bottom

when decreasing rows:
  if there are blank rows below the cursor:
    remove a blank row from the bottom
  else
    scroll down

Fixes #111
2016-06-09 21:13:48 -07:00
Daniel Imms
da9f86f1a7 Draw cursor at correct position when scrolling
Fixes #64
2016-06-09 19:59:59 -07:00
Daniel Imms
0535f9425b More escape sequence tests 2016-06-09 19:25:29 -07:00
Daniel Imms
3a866cf202 Refactor escape sequence code and add tests 2016-06-09 18:41:54 -07:00
Daniel Imms
e2aaa8d362 Jump over words with ctrl+left/right
Escape codes used: 5=ctrl, C=right, D=left

Fixes #65
2016-06-09 18:01:12 -07:00
runarberg
524db02228 Fix Ctrl/Shift + insert copy/paste
Many systems (including MS Windows and many linuxes) map `<Ctrl>` +
`<Insert>` to copy and `<Shift> + <Insert>` to paste. That serves as a
handy fallback when the more common `<Ctrl> + C` and `<Ctrl> + V`
keybindings have their default prevented to send signals to the
terminal.

Currently all keydown-events with the insert key send `\x1b[2~` to the
terminal. This commit won't send that key if either the `shiftKey` or
the `ctrlKey` are present. Instead it will enable `contentEditable` to
allow for pasting.
2016-06-09 13:45:02 +00:00
Paris Kasidiaris
cf9d2348a1 Merge pull request #97 from Tyriar/redundant_resize
Don't resize when unnecessary
2016-06-09 10:53:16 +03:00
Daniel Imms
df268ad5cd Fix buffer corruption after resizing rows
Lines from the buffer were incorrectly being removed when the viewport was
resized. This change removes the lines when the cursor is above them, if not it
shifts the viewport down. Some basic jsdoc comments were added to some Terminal
properties for future reference.

Fixes #98
Fixes #99
2016-06-08 19:08:32 -07:00
Daniel Imms
e721bdc9f0 Don't resize when unnecessary 2016-06-08 17:38:34 -07:00
TDaglis
6bc1881727 Fix emission of terminal focus&blur events 2016-06-07 13:58:00 +03:00
Paris Kasidiaris
180a7af75d Merge pull request #78 from sourcelair/drop-hidden-textarea
Drop hidden textarea for input handling
2016-06-07 09:36:44 +03:00
Paris
8754f8d895 Fix focus and blur events 2016-06-05 03:59:52 +00:00
Paris
c02cc84498 Fix cut and copy events
- Do not actually cut on cut
- Strip trailing whitespaces on copy (fix #66)
2016-06-05 06:35:33 +03:00
Paris
647216876b Add a few hacks for better paste handling across browsers 2016-06-03 11:04:46 +03:00
Paris
f3bd6145a5 Vanish selection when a key with data is being pressed 2016-06-02 13:31:38 +03:00
Paris
8fa1a46584 Handle the paste event better 2016-06-02 13:05:58 +03:00
Paris
fa7d214e78 Remove even more useless code 2016-06-02 12:35:03 +03:00
Paris
178b611b0c Remove useless methods 2016-06-02 12:27:43 +03:00
Daniel Imms
ae0f963799 Remove extra whitespace from class names
Use [].join to retain browser compatibility

Fixes #73
2016-06-02 02:17:03 -07:00
Paris
8ebfa27210 Merge branch 'master' of github.com:sourcelair/xterm.js into content-editable 2016-06-02 12:00:31 +03:00
Paris
1a3846161a Proper rendering of inverse data in default colors
Fix #57
2016-05-30 16:03:26 +00:00
Paris
bd2158613d Make all add-ons CommonJS importable
- Fix #52
- Rename `npm/nodejs project` documentation to `CommonJS environment`
2016-05-03 12:05:13 +03:00
Steven Silvester
7988f634f3 Handle focus clearing 2016-04-21 07:57:13 -05:00
Steven Silvester
a5e34e2288 Fix cursor blink 2016-04-20 15:41:33 -05:00
Steven Silvester
685bc54bf2 Use shift to reduce lines to preserve lines up to cursor 2016-04-14 06:35:44 -05:00
Alexander Olsson
6a87253d94 nodejs module definition
Allow importing xterm into  a nodejs application (for instance an electron
application, or perhaps a test environment using phantomjs which
also has a DOM),
2016-04-11 15:08:47 +02:00
Paris
6406a88ddf pointless 2016-04-08 18:10:27 +03:00
Paris
18b2a1c3b4 Handle drop event 2016-03-10 02:55:24 +02:00
Paris
58056df23d Start working on replacing textarea with contentEditable 2016-03-10 02:07:10 +02:00
TDaglis
f53f5735e1 added selection.type fallback check
for browsers that might not support Selection.isCollapsed property
2015-11-03 12:00:28 +02:00
TDaglis
7a88a4b0e9 fixed selection in firefox 2015-11-03 09:32:43 +00:00
TDaglis
369e1f4c1e exclude alt and meta keys from ctrl default case 2015-10-29 18:34:20 +02:00
TDaglis
702fd24ce8 ignore ctrl+shift characters in keydown input 2015-10-29 18:27:46 +02:00
TDaglis
cc950614c5 blur textarea on terminal blur 2015-10-26 17:13:04 +02:00
TDaglis
987f09d880 auto emit blur and focus of textarea 2015-10-26 15:07:15 +00:00
Paris Kasidiaris
d20c36dff2 Merge pull request #31 from akalipetis/hotfix/ie
Fixed IE issues with classList.add
2015-08-25 15:37:29 +03:00
Antonis Kalipetis
a523803d37 Fixed IE issues with classList.add
`classList.add` in IE does not take more than one parameter and this would not work. Split in 3 statements to fix it.
2015-08-25 14:40:00 +03:00
Antonis Kalipetis
f00d8964c2 Replaced preventDefault with cancel 2015-01-28 11:20:47 +02:00
Antonis Kalipetis
9ef6b52352 Pressing Alt + ←/→ does not interfere now with browser
Previously, when on Chrome for Windows, if default was not prevented the browser history backward/forward was triggered.

Fixes #19
2015-01-28 11:04:38 +02:00
paris
72ed03adcb Fix #14 2015-01-04 15:33:21 +02:00
paris
87979aeed4 Bind window to AMD module
- Bind window to Xterm AMD module
- Fix typo in fit addon
- Bump version to 0.24
2014-11-17 12:28:52 +02:00
paris
3f455f90d9 Fix #4 2014-09-10 11:09:23 +00:00
paris
9d00eec6c4 Fix #2 2014-08-27 09:50:09 +00:00
paris
189a556408 Moved fit into its own addon 2014-04-11 02:04:56 +00:00
paris
6e6b5dad8c fit() uses offset height and width now 2014-04-10 18:36:37 +00:00
paris
0b603952c3 Removed debugging stuff
Bumped bower version to 0.9
2014-04-10 16:04:59 +00:00
paris
96848a6425 Improved textarea handling 2014-04-10 15:08:19 +00:00
paris
0997f4398f Proper event handling
Bump bower version to 0.7
2014-04-10 14:39:17 +00:00
paris
e278837de8 Fix focus on refresh 2014-04-09 16:49:29 +00:00
paris
e572734a21 Syntax fix
Bumped bower version to 0.5
2014-04-09 15:42:37 +00:00
paris
4f2cadd6c9 Fixed paste
Bumped bower version to 0.4
2014-04-09 15:37:45 +00:00
paris
6d152ed766 Added data handling on paste
Also bumped version to 0.3 for bower
2014-04-09 14:43:43 +00:00
paris
473d45f425 Copy and Paste seem to work. 2014-04-08 09:39:27 +00:00
paris
e2c2630873 Fixed sending data when Cmd is pressed 2014-04-08 09:34:28 +00:00
paris
31161ffee8 Progress with handling copy 2014-04-08 08:44:00 +00:00
paris
782d4f9396 Removed prefix mode and select mode 2014-03-28 15:54:57 +00:00
paris
731ffe1a75 Textarea for key handling works
Copy and paste need rework.
2014-03-26 19:38:00 +00:00
paris
5fd1948b9e Started working on textarea helper 2014-03-26 18:01:52 +00:00
paris
5a9e243a14 Introduced rowContainer and insertRow
- Introduced rowContainer so as to separates lines from future
  assistive elements (like an input field to capture DOM events)
- Introduced insertRow for inserting new rows in the container
- Cleaned up a lot of —yet— useless methods.
2014-03-26 17:38:47 +00:00
paris
9c163528d9 Replaced offsetWidth with scrollWidth 2014-03-25 22:10:24 +00:00
paris
dc3946f6da Implemented Terminal.prototype.fit
Implemented fit method for Terminal objects, which:
  - Fits the terminal's columns to its parent element width
  - Fits the terminal's rows to its parent element height
2014-03-25 19:18:19 +00:00
paris
725e9423be Added resizing event 2014-03-25 17:49:07 +00:00
paris
aa288aeb99 Started documentation 2014-03-25 17:39:10 +00:00
paris
3d680e1cb7 Started implementing theming. 2014-03-24 17:56:49 +00:00