Didn't mean to start such an involved discussion. All I was pointing out is that the start and end of a selections are not byte indices if any non-ASCII characters are in the text. And converting UTF-8 to literal4 makes them indices. I have looked through the documentation and all I could find was that selection specifies the start and end of a selection. It never said whether they were byte indices or a character indices.
I don't know why Qt does it that way. And it really doesn't matter. But people need to be aware as how it works. I wasted a lot of time finding that out the hard way. On Mon, Oct 24, 2016 at 8:13 PM, Henry Rich <[email protected]> wrote: > Not mentioned, because I have no idea what the reasons might be. I was > just trying to describe the behavior. If you know the reasons, pray reveal > them. > > Henry Rich > > > On 10/24/2016 8:59 PM, bill lam wrote: > >> While the behavior is well documented, I suspect there should be >> some specific reasons for prefering character index instead of >> byte index, but that was not mentioned. >> >> Пн, 24 окт 2016, Henry Rich написал(а): >> >>> It's already documented in the note at the end of >>> >>> http://code.jsoftware.com/wiki/Guides/Window_Driver/ChildClasses#edit >>> >>> & other controls. I'm not saying that the info might not profitably be >>> repeated elsewhere. >>> >>> Henry Rich >>> >>> On 10/24/2016 11:32 AM, Don Guinn wrote: >>> >>>> Added to the bug list. I vote for leaving it as it is and documenting >>>> the >>>> way it works. It's not that hard to deal with once one is aware of how >>>> it >>>> works. >>>> >>>> On Mon, Oct 24, 2016 at 5:30 AM, chris burke <[email protected]> >>>> wrote: >>>> >>>> I agree with Don in that this just needs documenting, and is not a bug. >>>>> >>>>> On 24 October 2016 at 05:45, Bill <[email protected]> wrote: >>>>> >>>>> Qt works on unicode characters, but j uses utf8 for interfacing with Qt >>>>>> >>>>> so >>>>> >>>>>> that I think this issue is a bug, it should report byte offset. >>>>>> Please >>>>>> file a bug in jwiki for record. >>>>>> >>>>>> On 24 Oct, 2016, at 1:28 PM, Don Guinn <[email protected]> wrote: >>>>>> >>>>>> The return from (wd 'sm get edit') contains the text behind the window >>>>>>> >>>>>> and >>>>>> >>>>>>> select showing a selection. The text is literal and the select gives >>>>>>> indices of selected characters. If text contains any unicode >>>>>>> >>>>>> characters, >>>>> >>>>>> like line drawing characters the indices are offset. The indices are >>>>>>> >>>>>> not >>>>> >>>>>> in >>>>>> >>>>>>> bytes, but characters. Converting the text to either literal2 or >>>>>>> >>>>>> literal4 >>>>> >>>>>> makes the select indices correct. >>>>>>> >>>>>>> >>>>>>> I don't think that this is an error, but one must convert the text to >>>>>>> literal2 or literal4 to get the index to work. Should the index >>>>>>> reflect >>>>>>> >>>>>> the >>>>>> >>>>>>> U8 selection index instead of the literal2 or literal4 indices? A >>>>>>> >>>>>> little >>>>> >>>>>> inconsistency. >>>>>>> >>>>>>> >>>>>>> I haven't been able to find where this kind of information is >>>>>>> covered, >>>>>>> >>>>>> but >>>>>> >>>>>>> it may be there somewhere. Is this the way it's supposed to work? If >>>>>>> >>>>>> so, >>>>> >>>>>> not a problem, but it needs to be documented. I learned how it works >>>>>>> by >>>>>>> experimenting. There is no Discussion on the >>>>>>> >>>>>> Window_Driver/Session_Manager >>>>>> >>>>>>> page, I can put in it what I have found so far, but I suspect that >>>>>>> >>>>>> there >>>>> >>>>>> is >>>>>> >>>>>>> a lot more that should be covered. >>>>>>> ------------------------------------------------------------ >>>>>>> ---------- >>>>>>> For information about J forums see http://www.jsoftware.com/forum >>>>>>> s.htm >>>>>>> >>>>>> ------------------------------------------------------------ >>>>>> ---------- >>>>>> For information about J forums see http://www.jsoftware.com/forum >>>>>> s.htm >>>>>> >>>>>> ------------------------------------------------------------ >>>>> ---------- >>>>> For information about J forums see http://www.jsoftware.com/forums.htm >>>>> >>>>> ---------------------------------------------------------------------- >>>> For information about J forums see http://www.jsoftware.com/forums.htm >>>> >>> ---------------------------------------------------------------------- >>> For information about J forums see http://www.jsoftware.com/forums.htm >>> >> > ---------------------------------------------------------------------- > For information about J forums see http://www.jsoftware.com/forums.htm > ---------------------------------------------------------------------- For information about J forums see http://www.jsoftware.com/forums.htm
