コード例 #1
0
        void GetWindowDimensions()
        {
            /* Try the ioctl first */
            if (!ConsoleDriver.GetTtySize(MonoIO.ConsoleOutput, out windowWidth, out windowHeight))
            {
                windowWidth = reader.Get(TermInfoNumbers.Columns);
                string env = Environment.GetEnvironmentVariable("COLUMNS");
                if (env != null)
                {
                    try {
                        windowWidth = (int)UInt32.Parse(env);
                    } catch {
                    }
                }

                windowHeight = reader.Get(TermInfoNumbers.Lines);
                env          = Environment.GetEnvironmentVariable("LINES");
                if (env != null)
                {
                    try {
                        windowHeight = (int)UInt32.Parse(env);
                    } catch {
                    }
                }
            }

            bufferHeight           = windowHeight;
            bufferWidth            = windowWidth;
            need_window_dimensions = false;
        }