<commit_before>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Cosmos.Core;
using Cosmos.Debug.Kernel;

namespace Cosmos.HAL
{
    // Dont hold state here. This is a raw to hardware class. Virtual screens should be done
    // by memory moves
    public class TextScreen : TextScreenBase
    {
        protected byte Color = 0x0F; // White
        protected ushort mBackgroundClearCellValue;
        protected ushort mTextClearCellValue;
        public uint mRow2Addr;
        public uint mScrollSize;
        protected int mCursorSize = 25; // 25 % as C# Console class
        protected bool mCursorVisible = true;

        public Core.IOGroup.TextScreen IO = new Cosmos.Core.IOGroup.TextScreen();
        public MemoryBlock08 mRAM;

        /// <summary>
        /// Creat new instance of the <see cref="TextScreen"/> class.
        /// </summary>
        public TextScreen()
        {
            if (this is TextScreen)
            {
                TextScreenHelpers.Debug("this is TextScreen");
            }
            else
            {
                TextScreenHelpers.Debug("ERROR: This is not of type TextScreen!");
            }
            mRAM = IO.Memory.Bytes;
            // Set the Console default colors: White foreground on Black background, the default value of mClearCellValue is set there too as it is linked with the Color
            SetColors(ConsoleColor.White, ConsoleColor.Black);
            mBackgroundClearCellValue = mTextClearCellValue;
            mRow2Addr = (uint)(Cols * 2);
            mScrollSize = (uint)(Cols * (Rows - 1) * 2);
            SetCursorSize(mCursorSize);
            SetCursorVisible(mCursorVisible);
            TextScreenHelpers.Debug("End of TextScreen..ctor");
        }

        public void UpdateWindowSize()
        {
            IO.Memory = new Cosmos.Core.MemoryBlock(0xB8000, (uint)(Cols * Rows * 2));
            mRAM = new Cosmos.Core.MemoryBlock(0xB8000, (uint)(Cols * Rows * 2)).Bytes;
            mScrollSize = (uint)(Cols * (Rows - 1) * 2);
            mRow2Addr = (uint)(Cols * 2);
        }

        public override ushort Rows { set; get; } = 25;
        public override ushort Cols { set; get; } = 80;

        /// <summary>
        /// Clear text screen.
        /// </summary>
        public override void Clear()
        {
            TextScreenHelpers.Debug("Clearing screen with value ");
            TextScreenHelpers.DebugNumber(mTextClearCellValue);
            IO.Memory.Fill(mTextClearCellValue);
            mBackgroundClearCellValue = mTextClearCellValue;
        }<commit_msg>Fixed nitpick<commit_after>﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Cosmos.Core;
using Cosmos.Debug.Kernel;

namespace Cosmos.HAL
{
    // Dont hold state here. This is a raw to hardware class. Virtual screens should be done
    // by memory moves
    public class TextScreen : TextScreenBase
    {
        protected byte Color = 0x0F; // White
        protected ushort mBackgroundClearCellValue;
        protected ushort mTextClearCellValue;
        public uint mRow2Addr;
        public uint mScrollSize;
        protected int mCursorSize = 25; // 25 % as C# Console class
        protected bool mCursorVisible = true;

        public Core.IOGroup.TextScreen IO = new Cosmos.Core.IOGroup.TextScreen();
        public MemoryBlock08 mRAM;

        /// <summary>
        /// Creat new instance of the <see cref="TextScreen"/> class.
        /// </summary>
        public TextScreen()
        {
            if (this is TextScreen)
            {
                TextScreenHelpers.Debug("this is TextScreen");
            }
            else
            {
                TextScreenHelpers.Debug("ERROR: This is not of type TextScreen!");
            }
            mRAM = IO.Memory.Bytes;
            // Set the Console default colors: White foreground on Black background, the default value of mClearCellValue is set there too as it is linked with the Color
            SetColors(ConsoleColor.White, ConsoleColor.Black);
            mBackgroundClearCellValue = mTextClearCellValue;
            mRow2Addr = (uint)(Cols * 2);
            mScrollSize = (uint)(Cols * (Rows - 1) * 2);
            SetCursorSize(mCursorSize);
            SetCursorVisible(mCursorVisible);
            TextScreenHelpers.Debug("End of TextScreen..ctor");
        }

        public void UpdateWindowSize()
        {
            IO.Memory = new Cosmos.Core.MemoryBlock(0xB8000, (uint)(Cols * Rows * 2));
            mRAM = IO.Memory.Bytes;
            mScrollSize = (uint)(Cols * (Rows - 1) * 2);
            mRow2Addr = (uint)(Cols * 2);
        }

        public override ushort Rows { set; get; } = 25;
        public override ushort Cols { set; get; } = 80;

        /// <summary>
        /// Clear text screen.
        /// </summary>
        public override void Clear()
        {
            TextScreenHelpers.Debug("Clearing screen with value ");
            TextScreenHelpers.DebugNumber(mTextClearCellValue);
            IO.Memory.Fill(mTextClearCellValue);
            mBackgroundClearCellValue = mTextClearCellValue;
        }
{'fraction_non_alphanumeric': 0.09245647969052224, 'fraction_numerical': 0.01160541586073501, 'mean_word_length': 2.0011607661056297, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, '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': '5428115', 'n_tokens_mistral': 1427, 'n_tokens_neox': 1371, 'n_words': 399}