PetTracker

PetTracker

13M Downloads

Typing Korean letters in filter bar causes duplicate letters

comiluv opened this issue · 3 comments

commented

Running Software (issues missing this information will be deleted):

  • Addon version:8.3.8
  • Server patch: [e.g. Build 8.0.1.27178]
    8.3.7.35284

Have you read the changelog? (please don't waste our time)
Mark if read.
Yes

Describe the bug
A clear and concise description of what the bug is.
Typing Korean word such as '거미' which means spider in filter bar causes duplicate consonant/vowel entry that renders directly typing into filter bar to be broken

To Reproduce
Steps to reproduce the behaviour:

  1. Start WOW in Korean client
  2. Open world map
  3. Type in a Korean word in PetTracker filter bar

Expected behaviour
A clear and concise description of what you expected to happen.
Typed word gets correctly input inside filter bar

Screenshots
If applicable, add screenshots to help explain your problem.
Below is word 거미 is directly typed in filter bar thus has wrong input
WoWScrnShot_080320_043913

Below is word 거미 is copy-pasted from another source (notepad, web browser, etc.) and has right input
WoWScrnShot_080320_043927

Error Logs
Type /console scriptErrors 1 in the chat and reload the game. If an error window appears, write here the message with ID: 1 (labelled 1/X). This is generally NOT the message that the window shows by default.
N/A

Additional context
Add any other context about the problem here.
Specifically, below code in line 65, mapSearch.lua is causing the issue.

search:SetScript('OnTextChanged', function() self:SetTextFilter(search:GetText()) end)

If you are not familiar with unicode programming, below is a sample code to return string length in JavaScript

String.prototype.mbLength = function(){
	var totalLength = 0; 
	var i; 
	var charCode; 
	for (i = 0; i < this.length; i++) { 
		charCode = this.charCodeAt(i); 
		if (charCode < 0x007f) { 
			totalLength = totalLength + 1; 
		} else if ((0x0080 <= charCode) && (charCode <= 0x07ff)) { 
			totalLength += 2; 
		} else if ((0x0800 <= charCode) && (charCode <= 0xffff)) { 
			totalLength += 3; 
		}
	}
	return totalLength;
}
commented

Going to close this issue when the PR gets merged

commented

Bagnon also has a search function that highlights items in real time that doesn't interfere with actual user input

commented

Update: quick workaround is to comment out MapSearch:UpdateBoxes() in mapSearch.lua

function MapSearch:UpdateBoxes()
  for frame, search in pairs(self.Frames) do
    if search ~= 1 then
    --   self:UpdateBox(frame) <-- like this
    end
  end
end