@@ -15,7 +15,7 @@ import { webLinksHandler } from "./lib/addons";
15
15
import { initiateRemoteCommunicationChannelSocket } from "./lib/remote" ;
16
16
import { Emitter } from '@gitpod/gitpod-protocol/lib/util/event' ;
17
17
import { DisposableCollection } from '@gitpod/gitpod-protocol/lib/util/disposable' ;
18
- import { debounce } from './lib/helpers' ;
18
+ import { debounce , isWindows } from './lib/helpers' ;
19
19
20
20
const onDidChangeState = new Emitter < void > ( ) ;
21
21
let state : IDEFrontendState = "initializing" as IDEFrontendState ;
@@ -129,23 +129,22 @@ async function createTerminal(element: HTMLElement, toDispose: DisposableCollect
129
129
element . removeChild ( element . children [ 0 ] ) ;
130
130
}
131
131
132
- const isWindows =
133
- [ "Windows" , "Win16" , "Win32" , "WinCE" ] . indexOf ( navigator . platform ) >= 0 ;
134
-
135
132
const { Terminal } = ( await import ( "xterm" ) ) ;
136
133
137
134
term = new Terminal ( {
138
135
windowsMode : isWindows ,
139
136
fontFamily : defaultFonts . join ( ", " ) ,
140
137
allowProposedApi : true
141
138
} as ITerminalOptions ) ;
139
+
142
140
toDispose . push ( term ) ;
143
141
144
142
window . terminal = term ;
145
143
term . onResize ( async ( size ) => {
146
144
await resizeRemoteTerminal ( size , pid ) ;
147
145
console . info ( `Resized remote terminal to ${ size . cols } x${ size . rows } ` ) ;
148
146
} ) ;
147
+
149
148
protocol = location . protocol === "https:" ? "wss://" : "ws://" ;
150
149
socketURL = `${ protocol + location . hostname + ( location . port ? ":" + location . port : "" )
151
150
} /terminals/`;
@@ -265,4 +264,14 @@ window.gitpod.ideService = {
265
264
}
266
265
return toDispose ;
267
266
}
268
- } ;
267
+ } ;
268
+
269
+ document . addEventListener ( "keydown" , ( ( event ) => {
270
+ const ctrlCmd = isWindows ? event . ctrlKey : event . metaKey ;
271
+ if ( ctrlCmd && event . key === "k" ) {
272
+ event . preventDefault ( ) ;
273
+ if ( term ) {
274
+ term . clear ( ) ;
275
+ }
276
+ }
277
+ } ) ) ;
0 commit comments