<commit_before>package main

import (
	"github.com/kybin/tor/cell"
	"github.com/mattn/go-runewidth"
	term "github.com/nsf/termbox-go"
)

func SetCell(l, o int, r rune, fg, bg term.Attribute) {
	term.SetCell(o, l, r, fg, bg)
}

// draw text inside of window at mainarea.
func drawScreen(norm *NormalMode, w *Window) {
	// parse syntax
	if norm.dirty {
		norm.parser.ClearFrom(cell.Pt{L: w.min.L, O: 0})
		norm.dirty = false
	}
	norm.parser.ParseTo(cell.Pt{L: w.Max().L + 1, O: 0})

	// draw
	for l, ln := range norm.text.lines {
		if l < w.min.L || l >= w.Max().L {
			continue
		}
		o := 0
		for b, r := range ln.data {
			if o >= w.Max().O {
				break
			}

			bg := term.ColorBlack
			fg := term.ColorWhite
			for _, m := range norm.parser.Matches {
				if m.Range.Contains(cell.Pt{l, b}) {
					c := norm.parser.Color(m.Name)
					bg = c.Bg
					fg = c.Fg
					break
				}
			}

			if norm.selection.on && norm.selection.Contains(cell.Pt{l, b}) {
				bg = term.ColorGreen
			}
			if r == '\t' {
				for i := 0; i < norm.text.tabWidth; i++ {
					if o >= w.min.O {
						SetCell(l-w.min.L, o-w.min.O, rune(' '), fg, bg)
					}
					o += 1
				}
			} else {
				if o >= w.min.O {
					SetCell(l-w.min.L, o-w.min.O, rune(r), fg, bg)
				}
				o += runewidth.RuneWidth(r)
			}
		}
	}
}

// drawStatus draws current status of m at bottom of terminal.
// If m has Error, it will printed with red background.
func drawStatus(m Mode) {
	var bg term.Attribute
	var status string<commit_msg>remove Selection.on check in drawScreen<commit_after>package main

import (
	"github.com/kybin/tor/cell"
	"github.com/mattn/go-runewidth"
	term "github.com/nsf/termbox-go"
)

func SetCell(l, o int, r rune, fg, bg term.Attribute) {
	term.SetCell(o, l, r, fg, bg)
}

// draw text inside of window at mainarea.
func drawScreen(norm *NormalMode, w *Window) {
	// parse syntax
	if norm.dirty {
		norm.parser.ClearFrom(cell.Pt{L: w.min.L, O: 0})
		norm.dirty = false
	}
	norm.parser.ParseTo(cell.Pt{L: w.Max().L + 1, O: 0})

	// draw
	for l, ln := range norm.text.lines {
		if l < w.min.L || l >= w.Max().L {
			continue
		}
		o := 0
		for b, r := range ln.data {
			if o >= w.Max().O {
				break
			}

			bg := term.ColorBlack
			fg := term.ColorWhite
			for _, m := range norm.parser.Matches {
				if m.Range.Contains(cell.Pt{l, b}) {
					c := norm.parser.Color(m.Name)
					bg = c.Bg
					fg = c.Fg
					break
				}
			}

			if norm.selection.Contains(cell.Pt{l, b}) {
				bg = term.ColorGreen
			}
			if r == '\t' {
				for i := 0; i < norm.text.tabWidth; i++ {
					if o >= w.min.O {
						SetCell(l-w.min.L, o-w.min.O, rune(' '), fg, bg)
					}
					o += 1
				}
			} else {
				if o >= w.min.O {
					SetCell(l-w.min.L, o-w.min.O, rune(r), fg, bg)
				}
				o += runewidth.RuneWidth(r)
			}
		}
	}
}

// drawStatus draws current status of m at bottom of terminal.
// If m has Error, it will printed with red background.
func drawStatus(m Mode) {
	var bg term.Attribute
	var status string
{'fraction_non_alphanumeric': 0.16784392869155734, 'fraction_numerical': 0.004036326942482341, 'mean_word_length': 2.25382932166302, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 11, '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': '267129', 'n_tokens_mistral': 1440, 'n_tokens_neox': 1225, 'n_words': 310}