mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
IDEA-179900 - Docker exec tab does not correctly wrap
- TerminalListener: allow to handle tty resize events from terminal + switch to modern condensed copyright comments GitOrigin-RevId: 18e98334d90a4d2c48b26ce272c9f1433c1009a5
This commit is contained in:
committed by
intellij-monorepo-bot
parent
b26eeec640
commit
b5f2c38b6f
+11
-15
@@ -1,28 +1,24 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.remoteServer.agent.util.log;
|
||||
|
||||
public interface TerminalListener {
|
||||
|
||||
void close();
|
||||
|
||||
void setTtyResizeHandler(TtyResizeHandler ttyResizeHandler);
|
||||
|
||||
TerminalListener NULL = new TerminalListener() {
|
||||
|
||||
public void close() {
|
||||
//
|
||||
}
|
||||
|
||||
public void setTtyResizeHandler(TtyResizeHandler ttyResizeHandler) {
|
||||
//
|
||||
}
|
||||
};
|
||||
|
||||
interface TtyResizeHandler {
|
||||
void onTtyResizeRequest(int ttyWidth, int ttyHeight);
|
||||
}
|
||||
}
|
||||
|
||||
+10
-18
@@ -1,18 +1,4 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
|
||||
package com.intellij.remoteServer.util;
|
||||
|
||||
import com.intellij.execution.process.ProcessHandler;
|
||||
@@ -20,6 +6,7 @@ import com.intellij.remoteServer.agent.util.CloudAgentLoggingHandler;
|
||||
import com.intellij.remoteServer.agent.util.log.LogListener;
|
||||
import com.intellij.remoteServer.agent.util.log.TerminalListener;
|
||||
import com.intellij.remoteServer.impl.runtime.log.LoggingHandlerBase;
|
||||
import com.intellij.remoteServer.impl.runtime.log.TerminalHandlerBase;
|
||||
import com.intellij.remoteServer.runtime.deployment.DeploymentLogManager;
|
||||
import com.intellij.remoteServer.runtime.log.LoggingHandler;
|
||||
import com.intellij.remoteServer.runtime.log.TerminalHandler;
|
||||
@@ -29,9 +16,6 @@ import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* @author michael.golubev
|
||||
*/
|
||||
public class CloudLoggingHandlerImpl implements CloudAgentLoggingHandler {
|
||||
|
||||
private final HashMap<String, LogListenerImpl> myPipeName2LogListener;
|
||||
@@ -111,6 +95,7 @@ public class CloudLoggingHandlerImpl implements CloudAgentLoggingHandler {
|
||||
InputStream terminalOutput,
|
||||
InputStream stderr) {
|
||||
final TerminalHandler terminalHandler = myLogManager.addTerminal(pipeName, terminalOutput, terminalInput);
|
||||
|
||||
return new TerminalListener() {
|
||||
|
||||
@Override
|
||||
@@ -119,6 +104,13 @@ public class CloudLoggingHandlerImpl implements CloudAgentLoggingHandler {
|
||||
terminalHandler.close();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTtyResizeHandler(TtyResizeHandler ttyResizeHandler) {
|
||||
if (terminalHandler instanceof TerminalHandlerBase && ttyResizeHandler != null) {
|
||||
((TerminalHandlerBase)terminalHandler).setResizeHandler(size -> ttyResizeHandler.onTtyResizeRequest(size.width, size.height));
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user