nt

A sensible note-taking program
git clone git://git.laack.co/nt.git
Log | Files | Refs | README

term.go (3320B)


      1 // Copyright 2021 The TCell Authors
      2 //
      3 // Licensed under the Apache License, Version 2.0 (the "License");
      4 // you may not use file except in compliance with the License.
      5 // You may obtain a copy of the license at
      6 //
      7 //    http://www.apache.org/licenses/LICENSE-2.0
      8 //
      9 // Unless required by applicable law or agreed to in writing, software
     10 // distributed under the License is distributed on an "AS IS" BASIS,
     11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     12 // See the License for the specific language governing permissions and
     13 // limitations under the License.
     14 
     15 // This terminal definition is hand-coded, as the default terminfo for
     16 // this terminal is busted with respect to color.  Unlike pretty much every
     17 // other ANSI compliant terminal, this terminal cannot combine foreground and
     18 // background escapes.  The default terminfo also only provides escapes for
     19 // 16-bit color.
     20 
     21 package sun
     22 
     23 import "github.com/gdamore/tcell/v2/terminfo"
     24 
     25 func init() {
     26 
     27 	// Sun Microsystems Inc. workstation console
     28 	terminfo.AddTerminfo(&terminfo.Terminfo{
     29 		Name:         "sun",
     30 		Aliases:      []string{"sun1", "sun2"},
     31 		Columns:      80,
     32 		Lines:        34,
     33 		Bell:         "\a",
     34 		Clear:        "\f",
     35 		AttrOff:      "\x1b[m",
     36 		Reverse:      "\x1b[7m",
     37 		PadChar:      "\x00",
     38 		SetCursor:    "\x1b[%i%p1%d;%p2%dH",
     39 		CursorBack1:  "\b",
     40 		CursorUp1:    "\x1b[A",
     41 		KeyUp:        "\x1b[A",
     42 		KeyDown:      "\x1b[B",
     43 		KeyRight:     "\x1b[C",
     44 		KeyLeft:      "\x1b[D",
     45 		KeyInsert:    "\x1b[247z",
     46 		KeyDelete:    "\u007f",
     47 		KeyBackspace: "\b",
     48 		KeyHome:      "\x1b[214z",
     49 		KeyEnd:       "\x1b[220z",
     50 		KeyPgUp:      "\x1b[216z",
     51 		KeyPgDn:      "\x1b[222z",
     52 		KeyF1:        "\x1b[224z",
     53 		KeyF2:        "\x1b[225z",
     54 		KeyF3:        "\x1b[226z",
     55 		KeyF4:        "\x1b[227z",
     56 		KeyF5:        "\x1b[228z",
     57 		KeyF6:        "\x1b[229z",
     58 		KeyF7:        "\x1b[230z",
     59 		KeyF8:        "\x1b[231z",
     60 		KeyF9:        "\x1b[232z",
     61 		KeyF10:       "\x1b[233z",
     62 		KeyF11:       "\x1b[234z",
     63 		KeyF12:       "\x1b[235z",
     64 		AutoMargin:   true,
     65 		InsertChar:   "\x1b[@",
     66 	})
     67 
     68 	// Sun Microsystems Workstation console with color support (IA systems)
     69 	terminfo.AddTerminfo(&terminfo.Terminfo{
     70 		Name:         "sun-color",
     71 		Columns:      80,
     72 		Lines:        34,
     73 		Colors:       256,
     74 		Bell:         "\a",
     75 		Clear:        "\f",
     76 		AttrOff:      "\x1b[m",
     77 		Bold:         "\x1b[1m",
     78 		Reverse:      "\x1b[7m",
     79 		SetFg:        "\x1b[38;5;%p1%dm",
     80 		SetBg:        "\x1b[48;5;%p1%dm",
     81 		ResetFgBg:    "\x1b[0m",
     82 		PadChar:      "\x00",
     83 		SetCursor:    "\x1b[%i%p1%d;%p2%dH",
     84 		CursorBack1:  "\b",
     85 		CursorUp1:    "\x1b[A",
     86 		KeyUp:        "\x1b[A",
     87 		KeyDown:      "\x1b[B",
     88 		KeyRight:     "\x1b[C",
     89 		KeyLeft:      "\x1b[D",
     90 		KeyInsert:    "\x1b[247z",
     91 		KeyDelete:    "\u007f",
     92 		KeyBackspace: "\b",
     93 		KeyHome:      "\x1b[214z",
     94 		KeyEnd:       "\x1b[220z",
     95 		KeyPgUp:      "\x1b[216z",
     96 		KeyPgDn:      "\x1b[222z",
     97 		KeyF1:        "\x1b[224z",
     98 		KeyF2:        "\x1b[225z",
     99 		KeyF3:        "\x1b[226z",
    100 		KeyF4:        "\x1b[227z",
    101 		KeyF5:        "\x1b[228z",
    102 		KeyF6:        "\x1b[229z",
    103 		KeyF7:        "\x1b[230z",
    104 		KeyF8:        "\x1b[231z",
    105 		KeyF9:        "\x1b[232z",
    106 		KeyF10:       "\x1b[233z",
    107 		KeyF11:       "\x1b[234z",
    108 		KeyF12:       "\x1b[235z",
    109 		AutoMargin:   true,
    110 		InsertChar:   "\x1b[@",
    111 	})
    112 }