Signed-off-by: Brendan Dixon <brendand@microsoft.com>
| ... | ... |
@@ -5,6 +5,7 @@ import ( |
| 5 | 5 |
"io" |
| 6 | 6 |
"os" |
| 7 | 7 |
|
| 8 |
+ "github.com/Sirupsen/logrus" |
|
| 8 | 9 |
"github.com/docker/docker/pkg/term/winconsole" |
| 9 | 10 |
) |
| 10 | 11 |
|
| ... | ... |
@@ -57,6 +58,7 @@ func GetWinsize(fd uintptr) (*Winsize, error) {
|
| 57 | 57 |
// SetWinsize sets the size of the given terminal connected to the passed file descriptor. |
| 58 | 58 |
func SetWinsize(fd uintptr, ws *Winsize) error {
|
| 59 | 59 |
// TODO(azlinux): Implement SetWinsize |
| 60 |
+ logrus.Debugf("[windows] SetWinsize: WARNING -- Unsupported method invoked")
|
|
| 60 | 61 |
return nil |
| 61 | 62 |
} |
| 62 | 63 |
|
| ... | ... |
@@ -120,11 +122,10 @@ func MakeRaw(fd uintptr) (*State, error) {
|
| 120 | 120 |
mode &^= winconsole.ENABLE_ECHO_INPUT |
| 121 | 121 |
mode &^= winconsole.ENABLE_LINE_INPUT |
| 122 | 122 |
mode &^= winconsole.ENABLE_MOUSE_INPUT |
| 123 |
- // TODO(azlinux): Enable window input to handle window resizing |
|
| 124 |
- mode |= winconsole.ENABLE_WINDOW_INPUT |
|
| 123 |
+ mode &^= winconsole.ENABLE_WINDOW_INPUT |
|
| 124 |
+ mode &^= winconsole.ENABLE_PROCESSED_INPUT |
|
| 125 | 125 |
|
| 126 | 126 |
// Enable these modes |
| 127 |
- mode |= winconsole.ENABLE_PROCESSED_INPUT |
|
| 128 | 127 |
mode |= winconsole.ENABLE_EXTENDED_FLAGS |
| 129 | 128 |
mode |= winconsole.ENABLE_INSERT_MODE |
| 130 | 129 |
mode |= winconsole.ENABLE_QUICK_EDIT_MODE |
| ... | ... |
@@ -12,6 +12,8 @@ import ( |
| 12 | 12 |
"sync" |
| 13 | 13 |
"syscall" |
| 14 | 14 |
"unsafe" |
| 15 |
+ |
|
| 16 |
+ "github.com/Sirupsen/logrus" |
|
| 15 | 17 |
) |
| 16 | 18 |
|
| 17 | 19 |
const ( |
| ... | ... |
@@ -593,6 +595,7 @@ func (term *WindowsTerminal) HandleOutputCommand(handle uintptr, command []byte) |
| 593 | 593 |
n = len(command) |
| 594 | 594 |
|
| 595 | 595 |
parsedCommand := parseAnsiCommand(command) |
| 596 |
+ logrus.Debugf("[windows] HandleOutputCommand: %v", parsedCommand)
|
|
| 596 | 597 |
|
| 597 | 598 |
// console settings changes need to happen in atomic way |
| 598 | 599 |
term.outMutex.Lock() |
| ... | ... |
@@ -648,6 +651,7 @@ func (term *WindowsTerminal) HandleOutputCommand(handle uintptr, command []byte) |
| 648 | 648 |
column = int16(screenBufferInfo.Window.Right) + 1 |
| 649 | 649 |
} |
| 650 | 650 |
// The numbers are not 0 based, but 1 based |
| 651 |
+ logrus.Debugf("[windows] HandleOutputCommmand: Moving cursor to (%v,%v)", column-1, line-1)
|
|
| 651 | 652 |
if err := setConsoleCursorPosition(handle, false, column-1, line-1); err != nil {
|
| 652 | 653 |
return n, err |
| 653 | 654 |
} |
| ... | ... |
@@ -1038,8 +1042,7 @@ func (term *WindowsTerminal) HandleInputSequence(fd uintptr, command []byte) (n |
| 1038 | 1038 |
} |
| 1039 | 1039 |
|
| 1040 | 1040 |
func marshal(c COORD) uintptr {
|
| 1041 |
- // works only on intel-endian machines |
|
| 1042 |
- return uintptr(uint32(uint32(uint16(c.Y))<<16 | uint32(uint16(c.X)))) |
|
| 1041 |
+ return uintptr(*((*DWORD)(unsafe.Pointer(&c)))) |
|
| 1043 | 1042 |
} |
| 1044 | 1043 |
|
| 1045 | 1044 |
// IsConsole returns true if the given file descriptor is a terminal. |
| ... | ... |
@@ -1,6 +1,7 @@ |
| 1 | 1 |
package winconsole |
| 2 | 2 |
|
| 3 | 3 |
import ( |
| 4 |
+ "fmt" |
|
| 4 | 5 |
"io" |
| 5 | 6 |
"strconv" |
| 6 | 7 |
"strings" |
| ... | ... |
@@ -206,6 +207,21 @@ func (c *ansiCommand) getParam(index int) string {
|
| 206 | 206 |
return "" |
| 207 | 207 |
} |
| 208 | 208 |
|
| 209 |
+func (ac *ansiCommand) String() string {
|
|
| 210 |
+ return fmt.Sprintf("0x%v \"%v\" (\"%v\")",
|
|
| 211 |
+ bytesToHex(ac.CommandBytes), |
|
| 212 |
+ ac.Command, |
|
| 213 |
+ strings.Join(ac.Parameters, "\",\"")) |
|
| 214 |
+} |
|
| 215 |
+ |
|
| 216 |
+func bytesToHex(b []byte) string {
|
|
| 217 |
+ hex := make([]string, len(b)) |
|
| 218 |
+ for i, ch := range b {
|
|
| 219 |
+ hex[i] = fmt.Sprintf("%X", ch)
|
|
| 220 |
+ } |
|
| 221 |
+ return strings.Join(hex, "") |
|
| 222 |
+} |
|
| 223 |
+ |
|
| 209 | 224 |
func parseInt16OrDefault(s string, defaultValue int16) (n int16, err error) {
|
| 210 | 225 |
if s == "" {
|
| 211 | 226 |
return defaultValue, nil |