Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TextField does not accept characters like @ #346

Closed
rueckertch58521 opened this issue Mar 12, 2020 · 16 comments
Closed

TextField does not accept characters like @ #346

rueckertch58521 opened this issue Mar 12, 2020 · 16 comments

Comments

@rueckertch58521
Copy link

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

@BDisp
Copy link
Collaborator

BDisp commented Mar 12, 2020

In my it spawns well on Windows 10

textfield

@rueckertch58521
Copy link
Author

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();
        }
    }
}

@BDisp
Copy link
Collaborator

BDisp commented Mar 12, 2020

No, you don't missing anything. You are right. Try with my pr at #345

@rueckertch58521
Copy link
Author

rueckertch58521 commented Mar 12, 2020

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

@BDisp
Copy link
Collaborator

BDisp commented Mar 12, 2020

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.

@rueckertch58521
Copy link
Author

rueckertch58521 commented Mar 12, 2020

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();

        }
    }
}

@BDisp
Copy link
Collaborator

BDisp commented Mar 12, 2020

Ok, I already got it. It's a bug in Stack and there is an pr to fix at gui-cs/NStack#42. I created a package and is working at constructor. Writing inside the text there still have some incorrect mapping.

textfield

@rueckertch58521
Copy link
Author

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

@migueldeicaza
Copy link
Collaborator

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.

@BDisp
Copy link
Collaborator

BDisp commented Mar 25, 2020

There is a pr in gui-cs/NStack@fe8866e that needs to be merged in NStack to solves this issue.

@migueldeicaza
Copy link
Collaborator

I am confused - that PR was already merged.

@migueldeicaza
Copy link
Collaborator

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

gui-cs/NStack@3fc024f#diff-8ddd7307a3d5c77d1e274e484581031c

@BDisp
Copy link
Collaborator

BDisp commented Mar 27, 2020

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.

@BDisp
Copy link
Collaborator

BDisp commented Mar 27, 2020

@migueldeicaza, that is the pr that solves the ColumnWidth of Run class error
gui-cs/NStack#44

@BDisp
Copy link
Collaborator

BDisp commented Mar 27, 2020

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

@migueldeicaza
Copy link
Collaborator

Good point, I should keep at least the test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants