소스 검색

Sqelch write_windows debug output. Fixed Home/End

Home/End was not working with putty (windows).
Steve Thielemann 2 년 전
부모
커밋
cd54d93d25
3개의 변경된 파일11개의 추가작업 그리고 6개의 파일을 삭제
  1. 2 1
      door/door.go
  2. 3 1
      door/input.go
  3. 6 4
      door/write_windows.go

+ 2 - 1
door/door.go

@@ -38,7 +38,8 @@ import (
 const DEBUG_DOOR bool = false
 
 // For debugging input reader routines.
-const DEBUG_INPUT = false
+const DEBUG_INPUT bool = false
+const DEBUG_OUTPUT bool = false
 
 // See door_test.go for DEBUG test const
 

+ 3 - 1
door/input.go

@@ -30,7 +30,9 @@ var extendedKeys map[string]Extended = map[string]Extended{
 	"[C":   RIGHT_ARROW,
 	"[D":   LEFT_ARROW,
 	"[H":   HOME,
-	"[F":   END, // terminal
+	"[F":   END,  // terminal
+	"[1~":  HOME, // putty (windows)
+	"[4~":  END,  // putty (windows)
 	"[K":   END,
 	"[V":   PAGE_UP,
 	"[U":   PAGE_DOWN,

+ 6 - 4
door/write_windows.go

@@ -69,10 +69,12 @@ func Writer(d *Door) {
 		var DataWrite uint32 = uint32(0)
 		var err error
 		err = syscall.WSASend(handle, &WSA_Buffer, 1, &DataWrite, UitnZero_1, nil, nil)
-		if err != nil {
-			fmt.Printf("write: %d bytes, error: %#v\n", DataWrite, err)
-		} else {
-			log.Printf("write %d bytes\n", DataWrite)
+		if DEBUG_OUTPUT {
+			if err != nil {
+				fmt.Printf("write: %d bytes, error: %#v\n", DataWrite, err)
+			} else {
+				log.Printf("write %d bytes\n", DataWrite)
+			}
 		}
 
 		if (err != nil) || (l != DataWrite) {