Ticket #2486: 2486.patch

File 2486.patch, 25.0 KB (added by diana, 15 years ago)
  • modules/org.sophie2.main.app.commons/src/main/java/org/sophie2/main/app/commons/links/LinkHolder.java

    ### Eclipse Workspace Patch 1.0
    #P sophie
     
    1919public interface LinkHolder { 
    2020         
    2121        /** 
     22         * Used only for synchronizing the wanted link property in  
     23         * currentRuleSync - for the text link holders should depend on the 
     24         * currently selected interval. 
     25         *  
     26         * @return 
     27         *                Different numbers if the wanted rule should be set to null, 
     28         *                a constant otherwise. 
     29         */ 
     30        int getSync(); 
     31        /** 
    2232         * Gets the link model of this holder. 
    2333         *  
    2434         * @return 
  • modules/org.sophie2.base.model.text/src/test/java/org/sophie2/base/model/text/mvc/SelectionProcessorTest.java

     
    6060                // Just to be sure that the model is updating right. If this passes  
    6161                // and the attributes are not correct, then the processing is surely broken. 
    6262                assertEquals(markAndCaretPos, model.getSelectionInfo().getCaret()); 
    63                 assertEquals(markAndCaretPos, model.getSelectionInfo().getMarkIndex()); 
     63                assertEquals(markAndCaretPos, model.getSelectionInfo().getMark()); 
    6464 
    6565                // No unit except the markAndCaretPos one should have value different from the default,  
    6666                // the specified one should have value markAndCaretPos. 
     
    7878                markAndCaretPos = markAndCaretPos - (getTextLength() / 4) + insertText.getEnd(); 
    7979                // Again, to be sure the model is updated. 
    8080                assertEquals(markAndCaretPos, model.getSelectionInfo().getCaret()); 
    81                 assertEquals(markAndCaretPos, model.getSelectionInfo().getMarkIndex()); 
     81                assertEquals(markAndCaretPos, model.getSelectionInfo().getMark()); 
    8282 
    8383                processedText = model.getProcessedText(); 
    8484                for (int i = 0; i < processedText.getEnd(); ++i) { 
     
    107107                //in another interval different from the current selection interval -- diana 
    108108                caretPos = change.updateIndex(caretPos, modelText);//(caretPos + markPos) / 2 + insertText.getEnd();  
    109109 
    110                 assertEquals(markPos, model.getSelectionInfo().getMarkIndex()); 
     110                assertEquals(markPos, model.getSelectionInfo().getMark()); 
    111111                assertEquals(caretPos, model.getSelectionInfo().getCaret()); 
    112112 
    113113                processedText = model.getProcessedText(); 
     
    160160 
    161161                // All the possible caret-mark positions.. :D 
    162162                for (int caret = 0; caret < modelText.getEnd(); ++caret) { 
    163                         model.setSelectionInfo(caret, model.getSelectionInfo().getMarkIndex()); 
     163                        model.setSelectionInfo(caret, model.getSelectionInfo().getMark()); 
    164164                        for (int mark = 0; mark < modelText.getEnd(); ++mark) { 
    165165                                model.setSelectionInfo(model.getSelectionInfo().getCaret(), mark); 
    166166                                ImmText processedText = model.getProcessedText(); 
  • modules/org.sophie2.base.model.text/src/main/java/org/sophie2/base/model/text/mvc/BaseTextModel.java

     
    220220                CaretOptions caretOpts; 
    221221                SelectionInfo caretInfo = getSelectionInfo(); 
    222222 
    223                 if (caretInfo.getCaret() != -1 && caretInfo.getMarkIndex() != -1) { 
     223                if (caretInfo.getCaret() != -1 && caretInfo.getMark() != -1) { 
    224224                        ImmTextInterval interval =  
    225                                 new ImmTextInterval(caretInfo.getCaret(), caretInfo.getMarkIndex()); 
     225                                new ImmTextInterval(caretInfo.getCaret(), caretInfo.getMark()); 
    226226 
    227227                        selectionOpts = new SelectionOptions( 
    228228                                        CommonAttr.BACKGROUND_COLOR, selectionColor, interval); 
     
    257257 
    258258                ImmText rawText = getRawText();  
    259259                int caretIndex = info.getCaret() == - 1 ? 0 : info.getCaret(); 
    260                 int markIndex = info.getMarkIndex() == - 1 ? 0 : info.getMarkIndex(); 
     260                int markIndex = info.getMark() == - 1 ? 0 : info.getMark(); 
    261261                ImmTextInterval selectionInterval = new ImmTextInterval(caretIndex, 
    262262                                markIndex); 
    263263                ImmTextInterval damagedInterval = change.getSourceDamage(rawText); 
     
    266266                                selectionInterval.compareTo(damagedInterval) == 0) { 
    267267                        int newCaretIndex = Math.max( 
    268268                                        change.updateIndex(info.getCaret(), rawText), 
    269                                         change.updateIndex(info.getMarkIndex(), rawText)); 
     269                                        change.updateIndex(info.getMark(), rawText)); 
    270270                        caretInfo().set(new SelectionInfo(newCaretIndex, newCaretIndex));   
    271271                } else { 
    272272                        caretInfo().set(new SelectionInfo( 
    273273                                        change.updateIndex(info.getCaret(), rawText),   
    274                                         change.updateIndex(info.getMarkIndex(), rawText))); 
     274                                        change.updateIndex(info.getMark(), rawText))); 
    275275                } 
    276276                updateSelectionOptions(); 
    277277 
     
    296296                        if (change instanceof TextReplaceChange) { 
    297297                                int newCaretIndex = Math.max( 
    298298                                                change.updateIndex(info.getCaret(), rawText), 
    299                                                 change.updateIndex(info.getMarkIndex(), rawText)); 
     299                                                change.updateIndex(info.getMark(), rawText)); 
    300300                                caretInfo().set(new SelectionInfo(newCaretIndex, newCaretIndex));   
    301301                                updateSelectionOptions(); 
    302302                        } 
     
    318318                int textEnd = getRawText().getEnd(); 
    319319 
    320320                if (caretInfo.getCaret() > textEnd) { 
    321                         caretInfo = new SelectionInfo(textEnd, caretInfo.getMarkIndex()); 
     321                        caretInfo = new SelectionInfo(textEnd, caretInfo.getMark()); 
    322322                } 
    323323 
    324                 if (caretInfo.getMarkIndex() > textEnd) { 
     324                if (caretInfo.getMark() > textEnd) { 
    325325                        caretInfo = new SelectionInfo(caretInfo.getCaret(), textEnd); 
    326326                } 
    327327 
     
    339339        public ImmTextInterval getSelectionInterval() { 
    340340                SelectionInfo caretInfo = getSelectionInfo(); 
    341341 
    342                 Integer mark = caretInfo.getMarkIndex(); 
     342                Integer mark = caretInfo.getMark(); 
    343343                Integer caret = caretInfo.getCaret(); 
    344344 
    345                 if (mark == null || caret == null) { 
     345                if (mark == - 1 || caret == - 1) { 
    346346                        return null; 
    347347                } 
    348348 
    349                 ImmTextInterval interval = null; 
    350                 if (mark > caret) { 
    351                         interval = new ImmTextInterval(caret, mark); 
    352                 } else { 
    353                         interval = new ImmTextInterval(mark, caret); 
    354                 } 
    355  
    356                 return interval; 
     349                return new ImmTextInterval(caret, mark); 
    357350        } 
    358351 
    359352        public RwProp<Float> wantedX() { 
  • modules/org.sophie2.base.model.text/src/main/java/org/sophie2/base/model/text/mvc/SelectionInfo.java

     
    5050         * @return 
    5151         *                      The mark index. 
    5252         */ 
    53         public int getMarkIndex() { 
     53        public int getMark() { 
    5454                return this.markIndex; 
    5555        } 
    5656 
  • modules/org.sophie2.dev/src/test/java/org/sophie2/dev/author/UndoRedoTextTest.java

     
    188188 
    189189                this.selectedFrameView.textView().get().getTextModel().setSelectionInfo( 
    190190                                13, this.selectedFrameView.textView().get( 
    191                                                 ).getTextModel().getSelectionInfo().getMarkIndex()); 
     191                                                ).getTextModel().getSelectionInfo().getMark()); 
    192192                 
    193193                for (int i = 0; i < 7; ++ i) { 
    194194                        LogicR3.fire(new EventR3(view, 
     
    230230                                SelectionInfo selectionInfo =  
    231231                                        this.selectedFrameView.textView().get().getTextModel().getSelectionInfo(); 
    232232                                int caret = selectionInfo.getCaret(); 
    233                                 int mark = selectionInfo.getMarkIndex(); 
     233                                int mark = selectionInfo.getMark(); 
    234234                                TextChange change = new TextReplaceChange(new ImmTextInterval(caret, mark),  
    235235                                                new ImmHotText("" + st2.charAt(i), null)); 
    236236                                LogicR3.fire(new EventR3(view, 
  • modules/org.sophie2.extra.func.annotations/src/main/java/org/sophie2/extra/func/annotations/view/StickySceneView.java

     
    5757                                int end = res.getRawText().getEnd(); 
    5858                                SelectionInfo caretInfo = res.getSelectionInfo(); 
    5959                                if (caretInfo.getCaret() == -1) { 
    60                                         res.setSelectionInfo(end, caretInfo.getMarkIndex()); 
     60                                        res.setSelectionInfo(end, caretInfo.getMark()); 
    6161                                } 
    62                                 if (caretInfo.getMarkIndex() == -1) { 
     62                                if (caretInfo.getMark() == -1) { 
    6363                                        res.setSelectionInfo(caretInfo.getCaret(), end); 
    6464                                } 
    6565                        } 
  • modules/org.sophie2.main.func.text/src/main/java/org/sophie2/main/func/text/links/TextLinksHaloButton.java

     
    5151                } 
    5252                SelectionInfo caretInfo = flow.getSelectionInfo(); 
    5353                return (caretInfo.getCaret() != -1  
    54                                 && caretInfo.getCaret() != caretInfo.getMarkIndex()); 
     54                                && caretInfo.getCaret() != caretInfo.getMark()); 
    5555        } 
    5656 
    5757        @Override 
  • modules/org.sophie2.main.func.text/src/main/java/org/sophie2/main/func/text/view/TextFrameLogic.java

     
    7676                                        && pos != text.getEnd()) { 
    7777                                pos = text.getBegin(); 
    7878                        } 
    79                          
     79 
    8080                        TextUnit hitUnit = text.unitAt(pos); 
    81                          
     81 
    8282                        if (hitUnit != null) { 
    8383 
    8484                                String hovered = hitUnit.getStyle().getValue(CommonAttr.LINK_ATTRIBUTE); 
    85                                  
    86                                 if (CommonAttr.LINK_ATTRIBUTE.getDefaultValue().equals(hovered)) { 
    87                                         return false; 
     85 
     86                                if (! CommonAttr.LINK_ATTRIBUTE.getDefaultValue().equals(hovered)) { 
     87                                        fireLinkTriggeredEvent(pos, event, MouseLinkTriggers.MOUSE_ENTER); 
    8888                                } 
    8989 
    9090                                for (String linkId : headView.hoveredLinks().get()) { 
    9191                                        if (!hovered.equals(linkId)) { 
     92                                                ImmTextInterval linkInterval =  
     93                                                        TextLinkUtil.getFirstInterval(headView.textFlow().get().getRawText(), linkId); 
     94                                                if (linkInterval != null) { 
     95                                                        fireLinkTriggeredEvent(linkInterval.getBegin(), event, MouseLinkTriggers.MOUSE_LEAVE); 
     96                                                } 
    9297 
    93                                                 fireLinkTriggeredEvent(pos, event, MouseLinkTriggers.MOUSE_LEAVE); 
    94                                         } else { 
    95  
    96                                                 fireLinkTriggeredEvent(pos, event, MouseLinkTriggers.MOUSE_ENTER); 
    97                                         } 
     98                                        }  
    9899                                } 
    99100 
    100101                                headView.hoveredLinks().get().clear(); 
    101                                 headView.hoveredLinks().add(hovered); 
     102                                if (! CommonAttr.LINK_ATTRIBUTE.getDefaultValue().equals(hovered)) { 
     103                                        headView.hoveredLinks().add(hovered); 
     104                                } 
    102105                        } else { 
    103106                                headView.hoveredLinks().get().clear(); 
    104107                        } 
     
    198201                        ImmText text = headView.textFlow().get().getRawText(); 
    199202 
    200203                        assert ImmTextUtils.isIndexInText(pos, text) 
    201                                 || pos == text.getEnd(); 
     204                        || pos == text.getEnd(); 
    202205 
    203206                        TextUnit hitUnit = text.unitAt(pos); 
    204                          
     207 
    205208                        if (hitUnit != null) { 
    206209 
    207210                                String hovered = hitUnit.getStyle().getValue(CommonAttr.LINK_ATTRIBUTE); 
    208                                  
     211 
    209212                                if (!CommonAttr.LINK_ATTRIBUTE.getDefaultValue().equals(hovered)) { 
    210                                          
     213 
    211214                                        fireLinkTriggeredEvent(pos, event, MouseLinkTriggers.MOUSE_PRESSED); 
    212215                                        headView.pressedLinks().add(hovered); 
    213216                                } 
     
    284287         * Used for skinning. 
    285288         */ 
    286289        public static final String SET_LINK_ATTACHMENT_MAP = "Set Link Attachment Map"; 
    287          
     290 
    288291        /** 
    289292         * Constant created for visiting link. 
    290293         * Constant created to be a parameter of a message of an {@link AutoAction}.  
     
    308311                || pos == text.getEnd(): "pos: " + pos + " text: " + text; 
    309312 
    310313                TextUnit hitUnit = text.unitAt(pos); 
    311                  
     314 
    312315                if (hitUnit == null) { 
    313316                        SophieLog.info("Action outside the text!"); 
    314317                        return; 
    315318                } 
    316                  
     319 
    317320                String hovered = hitUnit.getStyle().getValue(CommonAttr.LINK_ATTRIBUTE); 
    318321 
    319322                if (CommonAttr.LINK_ATTRIBUTE.getDefaultValue().equals(hovered)) { 
    320323                        SophieLog.debug("Action outside a link!"); 
    321324                        return; 
    322325                } 
    323                  
     326 
    324327                ImmTextInterval interval = TextLinkUtil.getLinkInterval(text, pos); 
    325                  
     328 
    326329                LinkAttachment attachment = linksMap.get(hovered); 
    327                  
     330 
    328331                if (attachment == null) { 
    329332                        SophieLog.warn("Invalid link ID!"); 
    330333                        return; 
    331334                } 
    332                  
    333                  
    334335 
     336 
     337 
    335338                HotTextResourceH textRes = headView.model().get().getTextModel(); 
    336339                ResourceAccess access = textRes.getAccess();  
    337340 
  • modules/org.sophie2.extra.comment/src/main/java/org/sophie2/extra/comment/view/CommentTextView.java

     
    172172                                int end = res.getRawText().getEnd(); 
    173173                                SelectionInfo caretInfo = res.getSelectionInfo(); 
    174174                                if (caretInfo.getCaret() == -1) { 
    175                                         res.setSelectionInfo(end, caretInfo.getMarkIndex()); 
     175                                        res.setSelectionInfo(end, caretInfo.getMark()); 
    176176                                } 
    177                                 if (caretInfo.getMarkIndex() == -1) { 
     177                                if (caretInfo.getMark() == -1) { 
    178178                                        res.setSelectionInfo(caretInfo.getCaret(), end); 
    179179                                } 
    180180                        } 
  • modules/org.sophie2.main.app.commons/src/main/java/org/sophie2/main/app/commons/element/ElementView.java

     
    532532                public List<LinkTrigger> getTriggers() { 
    533533                        return getLinkTriggers(); 
    534534                } 
     535 
     536                public int getSync() { 
     537                        return 0; 
     538                } 
    535539        } 
    536540         
    537541        /** 
  • modules/org.sophie2.base.model.text/src/test/java/org/sophie2/base/model/text/TextSelectionTest.java

     
    6969                                TextSelectionTest.this.cPos =  
    7070                                        TextSelectionTest.this.textFlow.getSelectionInfo().getCaret(); 
    7171                                TextSelectionTest.this.mPos =  
    72                                         TextSelectionTest.this.textFlow.getSelectionInfo().getMarkIndex(); 
     72                                        TextSelectionTest.this.textFlow.getSelectionInfo().getMark(); 
    7373                                 
    7474                        } 
    7575                }); 
     
    9191        public void testLeftSelection() { 
    9292                fireSelectEvent(Place.LEFT); 
    9393 
    94                 assertSame(this.mPos, this.textFlow.getSelectionInfo().getMarkIndex()); 
     94                assertSame(this.mPos, this.textFlow.getSelectionInfo().getMark()); 
    9595                assertEquals(ImmTextUtils.advance(this.text,  
    9696                                this.textFlow.getSelectionInfo().getCaret(), 0), 
    97                                 ImmTextUtils.advance(this.text, this.textFlow.getSelectionInfo().getMarkIndex(), - 1)); 
     97                                ImmTextUtils.advance(this.text, this.textFlow.getSelectionInfo().getMark(), - 1)); 
    9898        } 
    9999 
    100100        /** 
     
    104104        public void testRightSelection() { 
    105105                fireSelectEvent(Place.RIGHT); 
    106106 
    107                 assertSame(this.mPos, this.textFlow.getSelectionInfo().getMarkIndex()); 
     107                assertSame(this.mPos, this.textFlow.getSelectionInfo().getMark()); 
    108108                assertSame(ImmTextUtils.advance(this.text, this.cPos, 1),  
    109109                                this.textFlow.getSelectionInfo()); 
    110110        } 
     
    121121                        wordBreak.getNextBreakPos( 
    122122                                        this.text, this.cPos); 
    123123 
    124                 assertSame(this.mPos,   this.textFlow.getSelectionInfo().getMarkIndex()); 
     124                assertSame(this.mPos,   this.textFlow.getSelectionInfo().getMark()); 
    125125                assertSame(positionsCaret,  
    126126                                this.textFlow.getSelectionInfo()); 
    127127        } 
  • modules/org.sophie2.base.model.text/src/main/java/org/sophie2/base/model/text/mvc/TextModelLogic.java

     
    101101                                return false; 
    102102                        }  
    103103                        if (eventID == InputEventR3.MOUSE_DRAGGED) { 
    104                                 model.setSelectionInfo(pos, model.getSelectionInfo().getMarkIndex()); 
     104                                model.setSelectionInfo(pos, model.getSelectionInfo().getMark()); 
    105105                                return false; 
    106106                        } 
    107107                        if (eventID == InputEventR3.MOUSE_CLICKED) { 
     
    127127                                } else if (clickCount % 3 == 0) { 
    128128                                        SelectionInfo caretInfo = model.getSelectionInfo(); 
    129129                                        int caret = caretInfo.getCaret(); 
    130                                         int mark = caretInfo.getMarkIndex(); 
     130                                        int mark = caretInfo.getMark(); 
    131131                                        List<Character> breaks = CommonChar.getEffectiveBreaks(CommonChar.PARA_BREAK); 
    132132 
    133133                                        int first = ((caret <= mark) ?  caret : mark); 
     
    208208                                int areaIndex = point.getAreaIndex(); 
    209209                                if (newPos != - 1) { 
    210210                                        setSelection(source,  
    211                                                         textModel.getSelectionInfo().getMarkIndex(), newPos, false, areaIndex); 
     211                                                        textModel.getSelectionInfo().getMark(), newPos, false, areaIndex); 
    212212                                } 
    213213                        } 
    214214 
     
    260260                        ImmText txtToReplaceWith = new ImmHotText(inputString, styles); 
    261261                        SelectionInfo caretInfo = textModel.getSelectionInfo(); 
    262262                        TextChange change = new TextReplaceChange(new 
    263                                         ImmTextInterval(caretInfo.getCaret(), caretInfo.getMarkIndex()), txtToReplaceWith); 
     263                                        ImmTextInterval(caretInfo.getCaret(), caretInfo.getMark()), txtToReplaceWith); 
    264264 
    265265                        boolean result = fireChangeText(event, change, false, Place.RIGHT); 
    266266                         
     
    406406                         
    407407                        SelectionInfo caretInfo = textModel.getSelectionInfo(); 
    408408                        int caretPos = caretInfo.getCaret(); 
    409                         int markPos = caretInfo.getMarkIndex(); 
     409                        int markPos = caretInfo.getMark(); 
    410410 
    411411                        Map<HotAttr<?>, Object> styleValues = new HashMap<HotAttr<?>, Object>(); 
    412412                        styleValues.put(attr, attrValue); 
     
    460460                                 
    461461                                SelectionInfo selectionInfo = textModel.getSelectionInfo(); 
    462462                                int caret = selectionInfo.getCaret(); 
    463                                 int mark = selectionInfo.getMarkIndex(); 
     463                                int mark = selectionInfo.getMark(); 
    464464                                 
    465465                                int first = (caret <= mark  ? caret : mark); 
    466466                                int second = (caret > mark ? caret : mark); 
     
    502502                        SelectionInfo caretInfo = textModel.getSelectionInfo(); 
    503503                         
    504504                        ImmTextInterval selection =  
    505                                 new ImmTextInterval(caretInfo.getMarkIndex(), caretInfo.getCaret());    
     505                                new ImmTextInterval(caretInfo.getMark(), caretInfo.getCaret());    
    506506 
    507507                        // Handle attributes that can toggle their value between 2 values. 
    508508                        // Consider only boolean attributes for now. 
     
    671671        protected ImmTextInterval getSelectionEnds(TextModel textModel) { 
    672672                SelectionInfo caretInfo = textModel.getSelectionInfo(); 
    673673                int caret = caretInfo.getCaret(); 
    674                 int mark = caretInfo.getMarkIndex(); 
     674                int mark = caretInfo.getMark(); 
    675675 
    676676                if (caret == - 1 || mark == - 1) { 
    677677                        return null; 
  • modules/org.sophie2.main.func.links/src/main/java/org/sophie2/main/func/links/LinksHud.java

     
    470470 
    471471                        @Override 
    472472                        protected void setup(Object res) { 
    473                                 holder().get(); 
     473                                if (holder().get() != null) { 
     474                                        holder().get().getSync(); 
     475                                } 
    474476                                wantedRule().set(null); 
    475477                        } 
    476478                } 
  • modules/org.sophie2.main.func.text/src/main/java/org/sophie2/main/func/text/links/TextLinkHolder.java

     
    1010import org.sophie2.base.model.resources.r4.ResourceRefR4; 
    1111import org.sophie2.base.model.resources.r4.access.ResourceAccess; 
    1212import org.sophie2.base.model.text.elements.CommonAttr; 
     13import org.sophie2.base.model.text.model.ImmText; 
    1314import org.sophie2.base.model.text.model.ImmTextInterval; 
    14 import org.sophie2.base.model.text.model.ImmText; 
    1515import org.sophie2.base.model.text.model.TextUnit; 
    1616import org.sophie2.base.model.text.mvc.TextModel; 
    1717import org.sophie2.base.model.text.style.HotStyleDef; 
    1818import org.sophie2.main.app.commons.links.LinkAttachment; 
    1919import org.sophie2.main.app.commons.links.LinkHolder; 
    2020import org.sophie2.main.func.text.view.HeadTextFrameView; 
    21 import org.sophie2.main.func.text.view.TextLinkUtil; 
    2221 
    2322/** 
    2423 * A {@link LinkHolder} implementation for text link attachments. 
     
    7978                        String linkId = unitStyle.getValue(CommonAttr.LINK_ATTRIBUTE); 
    8079                        if (!CommonAttr.LINK_ATTRIBUTE.getDefaultValue().equals(linkId)) { 
    8180 
    82                                 ImmTextInterval linkInterval =  
    83                                         TextLinkUtil.getLinkInterval(textModel.getRawText(), selectionInterval.getBegin()); 
    84                                 if (linkInterval.equals(selectionInterval)) {  
     81//                              ImmTextInterval linkInterval =  
     82//                                      TextLinkUtil.getLinkInterval(textModel.getRawText(), selectionInterval.getBegin()); 
     83//                              if (linkInterval.equals(selectionInterval)) {  
    8584                                        LinkAttachment la = attachmentMap.get(linkId); 
    8685                                        if (la != null) { 
    8786                                                return la; 
    8887                                        } 
    89                                 } 
     88//                              } 
    9089                        } 
    9190                } 
    9291                 
     
    105104                // TODO Auto-generated method stub 
    106105                return null; 
    107106        } 
     107 
     108 
     109        public int getSync() { 
     110                ImmTextInterval selectedInterval = this.frameView.getHeadView(). 
     111                textFlow().get().getSelectionInterval(); 
     112                return selectedInterval.hashCode(); 
     113        } 
    108114} 
     115 No newline at end of file 
  • modules/org.sophie2.main.func.text/src/main/java/org/sophie2/main/func/text/utils/TextStyleUtils.java

     
    9999                                TextModel flow = contentView.textFlow().get(); 
    100100                                SelectionInfo caretInfo = flow.getSelectionInfo(); 
    101101                                int caretPos = caretInfo.getCaret(); 
    102                 int markPos = caretInfo.getMarkIndex(); 
     102                int markPos = caretInfo.getMark(); 
    103103                ImmText text = flow.getRawText(); 
    104104                if (caretPos == markPos) { 
    105105                        HotStyleDef style = HotStyleDef.getEmpty(); 
  • modules/org.sophie2.main.func.text/src/main/java/org/sophie2/main/func/text/view/HeadSceneTextView.java

     
    4848                                int end = res.getRawText().getEnd(); 
    4949                                SelectionInfo caretInfo = res.getSelectionInfo(); 
    5050                                if (caretInfo.getCaret() == -1) { 
    51                                         res.setSelectionInfo(end, caretInfo.getMarkIndex()); 
     51                                        res.setSelectionInfo(end, caretInfo.getMark()); 
    5252                                } 
    53                                 if (caretInfo.getMarkIndex() == -1) { 
     53                                if (caretInfo.getMark() == -1) { 
    5454                                        res.setSelectionInfo(caretInfo.getCaret(), end); 
    5555                                } 
    5656                        }                                                        
  • modules/org.sophie2.main.func.text/src/main/java/org/sophie2/main/func/text/styling/TextFontHaloMenu.java

     
    4242                                if (contentView != null && contentView.textFlow().get() != null) { 
    4343                                        SelectionInfo caretInfo = contentView.textFlow().get().getSelectionInfo(); 
    4444                                        int caretPos = caretInfo.getCaret(); 
    45                                         int markPos = caretInfo.getMarkIndex(); 
     45                                        int markPos = caretInfo.getMark(); 
    4646                                         
    4747                                        int menuPos = (caretPos - markPos) > 0 ? caretPos : markPos; 
    4848