Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
this.root.gpmHandler.on( 'mouse' , ( name , data ) => {
self.root.emit( 'mouse' , name , data ) ;
} ) ;
this.root.gpmHandler.on( 'error' , ( /* error */ ) => {
//console.log( 'mouseDrag error:' , error ) ;
} ) ;
}
/* Key Mapping */
var keymap = tree.extend( null , Object.create( xterm.keymap ) , {
F1: '\x1b[[A' ,
F2: '\x1b[[B' ,
F3: '\x1b[[C' ,
F4: '\x1b[[D' ,
F5: '\x1b[[E' ,
SHIFT_F1: '\x1b[25~' ,
SHIFT_F2: '\x1b[26~' ,
SHIFT_F3: '\x1b[28~' ,
SHIFT_F4: '\x1b[29~' ,
SHIFT_F5: '\x1b[31~' ,
SHIFT_F6: '\x1b[32~' ,
SHIFT_F7: '\x1b[33~' ,
SHIFT_F8: '\x1b[34~' ,
// SHIFT F9-F12 is not supported by the Linux console
var eterm = require( './eterm.js' ) ;
var esc = tree.extend( { own: true } , Object.create( xterm256.esc ) , eterm.esc , {
color24bits: { on: '%D%D%D' , na: true } , // not capable
bgColor24bits: { on: '%D%D%D' , na: true } // not capable
} ) ;
// So far, we derivate from xterm-256color and then just add specific things (owned properties)
// of Eterm, thus we achieve a clean inheritance model without duplicated code.
module.exports = {
esc: esc ,
keymap: tree.extend( { own: true } , Object.create( xterm256.keymap ) , eterm.keymap ) ,
handler: tree.extend( { own: true } , Object.create( xterm256.handler ) , eterm.handler ) ,
support: {
deltaEscapeSequence: true ,
"256colors": true ,
"24bitsColors": false , // DEPRECATED
"trueColor": false
} ,
colorRegister: eterm.colorRegister
} ;
"use strict" ;
var tree = require( 'tree-kit' ) ;
var xterm256 = require( './xterm-256color.js' ) ;
var gnome = require( './gnome.js' ) ;
// Remove colors
var defaultColor = '\x1b[39m' ; // back to the default color, most of time it is the same than .white
var bgDefaultColor = '\x1b[49m' ; // back to the default color, most of time it is the same than .bgBlack
var esc = tree.extend( { own: true } , Object.create( xterm256.esc ) , gnome.esc , {
color24bits: { on: '\x1b[38;2;%u;%u;%um' , off: defaultColor , optimized: ( r , g , b ) => '\x1b[38;2;' + r + ';' + g + ';' + b + 'm' } ,
bgColor24bits: { on: '\x1b[48;2;%u;%u;%um' , off: bgDefaultColor , optimized: ( r , g , b ) => '\x1b[48;2;' + r + ';' + g + ';' + b + 'm' }
} ) ;
// So far, we derivate from xterm-256color and then just add specific things (owned properties)
// of gnome, thus we achieve a clean inheritance model without duplicated code.
module.exports = {
esc: esc ,
keymap: tree.extend( { own: true } , Object.create( xterm256.keymap ) , gnome.keymap ) ,
handler: tree.extend( { own: true } , Object.create( xterm256.handler ) , gnome.handler ) ,
support: {
deltaEscapeSequence: true ,
"256colors": true ,
"use strict" ;
var tree = require( 'tree-kit' ) ;
var xterm = require( './xterm.js' ) ;
var string = require( 'string-kit' ) ;
// Remove colors
var defaultColor = '\x1b[39m' ; // back to the default color, most of time it is the same than .white
var bgDefaultColor = '\x1b[49m' ; // back to the default color, most of time it is the same than .bgBlack
var esc = tree.extend( null , Object.create( xterm.esc ) , {
color256: { on: '\x1b[38;5;%um' , off: defaultColor } ,
bgColor256: { on: '\x1b[48;5;%um' , off: bgDefaultColor } ,
setCursorColorRgb: { on: '\x1b]12;#%x%x%x\x07' } , // it want rgb as parameter, like rgb:127/0/32
setDefaultColorRgb: { on: '\x1b]10;#%x%x%x\x07' } , // ->|TODOC|<- not widely supported
setDefaultBgColorRgb: { on: '\x1b]11;#%x%x%x\x07' } , // ->|TODOC|<- not widely supported
color24bits: { on: '\x1b[38;2;%u;%u;%um' , off: defaultColor , fb: true } ,
bgColor24bits: { on: '\x1b[48;2;%u;%u;%um' , off: bgDefaultColor , fb: true } ,
// Cannot find a way to set the cursor to a register, so try to guess
setCursorColor: {
on: '%[setCursorColor:%a%a]F' ,
handler: function setCursorColor( bg , fg ) {
if ( typeof fg !== 'number' || typeof bg !== 'number' ) { return '' ; }
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
"use strict" ;
var tree = require( 'tree-kit' ) ;
var xterm256 = require( './xterm-256color.js' ) ;
var eterm = require( './eterm.js' ) ;
var esc = tree.extend( { own: true } , Object.create( xterm256.esc ) , eterm.esc , {
color24bits: { on: '%D%D%D' , na: true } , // not capable
bgColor24bits: { on: '%D%D%D' , na: true } // not capable
} ) ;
// So far, we derivate from xterm-256color and then just add specific things (owned properties)
// of Eterm, thus we achieve a clean inheritance model without duplicated code.
module.exports = {
esc: esc ,
keymap: tree.extend( { own: true } , Object.create( xterm256.keymap ) , eterm.keymap ) ,
handler: tree.extend( { own: true } , Object.create( xterm256.handler ) , eterm.handler ) ,
support: {
deltaEscapeSequence: true ,
"256colors": true ,
refreshBackground() ;
break ;
case 'ALT_W':
editingMode.background.attr.color ++ ;
if ( editingMode.background.attr.color > 255 ) { editingMode.background.attr.color = 0 ; }
refreshStatusBar() ;
refreshBackground() ;
break ;
case 'ALT_E':
comboKey = 'backgroundChar' ;
randomHint( "Press a key for the background character to use..." , 'red' , 'yellow' ) ;
break ;
// Fill key
case 'ALT_SHIFT_F':
fill( tree.extend( { deep: true } , { char: ' ' } , { attr: editingMode.attr } , { attr: {
fgTransparency: false ,
bgTransparency: true ,
styleTransparency: true ,
charTransparency: true
} } ) ) ;
redrawCanvas() ;
break ;
case 'ALT_SHIFT_G':
fill( tree.extend( { deep: true } , { char: ' ' } , { attr: editingMode.attr } , { attr: {
fgTransparency: true ,
bgTransparency: false ,
styleTransparency: true ,
charTransparency: true
} } ) ) ;
redrawCanvas() ;
break ;
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
*/
"use strict" ;
var tree = require( 'tree-kit' ) ;
var xterm = require( './xterm.js' ) ;
var esc = tree.extend( null , Object.create( xterm.esc ) , {
// Amazingly, those uber-standard and uber-common sequences are *NOT* supported by Konsole...
// SHAME on you KDE! Even the Linux Console support it!
// This workaround use up()/down() & column(1)
nextLine: { on: '\x1b[%UB\x1b[1G' } ,
previousLine: { on: '\x1b[%UA\x1b[1G' } ,
// Cursor styles
blockCursor: { on: '\x1b]50;CursorShape=0\x07' } ,
blinkingBlockCursor: { on: '\x1b]50;CursorShape=0\x07' } ,
underlineCursor: { on: '\x1b]50;CursorShape=2\x07' } ,
blinkingUnderlineCursor: { on: '\x1b]50;CursorShape=2\x07' } ,
beamCursor: { on: '\x1b]50;CursorShape=1\x07' } ,
blinkingBeamCursor: { on: '\x1b]50;CursorShape=1\x07' } ,
requestColor: { on: '%D' , na: true } // not capable
"use strict" ;
var tree = require( 'tree-kit' ) ;
var xterm256 = require( './xterm-256color.js' ) ;
// Remove colors
var defaultColor = '\x1b[39m' ; // back to the default color, most of time it is the same than .white
var bgDefaultColor = '\x1b[49m' ; // back to the default color, most of time it is the same than .bgBlack
var esc = tree.extend( null , Object.create( xterm256.esc ) , {
// 24 bits colors
color24bits: { on: '\x1b[38;2;%u;%u;%um' , off: defaultColor , optimized: ( r , g , b ) => '\x1b[38;2;' + r + ';' + g + ';' + b + 'm' } ,
bgColor24bits: { on: '\x1b[48;2;%u;%u;%um' , off: bgDefaultColor , optimized: ( r , g , b ) => '\x1b[48;2;' + r + ';' + g + ';' + b + 'm' } ,
// Cursor styles not supported
blockCursor: { on: '' , na: true } ,
blinkingBlockCursor: { on: '' , na: true } ,
underlineCursor: { on: '' , na: true } ,
blinkingUnderlineCursor: { on: '' , na: true } ,
beamCursor: { on: '' , na: true } ,
blinkingBeamCursor: { on: '' , na: true }
} ) ;
// Not capable, fallback to mouseButton
mouseDrag: { on: '\x1b[?1000h' , off: '\x1b[?1000l' , fb: true } ,
mouseMotion: { on: '\x1b[?1000h' , off: '\x1b[?1000l' , fb: true } ,
requestColor: { on: '%D' , na: true } // not capable
} ) ;
/* Key Mapping */
var keymap = tree.extend( null , Object.create( xterm.keymap ) , {
F1: '\x1b[11~' ,
F2: '\x1b[12~' ,
F3: '\x1b[13~' ,
F4: '\x1b[14~' ,
//SHIFT_F1: '\x1b[25~' , // no difference with F11
//SHIFT_F2: '\x1b[26~' , // no difference with F12
SHIFT_F3: '\x1b[25~' ,
SHIFT_F4: '\x1b[26~' ,
SHIFT_F5: '\x1b[28~' ,
SHIFT_F6: '\x1b[29~' ,
SHIFT_F7: '\x1b[31~' ,
SHIFT_F8: '\x1b[32~' ,
SHIFT_F9: '\x1b[33~' ,
SHIFT_F10: '\x1b[34~' ,
query.body = Buffer.from( query.body ) ;
}
if (
constants.unexpectedBody[ query.method ] &&
( ! query.headers['Transfer-Encoding'] || ! query.headers['Content-Length'] )
) {
// This is not done automatically for methods that are not expected bodies
//query.headers['Content-Length'] = query.body.length ;
query.headers['Transfer-Encoding'] = 'chunked' ;
}
}
// http.request() accepts an undocumented 'protocol' property, but its format uses a trailing ':',
// e.g. 'http:', and that causes trouble...
query_ = tree.extend( null , {} , query , { protocol: null } ) ;
if ( query.protocol === 'http' ) {
request = http.request( query_ ) ;
}
else if ( query.protocol === 'https' ) {
request = https.request( query_ ) ;
}
else {
throw new Error( "Unsupported protocol '" + query.protocol + "'" ) ;
}
request.setTimeout( query.timeout , () => {
request.abort() ;
} ) ;
request.on( 'error' , error => {