]> gitweb.factorcode.org Git - factor.git/commitdiff
fix for jEdit 4.3pre3
authorSlava Pestov <slava@factorcode.org>
Mon, 4 Jul 2005 21:35:22 +0000 (21:35 +0000)
committerSlava Pestov <slava@factorcode.org>
Mon, 4 Jul 2005 21:35:22 +0000 (21:35 +0000)
build.xml
factor/jedit/FactorPlugin.java
factor/jedit/FactorSideKickParser.java
factor/jedit/WordPreview.java
library/ui/layouts.factor
library/ui/text.factor

index 5ded1fd65efb8f7dd19c64e2fa3384106f9361bb..eb5fa0fb1ef61e6d66af1a473b99ad7efb93b36e 100644 (file)
--- a/build.xml
+++ b/build.xml
@@ -17,6 +17,8 @@
                        debug="true"
                        optimize="true"
                        classpathref="jedit-classpath"
+                       source="1.4"
+                       target="1.4"
                >
                <include name="**/*.java"/>
                </javac>
index d899c957bc5c6564952e38f44f746caa5472efcb..2aa858eb84d2e5d2a367044853ddf023a4751fd5 100644 (file)
@@ -609,7 +609,7 @@ public class FactorPlugin extends EditPlugin
        public static void extractWord(View view)
        {
                JEditTextArea textArea = view.getTextArea();
-               Buffer buffer = textArea.getBuffer();
+               Buffer buffer = view.getBuffer();
                String selection = textArea.getSelectedText();
                if(selection == null)
                        selection = "";
@@ -670,12 +670,14 @@ public class FactorPlugin extends EditPlugin
        } //}}}
 
        //{{{ getRulesetAtOffset() method
-       public static String getRulesetAtOffset(JEditTextArea textArea, int caret)
+       public static String getRulesetAtOffset(EditPane editPane, int caret)
        {
+               JEditTextArea textArea = editPane.getTextArea();
+
                int line = textArea.getLineOfOffset(caret);
 
                DefaultTokenHandler h = new DefaultTokenHandler();
-               textArea.getBuffer().markTokens(line,h);
+               editPane.getBuffer().markTokens(line,h);
                Token tokens = h.getTokens();
 
                int offset = caret - textArea.getLineStartOffset(line);
index 39b7cd1c328585b5864fadad0038b974b5562cdb..2163fe6d338816b5359cde3b6e0adf9e8737b546 100644 (file)
@@ -64,8 +64,7 @@ public class FactorSideKickParser extends SideKickParser
        public void activate(EditPane editPane)
        {
                super.activate(editPane);
-               WordPreview preview = new WordPreview(this,
-                       editPane.getTextArea());
+               WordPreview preview = new WordPreview(this,editPane);
                previewMap.put(editPane,preview);
                editPane.getTextArea().addCaretListener(preview);
        } //}}}
@@ -271,8 +270,7 @@ public class FactorSideKickParser extends SideKickParser
                if(data == null)
                        return null;
 
-               String ruleset = FactorPlugin.getRulesetAtOffset(
-                       editPane.getTextArea(),caret);
+               String ruleset = FactorPlugin.getRulesetAtOffset(editPane,caret);
 
                if(ruleset == null)
                        return null;
index 8cc25b8b1c39ee34da4a1d08d74414f65619124d..86a24ebbb111ef59898dea70daf5989f6365e018 100644 (file)
@@ -45,7 +45,7 @@ public class WordPreview implements ActionListener, CaretListener
 {
        private FactorSideKickParser parser;
        private Timer timer;
-       private JEditTextArea textArea;
+       private EditPane editPane;
 
        private static String[] IGNORED_RULESETS = {
                "factor::LITERAL",
@@ -54,11 +54,10 @@ public class WordPreview implements ActionListener, CaretListener
        };
 
        //{{{ WordPreview constructor
-       public WordPreview(FactorSideKickParser parser,
-               JEditTextArea textArea)
+       public WordPreview(FactorSideKickParser parser, EditPane editPane)
        {
                this.parser = parser;
-               this.textArea = textArea;
+               this.editPane = editPane;
                this.timer = new Timer(0,this);
                timer.setRepeats(false);
        } //}}}
@@ -91,7 +90,9 @@ public class WordPreview implements ActionListener, CaretListener
        private FactorWord getWordAtCaret(FactorParsedData fdata)
                throws IOException
        {
-               String name = FactorPlugin.getRulesetAtOffset(textArea,
+               JEditTextArea textArea = editPane.getTextArea();
+               
+               String name = FactorPlugin.getRulesetAtOffset(editPane,
                        textArea.getCaretPosition());
                if(name == null)
                        return null;
@@ -114,7 +115,7 @@ public class WordPreview implements ActionListener, CaretListener
        private void showPreview()
                throws IOException
        {
-               View view = textArea.getView();
+               View view = editPane.getView();
 
                if(SideKickPlugin.isParsingBuffer(view.getBuffer()))
                        return;
index 03efd8016db67d31c1bfc813e27e1b02fe015ac6..34497a6fc8e4d94522499a3428d49d3f2e71dc12 100644 (file)
@@ -30,7 +30,7 @@ GENERIC: orientation
     zip >r orientation r> [ uncons rot set-axis ] map-with ;
 
 : packed-dim-2 ( gadget sizes -- list )
-    [ over shape-dim over v- rot filling v*n v+ ] map-with ;
+    [ over shape-dim { 1 1 1 } vmax over v- rot filling v*n v+ ] map-with ;
 
 : (packed-dims) ( gadget sizes -- list )
     2dup packed-dim-2 swap orient ;
@@ -43,8 +43,8 @@ GENERIC: orientation
     { 0 0 0 } [ v+ ] accumulate ;
 
 : packed-loc-2 ( gadget sizes -- list )
-    >r dup shape-dim over r> packed-dim-2 [ v- ] map-with
-    >r dup alignment swap shape-dim r>
+    >r dup shape-dim { 1 1 1 } vmax over r> packed-dim-2 [ v- ] map-with
+    >r dup alignment swap shape-dim { 1 1 1 } vmax r>
     [ >r 2dup r> v- n*v ] map 2nip ;
 
 : (packed-locs) ( gadget sizes -- list )
index c00eea7bcfee7cacb69ef92fd6fd2ddd6a52659d..8ac8674da90b659391767b0d52dccadc6721ffb4 100644 (file)
@@ -17,9 +17,7 @@ strings styles io ;
     ] when drop ;
 
 : filter-nulls ( str -- str )
-    0 over contains? [
-        [ dup 0 = [ drop CHAR: \s ] when ] map
-    ] when ;
+    [ dup 0 = [ drop CHAR: \s ] when ] map ;
 
 : size-string ( font text -- w h )
     filter-nulls dup empty? [