]> matita.cs.unibo.it Git - helm.git/commitdiff
added support for X11 clipboard pasting with CTRL-V shortcut
authorStefano Zacchiroli <zack@upsilon.cc>
Thu, 4 Sep 2003 16:42:13 +0000 (16:42 +0000)
committerStefano Zacchiroli <zack@upsilon.cc>
Thu, 4 Sep 2003 16:42:13 +0000 (16:42 +0000)
helm/gTopLevel/texTermEditor.ml

index 3cf09934972746fd9de3692b2b188449a71f0f26..0479388286f8698b93080b883017cb972647b516 100644 (file)
@@ -124,7 +124,9 @@ module Make(C:Disambiguate.Callbacks) =
           end
          else if key = GdkKeysyms._BackSpace then
           Mathml_editor.drop tex_editor
-           (List.mem `CONTROL (GdkEvent.Key.state e)) ;
+           (List.mem `CONTROL (GdkEvent.Key.state e))
+         else if key = GdkKeysyms._v then
+           ignore (mmlwidget#misc#convert_selection "STRING" `PRIMARY);
          let adj = mmlwidget#get_hadjustment in
           mmlwidget#thaw ;
           adj#set_value adj#upper ;
@@ -156,6 +158,19 @@ module Make(C:Disambiguate.Callbacks) =
            ~useCapture:false
     in
      object(self)
+
+      initializer
+        ignore (mmlwidget#misc#connect#selection_received
+          ~callback: (fun selection_data ~time ->
+            let input = try selection_data#data with Gpointer.Null -> "" in
+            mmlwidget#freeze ;
+            ignore (Mathml_editor.freeze tex_editor) ;
+            for i = 0 to String.length input - 1 do
+             Mathml_editor.push tex_editor input.[i]
+            done;
+            ignore (Mathml_editor.thaw tex_editor) ;
+            mmlwidget#thaw))
+
       method coerce = mmlwidget#coerce
       method reset =
        mmlwidget#freeze ;