aboutsummaryrefslogtreecommitdiff
path: root/ide/wg_MessageView.ml
diff options
context:
space:
mode:
Diffstat (limited to 'ide/wg_MessageView.ml')
-rw-r--r--ide/wg_MessageView.ml22
1 files changed, 14 insertions, 8 deletions
diff --git a/ide/wg_MessageView.ml b/ide/wg_MessageView.ml
index 65df2b8494..a79a093e32 100644
--- a/ide/wg_MessageView.ml
+++ b/ide/wg_MessageView.ml
@@ -1,9 +1,11 @@
(************************************************************************)
-(* v * The Coq Proof Assistant / The Coq Development Team *)
-(* <O___,, * INRIA - CNRS - LIX - LRI - PPS - Copyright 1999-2017 *)
+(* * The Coq Proof Assistant / The Coq Development Team *)
+(* v * INRIA, CNRS and contributors - Copyright 1999-2018 *)
+(* <O___,, * (see CREDITS file for the list of authors) *)
(* \VV/ **************************************************************)
-(* // * This file is distributed under the terms of the *)
-(* * GNU Lesser General Public License Version 2.1 *)
+(* // * This file is distributed under the terms of the *)
+(* * GNU Lesser General Public License Version 2.1 *)
+(* * (see LICENSE file for the text of the license) *)
(************************************************************************)
open Preferences
@@ -34,8 +36,8 @@ class type message_view =
method refresh : bool -> unit
method push : Ideutils.logger
(** same as [add], but with an explicit level instead of [Notice] *)
- method buffer : GText.buffer
- (** for more advanced text edition *)
+ method has_selection : bool
+ method get_selected_text : string
end
let message_view () : message_view =
@@ -43,7 +45,6 @@ let message_view () : message_view =
~highlight_matching_brackets:true
~tag_table:Tags.Message.table ()
in
- let text_buffer = new GText.buffer buffer#as_buffer in
let mark = buffer#create_mark ~left_gravity:false buffer#start_iter in
let box = GPack.vbox () in
let scroll = GBin.scrolled_window
@@ -118,7 +119,12 @@ let message_view () : message_view =
method set msg = self#clear; self#add msg
- method buffer = text_buffer
+ method has_selection = buffer#has_selection
+ method get_selected_text =
+ if buffer#has_selection then
+ let start, stop = buffer#selection_bounds in
+ buffer#get_text ~slice:true ~start ~stop ()
+ else ""
end
in