switch (key) {
case 'cursorBlink': this.setCursorBlinking(value); break;
case 'cursorStyle':
- // Style 'block' applies with no class
+ this.element.classList.toggle(`xterm-cursor-style-block`, value === 'block');
this.element.classList.toggle(`xterm-cursor-style-underline`, value === 'underline');
this.element.classList.toggle(`xterm-cursor-style-bar`, value === 'bar');
break;
on(this.element, 'copy', event => {
// If mouse events are active it means the selection manager is disabled and
// copy should be handled by the host program.
- if (!term.hasSelection) {
+ if (!term.hasSelection()) {
return;
}
copyHandler(event, term, this.selectionManager);
this.element.classList.add('terminal');
this.element.classList.add('xterm');
this.element.classList.add('xterm-theme-' + this.theme);
+ this.element.classList.add(`xterm-cursor-style-${this.options.cursorStyle}`);
this.setCursorBlinking(this.options.cursorBlink);
this.element.setAttribute('tabindex', 0);
this.focus();
}
- on(this.element, 'click', function() {
- var selection = document.getSelection(),
- collapsed = selection.isCollapsed,
- isRange = typeof collapsed == 'boolean' ? !collapsed : selection.type == 'Range';
- if (!isRange) {
- self.focus();
- }
- });
-
// Listen for mouse events and translate
// them into terminal mouse protocols.
this.bindMouse();
}
on(el, 'mousedown', function(ev) {
+
+ // Prevent the focus on the textarea from getting lost
+ // and make sure we get focused on mousedown
+ ev.preventDefault();
+ self.focus();
+
if (!self.mouseEvents) return;
// send the button
sendButton(ev);
- // ensure focus
- self.focus();
-
// fix for odd bug
//if (self.vt200Mouse && !self.normalMouse) {
if (self.vt200Mouse) {
ch = [this.defAttr, ' ', 1]; // does xterm use the default attr?
i = this.buffer.lines.length;
while (i--) {
+ if (this.buffer.lines.get(i) === undefined) {
+ this.buffer.lines.set(i, this.blankLine());
+ }
while (this.buffer.lines.get(i).length < x) {
this.buffer.lines.get(i).push(ch);
}
/**
- * Evaluate if the current erminal is the given argument.
+ * Evaluate if the current terminal is the given argument.
* @param {object} term The terminal to evaluate
*/
Terminal.prototype.is = function(term) {