question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Emojis not working in TableView? (NStack or gui.cs issue potentially)

See original GitHub issue

I 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:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:14

github_iconTop GitHub Comments

2reactions
kierenjcommented, Nov 26, 2021

Aha! public static int ColumnWidth(char c) in that PR 😃 😃

I’ll try it, thanks

1reaction
kierenjcommented, Nov 26, 2021

That’s the Windows driver, on Windows Terminal, font is MesloLGL NF

(https://github.com/romkatv/dotfiles-public/tree/master/.local/share/fonts/NerdFonts)

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found