mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-02 01:03:29 +01:00
* Remove NStack and replace ustring to string.
* Add unit test and improving some code.
* Adjust code and fix all unit tests errors.
* Add XML Document and move the Rune folder into the Text folder.
* Improve unit tests with byte array on DecodeRune and DecodeLastRune.
* Fix unit test.
* 😂Code review
* Reduce unit tests code.
* Change StringExtensions.Make to StringExtensions.ToString and added some more unit tests.
* Fix merge errors.
* Remove GetTextWidth and calls replaced with StringExtensions.GetColumns.
* Hack to use UseSystemConsole passed in the command line arguments.
* Revert "Hack to use UseSystemConsole passed in the command line arguments."
This reverts commit b74d11c786.
* Remove Application.UseSystemConsole from the config file.
* Fix errors related by removing UseSystemConsole from the config file.
* Fixes #2633. DecodeEscSeq throw an exception if cki is null.
* Fix an exception if SelectedItem is -1.
* Set SelectedItem to 0 and remove unnecessary ToString.
* Using a unique ToString method for Rune and other for byte.
* Fix a bug where a wider rune is added with only a width of 1.
* Force the SelectedGlyph is the one that was typed after jumpList is executed.
* Added more InlineData to RuneTests.
* Reducing significantly the code by using Theory attribute in the TextFormatterTests.
* Override PositionCursor to handle the CharMap cursor position.
* Fix merge errors.
* Minor tweaks to API docs
---------
Co-authored-by: Tig Kindel <tig@users.noreply.github.com>
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
@@ -31,13 +32,10 @@ namespace Terminal.Gui.ViewsTests {
|
||||
|
||||
// 1 2 3
|
||||
// 01234567890123456789012345678901=32 (Length)
|
||||
var buff = new byte [txt.Length];
|
||||
for (int i = 0; i < txt.Length; i++) {
|
||||
buff [i] = (byte)txt [i];
|
||||
}
|
||||
var buff = Encoding.Unicode.GetBytes(txt);
|
||||
var ms = new System.IO.MemoryStream (buff).ToArray ();
|
||||
_textView = new TextView () { Width = 30, Height = 10 };
|
||||
_textView.Text = ms;
|
||||
_textView.Text = Encoding.Unicode.GetString (ms);
|
||||
}
|
||||
|
||||
public override void After (MethodInfo methodUnderTest)
|
||||
@@ -987,12 +985,12 @@ namespace Terminal.Gui.ViewsTests {
|
||||
_textView.ProcessKey (new KeyEvent (Key.K | Key.CtrlMask, new KeyModifiers ()));
|
||||
Assert.Equal (0, _textView.CursorPosition.X);
|
||||
Assert.Equal (0, _textView.CursorPosition.Y);
|
||||
Assert.Equal ("", _textView.Text.ToString ());
|
||||
Assert.Equal ($"This is the first line.{Environment.NewLine}This is the second line.", Clipboard.Contents.ToString ());
|
||||
Assert.Equal ("", _textView.Text);
|
||||
Assert.Equal ($"This is the first line.{Environment.NewLine}This is the second line.", Clipboard.Contents);
|
||||
|
||||
// Paste
|
||||
_textView.ProcessKey (new KeyEvent (Key.Y | Key.CtrlMask, new KeyModifiers ()));
|
||||
Assert.Equal ($"This is the first line.{Environment.NewLine}This is the second line.", _textView.Text.ToString ());
|
||||
Assert.Equal ($"This is the first line.{Environment.NewLine}This is the second line.", _textView.Text);
|
||||
break;
|
||||
default:
|
||||
iterationsFinished = true;
|
||||
@@ -1895,7 +1893,7 @@ namespace Terminal.Gui.ViewsTests {
|
||||
|
||||
for (int i = lCount; i >= 0; i--) {
|
||||
var r = line [i];
|
||||
sumLength += Rune.ColumnWidth (r);
|
||||
sumLength += ((Rune)r).GetColumns ();
|
||||
if (r == '\t') {
|
||||
sumLength += tabWidth + 1;
|
||||
}
|
||||
@@ -2014,7 +2012,7 @@ namespace Terminal.Gui.ViewsTests {
|
||||
Assert.Equal (8, tv.Text.Length);
|
||||
Assert.Equal (text, tv.Text);
|
||||
Assert.False (tv.IsDirty);
|
||||
Assert.Equal ('\u2400', ConsoleDriver.MakePrintable ((Rune)tv.Text [4]));
|
||||
Assert.Equal ((Rune)'\u2400', ((Rune)tv.Text [4]).MakePrintable ());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2200,21 +2198,21 @@ line.
|
||||
var txt = "This is a text.";
|
||||
var txtRunes = TextModel.ToRunes (txt);
|
||||
Assert.Equal (txt.Length, txtRunes.Count);
|
||||
Assert.Equal ('T', txtRunes [0]);
|
||||
Assert.Equal ('h', txtRunes [1]);
|
||||
Assert.Equal ('i', txtRunes [2]);
|
||||
Assert.Equal ('s', txtRunes [3]);
|
||||
Assert.Equal (' ', txtRunes [4]);
|
||||
Assert.Equal ('i', txtRunes [5]);
|
||||
Assert.Equal ('s', txtRunes [6]);
|
||||
Assert.Equal (' ', txtRunes [7]);
|
||||
Assert.Equal ('a', txtRunes [8]);
|
||||
Assert.Equal (' ', txtRunes [9]);
|
||||
Assert.Equal ('t', txtRunes [10]);
|
||||
Assert.Equal ('e', txtRunes [11]);
|
||||
Assert.Equal ('x', txtRunes [12]);
|
||||
Assert.Equal ('t', txtRunes [13]);
|
||||
Assert.Equal ('.', txtRunes [^1]);
|
||||
Assert.Equal ('T', txtRunes [0].Value);
|
||||
Assert.Equal ('h', txtRunes [1].Value);
|
||||
Assert.Equal ('i', txtRunes [2].Value);
|
||||
Assert.Equal ('s', txtRunes [3].Value);
|
||||
Assert.Equal (' ', txtRunes [4].Value);
|
||||
Assert.Equal ('i', txtRunes [5].Value);
|
||||
Assert.Equal ('s', txtRunes [6].Value);
|
||||
Assert.Equal (' ', txtRunes [7].Value);
|
||||
Assert.Equal ('a', txtRunes [8].Value);
|
||||
Assert.Equal (' ', txtRunes [9].Value);
|
||||
Assert.Equal ('t', txtRunes [10].Value);
|
||||
Assert.Equal ('e', txtRunes [11].Value);
|
||||
Assert.Equal ('x', txtRunes [12].Value);
|
||||
Assert.Equal ('t', txtRunes [13].Value);
|
||||
Assert.Equal ('.', txtRunes [^1].Value);
|
||||
|
||||
int col = 0;
|
||||
Assert.True (TextModel.SetCol (ref col, 80, 79));
|
||||
@@ -2224,11 +2222,11 @@ line.
|
||||
var start = 0;
|
||||
var x = 8;
|
||||
Assert.Equal (8, TextModel.GetColFromX (txtRunes, start, x));
|
||||
Assert.Equal ('a', txtRunes [start + x]);
|
||||
Assert.Equal ('a', txtRunes [start + x].Value);
|
||||
start = 1;
|
||||
x = 7;
|
||||
Assert.Equal (7, TextModel.GetColFromX (txtRunes, start, x));
|
||||
Assert.Equal ('a', txtRunes [start + x]);
|
||||
Assert.Equal ('a', txtRunes [start + x].Value);
|
||||
|
||||
Assert.Equal ((15, 15), TextModel.DisplaySize (txtRunes));
|
||||
Assert.Equal ((6, 6), TextModel.DisplaySize (txtRunes, 1, 7));
|
||||
|
||||
Reference in New Issue
Block a user