@@ -0,0 +1,2484 @@
+package flow.netbeans.markdown.typinghooks;%0A%0Aimport flow.netbeans.markdown.csl.MarkdownLanguageConfig;%0Aimport flow.netbeans.markdown.highlighter.MarkdownTokenId;%0Aimport flow.netbeans.markdown.utils.MarkdownDocUtil;%0Aimport javax.swing.text.BadLocationException;%0Aimport javax.swing.text.Document;%0Aimport org.netbeans.api.editor.mimelookup.MimePath;%0Aimport org.netbeans.api.editor.mimelookup.MimeRegistration;%0Aimport org.netbeans.api.lexer.Token;%0Aimport org.netbeans.api.lexer.TokenSequence;%0Aimport org.netbeans.spi.editor.typinghooks.DeletedTextInterceptor;%0A%0A/**%0A *%0A * @author junichi11%0A */%0Apublic class MarkdownDeletedTextInterceptor implements DeletedTextInterceptor %7B%0A%0A    @Override%0A    public boolean beforeRemove(Context context) throws BadLocationException %7B%0A        char ch = context.getText().charAt(0);%0A        if (ch != '.' && ch != ' ') %7B // NOI18N%0A            return false;%0A        %7D%0A        Document document = context.getDocument();%0A        int caretOffset = context.getOffset();%0A        TokenSequence%3CMarkdownTokenId%3E ts = MarkdownDocUtil.getTokenSequence(document);%0A        ts.move(caretOffset);%0A        if (ch == ' ') %7B // NOI18N%0A            ts.movePrevious();%0A            Token%3CMarkdownTokenId%3E token = ts.token();%0A            if (caretOffset != ts.offset() + token.length()) %7B%0A                return false;%0A            %7D%0A        %7D else %7B%0A            ts.moveNext();%0A        %7D%0A%0A        Token%3CMarkdownTokenId%3E token = ts.token();%0A        if (token == null %7C%7C token.id() != MarkdownTokenId.ORDEREDLIST) %7B%0A            return false;%0A        %7D%0A%0A        int removeLength = token.text().length() + 1;%0A        int removeOffset = ts.offset() - 1;%0A%0A        OrderedListReorderer reorderer = new OrderedListReorderer(context.getComponent(), document, caretOffset);%0A        reorderer.reorder(false, removeOffset, removeLength);%0A        return true;%0A    %7D%0A%0A    @Override%0A    public void remove(Context context) throws BadLocationException %7B%0A    %7D%0A%0A    @Override%0A    public void afterRemove(Context context) throws BadLocationException %7B%0A    %7D%0A%0A    @Override%0A    public void cancelled(Context context) %7B%0A    %7D%0A%0A    @MimeRegistration(mimeType = MarkdownLanguageConfig.MIME_TYPE, service = DeletedTextInterceptor.Factory.class)%0A    public static class Factory implements DeletedTextInterceptor.Factory %7B%0A%0A        @Override%0A        public DeletedTextInterceptor createDeletedTextInterceptor(MimePath mimePath) %7B%0A            return new MarkdownDeletedTextInterceptor();%0A        %7D%0A    %7D%0A%7D%0A

Add MarkdownDeletedTextInterceptor