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.

Selection with search and unicode

See original GitHub issue

Combining, surrogate or fullwidth chars in the line and/or the search string lead to weird selection offset problems. Steps to repro:

  • insert into demo: echo -en 'combining: ééé\nfullwidth: ¥¥¥\nsurrogate: 𓂀𓂀𓂀\n'
  • search for ‘ééé’, ‘¥¥¥’ and ‘𓂀𓂀𓂀’

The selection is kinda off for all 3 types, it gets even worse if the line contains any of these before their occurence. It seems the renderer and the selection manager do not agree on the chars widths and lengths.

Since I had a similar problem with the linkifier, it might be fixable the same way (#1678).

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:29 (17 by maintainers)

github_iconTop GitHub Comments

1reaction
Tyriarcommented, Oct 25, 2021

@JasinYip there’s some discussion about the fix in https://github.com/xtermjs/xterm.js/pull/3236, been a while since I looked and don’t have time atm though.

1reaction
jerchcommented, Oct 31, 2019

@jerch I’m having a bit of a difficult time determining how and where cell offsetting should be (or is) implemented. Within BufferLine.ts?

Ah yepp thats abit hidden in the codebase, the code regarding this is in Buffer.ts and BufferLine.ts, both contain several methods that demostrate how to walk cells, easiest startpoint might be this: https://github.com/xtermjs/xterm.js/blob/e8153d929d6bb4f7012d3f20aa8c74abc335715d/src/common/buffer/Buffer.ts#L480

Not sure if you can directly use this method, you have to take care where your string index origin is (whether col 0 of wrapped or unwrapped lines).

Read more comments on GitHub >

github_iconTop Results From Across the Web

Unihan Database Search Page - Unicode
To select a field to search, use the pop-up menu. Enter the data to search for in the text field, and click on...
Read more >
Insert ASCII or Unicode Latin-based symbols and characters
To select a character, click the character, click Select, click the right mouse button in your document where you want the character, and...
Read more >
search as unicode angular - typescript - Stack Overflow
Thanks everyone, I managed to solve by doing some tests. I decided to create a function that returns the value handled by regex....
Read more >
Unicode Quick Guide - Digital Scholarship Group
The one you want is “Unicode Hex Input”; select that one and choose ... You can search for the character you want by...
Read more >
Regex Tutorial - Unicode Characters and Properties
You can find a complete list of all Unicode properties below. ... would be a better choice than the Unicode block \p{InCurrency_Symbols} when...
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