Emojis not working in TableView? (NStack or gui.cs issue potentially)
See original GitHub issueI get this exception from NStack
:
System.ArgumentException: Value in the surrogate range and isn't part of a surrogate pair!
at System.Rune..ctor(Char ch)
at System.Rune.op_Implicit(Char ch)
at Terminal.Gui.TableView.<>c.<CalculateMaxCellWidth>b__92_1(Char c) in C:\git\saffron\deps\gui.cs\Terminal.Gui\Views\TableView.cs:line 1123
at System.Linq.Enumerable.Sum[TSource](IEnumerable`1 source, Func`2 selector)
at Terminal.Gui.TableView.CalculateMaxCellWidth(DataColumn col, Int32 rowsToRender, ColumnStyle colStyle) in C:\git\saffron\deps\gui.cs\Terminal.Gui\Views\TableView.cs:line 1123
at Terminal.Gui.TableView.CalculateViewport(Rect bounds, Int32 padding)+MoveNext() in C:\git\saffron\deps\gui.cs\Terminal.Gui\Views\TableView.cs:line 1081
at System.Collections.Generic.LargeArrayBuilder`1.AddRange(IEnumerable`1 items)
at System.Collections.Generic.EnumerableHelpers.ToArray[T](IEnumerable`1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at Terminal.Gui.TableView.Redraw(Rect bounds) in C:\git\saffron\deps\gui.cs\Terminal.Gui\Views\TableView.cs:line 200
The data in the TableRow
column contains the emojis, 🤖🧠
.
The “offending” line of code is:
spaceRequired = Math.Max (spaceRequired, GetRepresentation (Table.Rows [i] [col], colStyle).Sum (c => Rune.ColumnWidth (c)));
My guess is, this code is assuming a single char
is a valid Rune
, which is not always true. Should/could it instead use DecodeRune
in a loop, calling Rune.ColumnWidth
on each and summing the results?
Or, is this kind of emoji/data not supported on gui.cs and I should avoid? Thanks.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:14
Top Results From Across the Web
Emojis not working in TableView? (NStack or gui.cs issue ...
I get this exception from NStack: System.ArgumentException: Value in the surrogate range and isn't part of a surrogate pair! at System.
Read more >Untitled
No boyfriend no problem japanese, Barron elementary pflugerville! Fifa 14 players with most potential, Salvacion por fe versiculos, Indian railway old fare ...
Read more >Untitled
1 try not to laugh, Ps4 controller pairing mode not working, ... Town of churchill the, Real estate letters to potential clients, 1994...
Read more >powered by Falcon Sandbox - Viewing online file ...
Not all malicious and suspicious indicators are displayed. ... Possibly tries to implement anti-virtualization techniques using MAC address detection.
Read more >Untitled
Pack n stack cape town, Daewoo cielo mileage, Cavachon mn? ... 25473 e quarto pl, Artificial human organs ethical issues, Unruhen in tunesien...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Aha!
public static int ColumnWidth(char c)
in that PR 😃 😃I’ll try it, thanks
That’s the Windows driver, on Windows Terminal, font is
MesloLGL NF
(https://github.com/romkatv/dotfiles-public/tree/master/.local/share/fonts/NerdFonts)