Gui.cs: TextField does not accept characters like @

Created on 12 Mar 2020  Â·  16Comments  Â·  Source: migueldeicaza/gui.cs

Hi,
I'm using some TextFields in my application and I came across a problem. Every time I try to write an '@' character into the field it spawns a 'q' instead. Does somebody have a solution for this? Thanks in advance.

Greetings

Most helpful comment

Good point, I should keep at least the test.

All 16 comments

In my it spawns well on Windows 10

textfield

Hmmm,

at first thanks for your answer. I'm also running it on Windows 10 and Terminal.Gui version 0.70.0. I can't help it, but my TextFields do not accept '@' or '€'. Other characters that are created with an "Alt" combination like '|' or '²' are correctly written into the TextField.

Am I missing some property that I need to set?

I can't post my original code because of it is too long. Here is a little sample that also has this problem.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terminal.Gui;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            Application.Init();

            var topWindow = new Window("test runner");

            TextField randomTextField = new TextField("") { Width =29 };
            topWindow.Add(randomTextField);

            Application.Top.Add(topWindow);

            Application.Run();
        }
    }
}

No, you don't missing anything. You are right. Try with my pr at https://github.com/migueldeicaza/gui.cs/pull/345

Still not working on my machine
here I tried to write '@' and '€', it's also not working when I try to copy the chars into the TextField.

image

In my pr the '€' really spawns to 'e'. I' will see that. But '@' spawns correctly. Try in the console to verify if it spawns alright too.

In the normal console the mentioned characters spawn correctly.

When I set '@' as text in the constructor of Textfield it works. But while running the app it doesn't.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terminal.Gui;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {

            Application.Init();

            var topWindow = new Window("test runner");

            var rndTextField = new TextField("@@@@@@@@@@@@");

            topWindow.Add(rndTextField);

            Application.Top.Add(topWindow);

            Application.Run();

        }
    }
}

But when I try to set '€' as text in the constructor of TextField I run into a "System.IndexOutOfRangeException"

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Terminal.Gui;

namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {

            Application.Init();

            var topWindow = new Window("test runner");

            var rndTextField = new TextField("€");

            topWindow.Add(rndTextField);

            Application.Top.Add(topWindow);

            Application.Run();

        }
    }
}

Ok, I already got it. It's a bug in Stack and there is an pr to fix at https://github.com/migueldeicaza/NStack/pull/42. I created a package and is working at constructor. Writing inside the text there still have some incorrect mapping.

textfield

Nice to hear you found a solution for one of the problems.

I am confused, the issue for the NStack#42 should have been fixed a long time ago, I do not think I need #42 do I? It shows a conflict for a change that is already there.

There is a pr in https://github.com/migueldeicaza/NStack/pull/42/commits/fe8866e169dcf2ab1657d2e0f2041ae6f3146d2c that needs to be merged in NStack to solves this issue.

I am confused - that PR was already merged.

This is my version of the fix, and it is quite old:

https://github.com/migueldeicaza/NStack/commit/3fc024fb2c2e99927d3e12991570fb54db8ce01e#diff-8ddd7307a3d5c77d1e274e484581031c

But why they are still open in the pr? Another day I merged into a new branch and used in the Gui and I didn't get the error in the ColumnWidth method of the Rune class on the textfield at Redraw. And I've some changes that will be possible to use the AltMask + ControlA + delta and special characters, like €. I'm still working to solve some small bugs that yet persist. If you can update the Stack I'll include that improvments too. @migueldeicaza did you update the nuget too? Thanks.

@migueldeicaza, that is the pr that solves the ColumnWidth of Run class error
https://github.com/migueldeicaza/NStack/pull/44

It's working well now. Some cache problem with the NStack nuget package, I think. Sorry

Good point, I should keep at least the test.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

YauhenPyl picture YauhenPyl  Â·  22Comments

BDisp picture BDisp  Â·  12Comments

timothyparez picture timothyparez  Â·  26Comments

blakepell picture blakepell  Â·  13Comments

InvictusMB picture InvictusMB  Â·  22Comments