<commit_before>package list

import (
	"bytes"
	"fmt"
	"os"
	"strings"
	"text/tabwriter"

	"github.com/blacknon/lssh/conf"
	termbox "github.com/nsf/termbox-go"
)

type ListArrayInfo struct {
	Name    string
	Connect string
	Note    string
}

// Draw Line
func drawLine(x, y int, str string, colorNum int, backColorNum int) {
	color := termbox.Attribute(colorNum + 1)
	backColor := termbox.Attribute(backColorNum + 1)
	runes := []rune(str)

	for i := 0; i < len(runes); i += 1 {
		termbox.SetCell(x+i, y, runes[i], color, backColor)
	}
}

// Draw List
func draw(serverNameList []string, selectCursor int) {
	defaultColor := 255
	defaultBackColor := 255
	termbox.Clear(termbox.Attribute(defaultColor+1), termbox.Attribute(defaultBackColor+1))

	// Get Terminal Size
	_, height := termbox.Size()
	lineHeight := height - 2

	// Set View List Range
	viewFirstLine := (selectCursor/lineHeight)*lineHeight + 1
	viewLastLine := viewFirstLine + lineHeight
	serverViewList := serverNameList[viewFirstLine:viewLastLine]
	selectViewCursor := selectCursor - viewFirstLine + 1

	// View Head
	drawLine(0, 0, "lssh>", defaultColor, defaultBackColor)
	drawLine(2, 1, serverNameList[0], defaultColor, defaultBackColor)

	// View List
	for k, v := range serverViewList {
		cursorColor := defaultColor<commit_msg>1 Page Only List<commit_after>package list

import (
	"bytes"
	"fmt"
	"os"
	"strings"
	"text/tabwriter"

	"github.com/blacknon/lssh/conf"
	termbox "github.com/nsf/termbox-go"
)

type ListArrayInfo struct {
	Name    string
	Connect string
	Note    string
}

// Draw Line
func drawLine(x, y int, str string, colorNum int, backColorNum int) {
	color := termbox.Attribute(colorNum + 1)
	backColor := termbox.Attribute(backColorNum + 1)
	runes := []rune(str)

	for i := 0; i < len(runes); i += 1 {
		termbox.SetCell(x+i, y, runes[i], color, backColor)
	}
}

// Draw List
func draw(serverNameList []string, selectCursor int) {
	defaultColor := 255
	defaultBackColor := 255
	termbox.Clear(termbox.Attribute(defaultColor+1), termbox.Attribute(defaultBackColor+1))

	// Get Terminal Size
	_, height := termbox.Size()
	lineHeight := height - 2

	// Set View List Range
	viewFirstLine := (selectCursor/lineHeight)*lineHeight + 1
	viewLastLine := viewFirstLine + lineHeight
	var serverViewList []string
	if viewLastLine > len(serverNameList) {
		serverViewList = serverNameList[viewFirstLine:len(serverNameList)]
	} else {
		serverViewList = serverNameList[viewFirstLine:viewLastLine]
	}
	selectViewCursor := selectCursor - viewFirstLine + 1

	// View Head
	drawLine(0, 0, "lssh>", defaultColor, defaultBackColor)
	drawLine(2, 1, serverNameList[0], defaultColor, defaultBackColor)

	// View List
	for k, v := range serverViewList {
		cursorColor := defaultColor
{'fraction_non_alphanumeric': 0.12322274881516587, 'fraction_numerical': 0.014947138169886985, 'mean_word_length': 4.622950819672131, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1141597', 'n_tokens_mistral': 984, 'n_tokens_neox': 933, 'n_words': 231}