Ticket #278 (closed defect: fixed)

Opened 4 months ago

Last modified 3 months ago

Fix selectionString related Text issue

Reported by: fbo Owned by:
Priority: critical Milestone:
Component: Text Keywords:
Cc:

Description (last modified by fbo) (diff)

Text>>selectionString should look like this:

    selectionString: function() {
        var range = this.getSelectionRange();
        if (!range) { return ''; }
        var begin = (range[0] >  range[1]) ? range[1] : range[0];
            end   = (range[0] >= range[1]) ? range[0] : range[1];
        return  this.textString.substring(begin, end);
    },

Problem: When doing it this way instead of returning this.domSelection().toString() (undesirable), we have an editing problem.

When the cursor is moved BEYOND the end of a text using right key (say, cursor is at the beginning of a 3-character text and you press right key , the cursor is displayed at the end of that text, but once you type, characters are inserted before the last character in that text. At that point, this text instance is broken.

On a fresh text object, you can .. ... move the cursor to the end of the text using the mouse, ... move it EXACTLY to the end of the text using right arrow key without running into that issue.

Next thing I'm going to do is look into what happens onRightPressed etc.

Change History

comment:1 Changed 4 months ago by fbo

The described behavior is reproducable in both Firefox and Chrome, which makes a fix likely to work in both browsers. Yippie.

comment:2 Changed 4 months ago by fbo

  • Description modified (diff)

comment:3 Changed 4 months ago by fbo

What is still unclear: why does selectionString which should not alter the text's state influence text editing behavior?

comment:4 Changed 4 months ago by fbo

Let's also have a look at what TextChunkOwner?>>fixChunks passes to Text>>setSelectionRange

comment:5 Changed 3 months ago by fbo

  • Status changed from new to closed
  • Resolution set to fixed

fixed for FF and Chrome, but HTML only

Note: See TracTickets for help on using tickets.