indexing
	description: "A control in which the user can enter and edit rich text."
	note: "Rich edit DLL needs to be loaded. See class WEL_RICH_EDIT_DLL. All paragraph measurements are in twips. A twip is 1/1440 of an inch or 1/20 of a point."
	status: "See notice at end of class."
	date: "$Date$"
	revision: "$Revision$"

class interface
	WEL_RICH_EDIT

create 

	make (a_parent: WEL_WINDOW; a_name: STRING; a_x, a_y, a_width, a_height, an_id: INTEGER)
			-- Make a rich edit control.
		require
			a_parent_not_void: a_parent /= void
			a_parent_exists: a_parent.exists
			a_name_not_void: a_name /= void
		ensure
			parent_set: parent = a_parent
			exists: exists
			name_set: text.is_equal (a_name)
			id_set: id = an_id

	make_by_id (a_parent: WEL_DIALOG; an_id: INTEGER)
			-- Make a control identified by an_id with a_parent
			-- as parent.
			-- (from WEL_CONTROL)
		require -- from WEL_CONTROL
			a_parent_not_void: a_parent /= void
			positive_id: an_id > 0
		ensure -- from WEL_CONTROL
			parent_set: parent = a_parent
			id_set: id = an_id

feature -- Access

	background_color: WEL_COLOR_REF
			-- Background color used for the background of the
			-- control
			-- Can be redefined by the user
			-- (from WEL_EDIT)
		require -- from WEL_COLOR_CONTROL
			exists: exists
		ensure -- from WEL_COLOR_CONTROL
			color_not_void: background_color /= void

	Color_activeborder: INTEGER is 10
			-- (from WEL_COLOR_CONSTANTS)

	Color_activecaption: INTEGER is 2
			-- (from WEL_COLOR_CONSTANTS)

	Color_appworkspace: INTEGER is 12
			-- (from WEL_COLOR_CONSTANTS)

	Color_background: INTEGER is 1
			-- (from WEL_COLOR_CONSTANTS)

	Color_btnface: INTEGER is 15
			-- (from WEL_COLOR_CONSTANTS)

	Color_btnhighlight: INTEGER is 20
			-- (from WEL_COLOR_CONSTANTS)

	Color_btnshadow: INTEGER is 16
			-- (from WEL_COLOR_CONSTANTS)

	Color_btntext: INTEGER is 18
			-- (from WEL_COLOR_CONSTANTS)

	Color_captiontext: INTEGER is 9
			-- (from WEL_COLOR_CONSTANTS)

	Color_graytext: INTEGER is 17
			-- (from WEL_COLOR_CONSTANTS)

	Color_highlight: INTEGER is 13
			-- (from WEL_COLOR_CONSTANTS)

	Color_highlighttext: INTEGER is 14
			-- (from WEL_COLOR_CONSTANTS)

	Color_inactiveborder: INTEGER is 11
			-- (from WEL_COLOR_CONSTANTS)

	Color_inactivecaption: INTEGER is 3
			-- (from WEL_COLOR_CONSTANTS)

	Color_inactivecaptiontext: INTEGER is 19
			-- (from WEL_COLOR_CONSTANTS)

	Color_menu: INTEGER is 4
			-- (from WEL_COLOR_CONSTANTS)

	Color_menutext: INTEGER is 7
			-- (from WEL_COLOR_CONSTANTS)

	Color_scrollbar: INTEGER is 0
			-- (from WEL_COLOR_CONSTANTS)

	Color_window: INTEGER is 5
			-- (from WEL_COLOR_CONSTANTS)

	Color_windowframe: INTEGER is 6
			-- (from WEL_COLOR_CONSTANTS)

	Color_windowtext: INTEGER is 8
			-- (from WEL_COLOR_CONSTANTS)

	commands: WEL_COMMAND_MANAGER
			-- Command manager associated to the current window.
			-- (from WEL_WINDOW)

	default_processing: BOOLEAN
			-- (from WEL_RETURN_VALUE)

	font: WEL_FONT
			-- Font with which the control is drawing its text.
			-- (from WEL_CONTROL)
		require -- from WEL_CONTROL
			exists: exists
		ensure -- from WEL_CONTROL
			result_not_void: Result /= void

	foreground_color: WEL_COLOR_REF
			-- foreground color used for the text of the
			-- control
			-- Can be redefined by the user
			-- (from WEL_STATIC)
		require -- from WEL_COLOR_CONTROL
			exists: exists
		ensure -- from WEL_COLOR_CONTROL
			color_not_void: foreground_color /= void

	has_return_value: BOOLEAN
			-- Should the window procedure return a value?
			-- (from WEL_RETURN_VALUE)

	id: INTEGER
			-- Control id
			-- (from WEL_CONTROL)

	item: POINTER
			-- Generic Windows handle or structure pointer.
			-- Can be a HWND, HICON, RECT *, WNDCLASS *, etc...
			-- (from WEL_ANY)

	message_return_value: INTEGER
			-- Return value of the window procedure.
			-- (from WEL_RETURN_VALUE)
		require -- from WEL_RETURN_VALUE
			has_return_value: has_return_value

	parent: WEL_WINDOW
			-- Parent window
			-- (from WEL_WINDOW)
	
feature -- Status report

	absolute_x: INTEGER
			-- Absolute x position
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists
		ensure -- from WEL_WINDOW
			Result = window_rect.x

	absolute_y: INTEGER
			-- Absolute y position
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists
		ensure -- from WEL_WINDOW
			Result = window_rect.y

	background_brush: WEL_BRUSH
			-- Current window background color used to refresh the window when
			-- requested by the WM_ERASEBKGND windows message.
			-- By default there is no background
			-- (from WEL_WINDOW)
		ensure -- from WEL_WINDOW
			new_object: Result /= void implies Result /= background_brush

	can_undo: BOOLEAN
			-- Can the last operation be undone?
			-- (from WEL_EDIT)
		require -- from WEL_EDIT
			exists: exists

	captured_window: WEL_WINDOW
			-- Current window which has been captured.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists
			window_captured: window_captured

	caret_position: INTEGER
		require -- from WEL_EDIT
			exists: exists

	character_index_from_position (a_x, a_y: INTEGER): INTEGER
			-- Zero-based character index of the character which is
			-- the nearest to a_x and a_y position in the client
			-- area.
			-- A returned coordinate can be negative if the
			-- character has been scrolled outside the edit
			-- control's client area. The coordinates are truncated
			-- to integer values and are in screen units relative
			-- to the upper-left corner of the client area of the
			-- control.
		require
			exists: exists
			a_x_large_enough: a_x >= 0
			a_y_large_enough: a_y >= 0

	client_rect: WEL_RECT
			-- Client rectangle
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists
		ensure -- from WEL_WINDOW
			result_not_void: Result /= void

	command (message: INTEGER): WEL_COMMAND
			-- Command associated to message
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			positive_message: message >= 0
			command_exists: command_exists (message)
		ensure -- from WEL_WINDOW
			result_not_void: Result /= void

	command_argument (message: INTEGER): ANY
			-- Command argument associated to message
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			positive_message: message >= 0
			command_exists: command_exists (message)

	command_exists (message: INTEGER): BOOLEAN
			-- Does a command associated to message exist?
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			positive_message: message >= 0

	commands_enabled: BOOLEAN
			-- Is the commands execution enabled?
			-- (from WEL_WINDOW)

	count: INTEGER
			-- Length of text.

	current_line_index: INTEGER
			-- Index of the line that contains the caret.
			-- (from WEL_MULTIPLE_LINE_EDIT)
		require -- from WEL_MULTIPLE_LINE_EDIT
			exists: exists
		ensure -- from WEL_MULTIPLE_LINE_EDIT
			positive_result: Result >= 0

	current_line_number: INTEGER
			-- Line number of the line that contains the caret.
			-- (from WEL_MULTIPLE_LINE_EDIT)
		require -- from WEL_MULTIPLE_LINE_EDIT
			exists: exists
		ensure -- from WEL_MULTIPLE_LINE_EDIT
			positive_result: Result >= 0
			result_small_enough: Result < line_count

	current_selection_character_format: WEL_CHARACTER_FORMAT
			-- Current selection character format information
		require
			exists: exists
		ensure
			result_not_void: Result /= void

	default_character_format: WEL_CHARACTER_FORMAT
			-- Default character format information
		require
			exists: exists
		ensure
			result_not_void: Result /= void

	enabled: BOOLEAN
			-- Is the window enabled for mouse and keyboard input?
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	event_mask: INTEGER
			-- Event mask which specifies notification message the
			-- control sends to its parent window.
			-- See class WEL_ENM_CONSTANTS for values.
		require
			exists: exists

	ex_style: INTEGER
			-- Window ex_style
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	exists: BOOLEAN
			-- Does the item exist?
			-- (from WEL_ANY)
		ensure -- from WEL_ANY
			Result = (item /= default_pointer)

	first_visible_line: INTEGER
			-- Upper most visible line
			-- (from WEL_MULTIPLE_LINE_EDIT)
		require -- from WEL_MULTIPLE_LINE_EDIT
			exists: exists
		ensure -- from WEL_MULTIPLE_LINE_EDIT
			positive_result: Result >= 0
			result_small_enough: Result < line_count

	focused_window: WEL_WINDOW
			-- Current window which has the focus.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	formatting_rect: WEL_RECT
			-- Limiting rectangle the text. It is independent of
			-- the size of the edit-control window.
			-- (from WEL_EDIT)
		require -- from WEL_EDIT
			exists: exists
		ensure -- from WEL_EDIT
			result_not_void: Result /= void

	has_capture: BOOLEAN
			-- Does this window have the capture?
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	has_focus: BOOLEAN
			-- Does this window have the focus?
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	has_heavy_capture: BOOLEAN
			-- Does this window have the heavy capture?
			-- (from WEL_WINDOW)

	has_horizontal_scroll_bar: BOOLEAN
			-- Does this window have a horizontal scroll bar?
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	has_selection: BOOLEAN
			-- Has a current selection?
		require -- from WEL_EDIT
			exists: exists

	has_system_font: BOOLEAN
			-- Does the control use the system font?
			-- (from WEL_CONTROL)
		require -- from WEL_CONTROL
			exists: exists

	has_vertical_scroll_bar: BOOLEAN
			-- Does this window have a vertical scroll bar?
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	heavy_capture_activated: BOOLEAN
			-- Is the heavy capture currently running?
			-- (i.e. is there a window in the current program
			-- with has_heavy_capture to True?)
			-- (from WEL_WINDOW)

	height: INTEGER
			-- Window height
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	is_inside: BOOLEAN
			-- Is the current window inside another window?
			-- (from WEL_WINDOW)

	line (i: INTEGER): STRING
			-- ith line
			-- (from WEL_MULTIPLE_LINE_EDIT)
		require -- from WEL_MULTIPLE_LINE_EDIT
			exists: exists
			i_large_enough: i >= 0
			i_small_enough: i < line_count
		ensure -- from WEL_MULTIPLE_LINE_EDIT
			result_exists: Result /= void

	line_count: INTEGER
			-- Number of lines
			-- (from WEL_MULTIPLE_LINE_EDIT)
		require -- from WEL_MULTIPLE_LINE_EDIT
			exists: exists
		ensure -- from WEL_MULTIPLE_LINE_EDIT
			positive_result: Result >= 0

	line_from_char (i: INTEGER): INTEGER
			-- Index of the line that contains the character
			-- index i. A character index is the number of
			-- characters from the beginning of the edit control.
			-- (from WEL_MULTIPLE_LINE_EDIT)
		require -- from WEL_MULTIPLE_LINE_EDIT
			exists: exists
		ensure -- from WEL_MULTIPLE_LINE_EDIT
			positive_result: Result >= 0

	line_index (i: INTEGER): INTEGER
			-- Number of characters from the beginning of the edit
			-- control to the zero-based line i.
			-- Retrieve a character index for a given line number.
			-- (from WEL_MULTIPLE_LINE_EDIT)
		require -- from WEL_MULTIPLE_LINE_EDIT
			exists: exists
			i_large_enough: i >= 0
			i_small_enough: i < line_count
		ensure -- from WEL_MULTIPLE_LINE_EDIT
			positive_result: Result >= 0

	line_length (i: INTEGER): INTEGER
			-- Length of the ith line
			-- (from WEL_MULTIPLE_LINE_EDIT)
		require -- from WEL_MULTIPLE_LINE_EDIT
			exists: exists
			i_large_enough: i >= 0
			i_small_enough: i < line_count
		ensure -- from WEL_MULTIPLE_LINE_EDIT
			positive_result: Result >= 0
			result_ok: Result = line (i).count

	line_number_from_position (a_pos: INTEGER): INTEGER
			-- Retrieves the line number from a character position.
			-- Line numbers start at 0.
		require
			exists: exists
			a_pos_large_enough: a_pos >= 0

	maximal_height: INTEGER
			-- Maximal height allowed for the window
			-- (from WEL_WINDOW)
		ensure -- from WEL_WINDOW
			result_large_enough: Result >= minimal_height

	maximal_width: INTEGER
			-- Maximal width allowed for the window
			-- (from WEL_WINDOW)
		ensure -- from WEL_WINDOW
			result_large_enough: Result >= minimal_width

	maximized: BOOLEAN
			-- Is the window maximized?
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	minimal_height: INTEGER
			-- Minimal height allowed for the window
			-- Zero by default.
			-- (from WEL_WINDOW)
		ensure -- from WEL_WINDOW
			positive_result: Result >= 0
			result_small_enough: Result <= maximal_height

	minimal_width: INTEGER
			-- Minimal width allowed for the window
			-- Zero by default.
			-- (from WEL_WINDOW)
		ensure -- from WEL_WINDOW
			positive_result: Result >= 0
			result_small_enough: Result <= maximal_width

	minimized: BOOLEAN
			-- Is the window minimized?
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	modified: BOOLEAN
			-- Has the text been modified?
			-- (from WEL_EDIT)
		require -- from WEL_EDIT
			exists: exists

	options: INTEGER
			-- Give the current set of options.

	placement: WEL_WINDOW_PLACEMENT
			-- Window placement information
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists
		ensure -- from WEL_WINDOW
			result_not_void: Result /= void

	position_from_character_index (character_index: INTEGER): WEL_POINT
			-- Coordinates of a character at character_index in
			-- the client area.
			-- A returned coordinate can be negative if the
			-- character has been scrolled outside the edit
			-- control's client area.
			-- The coordinates are truncated to integer values and
			-- are in screen units relative to the upper-left
			-- corner of the client area of the control.
		require
			exists: exists
			index_large_enough: character_index >= 0
			index_small_enough: character_index <= text_length + 2
		ensure
			result_not_void: Result /= void

	read_only: BOOLEAN
			-- Is the current edit control read-only?
			-- (from WEL_EDIT)
		require -- from WEL_EDIT
			exists: exists

	scroll_caret_at_selection: BOOLEAN
			-- Will the caret be scrolled at the selection after
			-- a call to set_selection?
			-- (from WEL_MULTIPLE_LINE_EDIT)

	selected_text: STRING
			-- Currently selected text
		require
			exists: exists
			has_selection: has_selection

	selection: WEL_CHARACTER_RANGE
			-- Structure which contains the starting and ending
			-- character positions of the selection.
		require
			exists: exists

	selection_end: INTEGER
			-- Index of the last character selected
		require -- from WEL_EDIT
			exists: exists
			has_selection: has_selection
		ensure -- from WEL_EDIT
			result_large_enough: Result >= 0
			result_small_enough: Result <= text_length + 2

	selection_start: INTEGER
			-- Index of the first character selected
		require -- from WEL_EDIT
			exists: exists
			has_selection: has_selection
		ensure -- from WEL_EDIT
			result_large_enough: Result >= 0
			result_small_enough: Result <= text_length

	shared: BOOLEAN
			-- Is item shared by another object?
			-- If False (by default), item will
			-- be destroyed by destroy_item.
			-- If True, item will not be destroyed.
			-- (from WEL_ANY)

	shown: BOOLEAN
			-- Is the window shown?
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	style: INTEGER
			-- Window style
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	text: STRING
			-- Contents of the rich edit control
		require -- from WEL_WINDOW
			exists: exists
		ensure -- from WEL_WINDOW
			result_not_void: Result /= void

	text_at (i: INTEGER; n: INTEGER): STRING
			-- Text of length n at position i.
		require
			exists: exists
			valid_length: n > 0
			valid_index: text.valid_index (i + 1)
			valid_length: text.valid_index (i + n)

	text_length: INTEGER
			-- Text length
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists
		ensure -- from WEL_WINDOW
			positive_result: Result >= 0

	valid_color_constant (c: INTEGER): BOOLEAN
			-- Is c a valid color constant?
			-- (from WEL_COLOR_CONSTANTS)

	width: INTEGER
			-- Window width
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	window_captured: BOOLEAN
			-- Has a window been captured?
			-- (from WEL_WINDOW)

	window_rect: WEL_RECT
			-- Window rectangle (absolute position)
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists
		ensure -- from WEL_WINDOW
			result_not_void: Result /= void

	x: INTEGER
			-- Window x position
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists
		ensure -- from WEL_WINDOW
			parent = void implies Result = absolute_x

	y: INTEGER
			-- Window y position
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists
		ensure -- from WEL_WINDOW
			parent = void implies Result = absolute_y
	
feature  -- Status report

	valid_hwnd_constant (c: POINTER): BOOLEAN
			-- Is c a valid hwnd constant?
			-- (from WEL_HWND_CONSTANTS)
	
feature -- Status setting

	disable
			-- Disable mouse and keyboard input
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists
		ensure -- from WEL_WINDOW
			disabled: not enabled

	disable_commands
			-- Disable commands execution.
			-- (from WEL_WINDOW)
		ensure -- from WEL_WINDOW
			commands_disabled: not commands_enabled

	disable_default_processing
			-- Disable default window processing.
			-- The standard window procedure will not be called for
			-- each messages received by the window and then the
			-- normal behavior will not occur.
			-- (from WEL_WINDOW)
		ensure -- from WEL_WINDOW
			default_processing_disabled: not default_processing

	disable_notifications
			-- Disable all notifications.
		require
			exists: exists
		ensure
			no_notification: event_mask = enm_none

	disable_scroll_caret_at_selection
			-- Set scroll_caret_at_selection to False.
			-- The caret will not be scrolled at the selection
			-- after a call to set_selection.
			-- (from WEL_MULTIPLE_LINE_EDIT)
		require -- from WEL_MULTIPLE_LINE_EDIT
			exists: exists
		ensure -- from WEL_MULTIPLE_LINE_EDIT
			scroll_caret_at_selection_disabled: not scroll_caret_at_selection

	enable
			-- Enable mouse and keyboard input.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists
		ensure -- from WEL_WINDOW
			enabled: enabled

	enable_all_notifications
			-- Enable all notifications.
		require
			exists: exists

	enable_commands
			-- Enable commands execution.
			-- (from WEL_WINDOW)
		ensure -- from WEL_WINDOW
			commands_enabled: commands_enabled

	enable_default_processing
			-- Enable default window processing.
			-- The standard window procedure will be called for
			-- each messages received by the window and then the
			-- normal behavior will occur.
			-- (from WEL_WINDOW)
		ensure -- from WEL_WINDOW
			default_processing_enabled: default_processing

	enable_scroll_caret_at_selection
			-- Set scroll_caret_at_selection to True.
			-- The caret will be scrolled at the selection after
			-- a call to set_selection.
			-- (from WEL_MULTIPLE_LINE_EDIT)
		require -- from WEL_MULTIPLE_LINE_EDIT
			exists: exists
		ensure -- from WEL_MULTIPLE_LINE_EDIT
			scroll_caret_at_selection_enabled: scroll_caret_at_selection

	enable_standard_notifications
			-- Enable the standard notifications.
			-- (Enm_change, Enm_update and Enm_scroll).
		require
			exists: exists

	get_text_limit: INTEGER
			-- Get the maximum length of text that the user
			-- can enter into the edit control.
			-- (from WEL_EDIT)
		require -- from WEL_EDIT
			exisits: exists
		ensure -- from WEL_EDIT
			positive_result: Result >= 0

	hide
			-- Hide the window
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists
		ensure -- from WEL_WINDOW
			hidden: not shown

	insert_text (a_text: STRING)
			-- Insert a_text at the position of the cursor.
			-- Replace the current selection if there is one

	maximize
			-- Maximize the window
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists
		ensure -- from WEL_WINDOW
			maximized: maximized

	minimize
			-- Minimize the window and display its icon
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists
		ensure -- from WEL_WINDOW
			minimized: minimized

	move_to_selection
			-- Move the selected text to be visible

	release_capture
			-- Release the mouse capture after a call
			-- to set_capture.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists
			has_capture: has_capture
		ensure -- from WEL_WINDOW
			not_has_capture: not has_capture

	release_heavy_capture
			-- Release the mouse capture after a call
			-- to set_heavy_capture.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists
			has_heavy_capture: has_heavy_capture
			heavy_capture_activated: heavy_capture_activated
		ensure -- from WEL_WINDOW
			heavy_capture_set: not has_heavy_capture
			heavy_capture_deactivated: not heavy_capture_activated

	restore
			-- Restore the window to its
			-- original size and position after
			-- minimize or maximize
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	set_background_color (color: WEL_COLOR_REF)
			-- Set the background color with color.
		require
			exists: exists
			color_not_void: color /= void

	set_background_system_color
			-- Set the background color with the window
			-- background system color.
		require
			exists: exists

	set_capture
			-- Set the mouse capture to the Current window.
			-- Once the window has captured the mouse, all
			-- mouse input is directed to this window, regardless
			-- of whether the cursor is over that window. Only
			-- one window can have the mouse capture at a time.
			--
			-- Works only for windows in the same thread as your
			-- application.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists
			has_not_capture: not has_capture
			has_not_heavy_capture: not has_heavy_capture
		ensure -- from WEL_WINDOW
			has_capture: has_capture

	set_caret_position (position: INTEGER)
			-- Set the caret position with position.
			-- If scroll_caret_at_selection is True, the
			-- caret will be scrolled to position.
		require -- from WEL_EDIT
			exists: exists
			position_large_enough: position >= 0
			position_small_enough: position <= text_length
		ensure -- from WEL_EDIT
			has_no_selection: not has_selection
			caret_position_set: caret_position = position

	set_default_tab_stops
			-- Set default tab stops.
		require -- from WEL_MULTIPLE_LINE_EDIT
			exists: exists

	set_event_mask (an_event_mask: INTEGER)
			-- Set event_mask with an_event_mask.
			-- See class WEL_ENM_CONSTANTS for values.
		require
			exists: exists
		ensure
			event_mask_set: event_mask = an_event_mask

	set_ex_style (an_ex_style: INTEGER)
			-- Set an_ex_style with ex_style.
			--
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	set_focus
			-- Set the focus to Current
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	set_formatting_rect (rect: WEL_RECT)
			-- Set formatting_rect with rect.
			-- (from WEL_MULTIPLE_LINE_EDIT)
		require -- from WEL_MULTIPLE_LINE_EDIT
			exists: exists
			rect_not_void: rect /= void

	set_heavy_capture
			-- Set the mouse capture to the Current window.
			-- Once the window has captured the mouse, all
			-- mouse input is directed to this window, regardless
			-- of whether the cursor is over that window. Only
			-- one window can have the mouse capture at a time.
			--
			-- Works for ALL windows.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists
			has_not_heavy_capture: not has_heavy_capture
			heavy_capture_deactivated: not heavy_capture_activated
		ensure -- from WEL_WINDOW
			heavy_capture_set: has_heavy_capture
			heavy_capture_activated: heavy_capture_activated

	set_modify (modify: BOOLEAN)
			-- Set modified with modify
			-- (from WEL_EDIT)
		require -- from WEL_EDIT
			exists: exists
		ensure -- from WEL_EDIT
			modified_set: modified = modify

	set_options (operation, an_options: INTEGER)
			-- Set the opetions for the control.
			-- See class WEL_ECO_CONSTANTS for values.
		require
			exists: exists

	set_read_only
			-- Set the read-only state.
			-- (from WEL_EDIT)
		require -- from WEL_EDIT
			exists: exists

	set_read_write
			-- Set the read-write state.
			-- (from WEL_EDIT)
		require -- from WEL_EDIT
			exists: exists

	set_selection (start_position, end_position: INTEGER)
			-- Set the selection between start_position
			-- and end_position.
		require -- from WEL_EDIT
			exists: exists
			selection_in_lower_bound: start_position >= 0 and end_position >= 0
			selection_in_upper_bound: start_position <= text_length and end_position <= text_length
		ensure -- from WEL_EDIT
			has_selection: (start_position /= end_position) implies has_selection

	set_shared
			-- Set shared to True.
			-- (from WEL_ANY)
		ensure -- from WEL_ANY
			shared: shared

	set_style (a_style: INTEGER)
			-- Set style with a_style.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	set_tab_stops (tab: INTEGER)
			-- Set tab stops at every tab dialog box units.
		require -- from WEL_MULTIPLE_LINE_EDIT
			exists: exists
			positive_tab: tab > 0

	set_tab_stops_array (tab: ARRAY [INTEGER])
			-- Set tab stops using the values of tab.
		require -- from WEL_MULTIPLE_LINE_EDIT
			exists: exists
			tab_not_void: tab /= void
			tab_large_enough: tab.count > 1

	set_text (a_text: STRING)
			-- Set text with a_text.
		require -- from WEL_WINDOW
			exists: exists
		ensure -- from WEL_WINDOW
			text_set_when_not_void: a_text /= void implies equal (text, a_text)
			text_set_when_void: a_text = void implies text.count = 0

	set_text_limit (limit: INTEGER)
			-- Set the length of the text the user can enter into
			-- the edit control.
		require -- from WEL_EDIT
			exists: exists
			positive_limit: limit >= 0

	set_unshared
			-- Set shared to False.
			-- (from WEL_ANY)
		ensure -- from WEL_ANY
			unshared: not shared

	show
			-- Show the window
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	update_cached_style (new_ex_style, old_ex_style: INTEGER)
			-- Update Window cache buffer for Window style.
			-- (from WEL_WINDOW)
	
feature -- Element change

	has_system_window_locked: BOOLEAN
			-- Is there any window locked ?
			-- (from WEL_WINDOW)

	ignore_filtered_message
			-- Call this message from within on_en_msgfilter
			-- to prevent the filtered message to be handled
			-- by the Rich Edit Control.

	lock_window_update
			-- Disables drawing in the current window. A locked window cannot be moved.
			-- Only one window can be locked at a time. To unlock a window locked with
			-- lock_window_update , call 'unlock_window_update'.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists
		ensure -- from WEL_WINDOW
			has_system_window_locked

	print_all (dc: WEL_PRINTER_DC; title: STRING)
			-- Print the contents of the rich edit control on
			-- the printer dc. title is the printer job name.
		require
			exists: exists
			dc_not_void: dc /= void
			dc_exists: dc.exists
			title_not_void: title /= void

	set_character_format_all (a_char_format: WEL_CHARACTER_FORMAT)
			-- Apply a_char_format to all text.
		require
			exists: exists
			a_char_format_not_void: a_char_format /= void

	set_character_format_selection (a_char_format: WEL_CHARACTER_FORMAT)
			-- Apply a_char_format to current selection.
		require
			exists: exists
			a_char_format_not_void: a_char_format /= void

	set_character_format_word (a_char_format: WEL_CHARACTER_FORMAT)
			-- Set the current word with a_char_format.
		require
			exists: exists
			a_char_format_not_void: a_char_format /= void

	set_height (a_height: INTEGER)
			-- Set height with a_height
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	set_item (an_item: POINTER)
			-- Set item with an_item
			-- (from WEL_ANY)
		ensure -- from WEL_ANY
			item_set: item = an_item

	set_paragraph_format (a_para_format: WEL_PARAGRAPH_FORMAT)
			-- Set the current paragraph with a_para_format.
		require
			exists: exists
			a_para_format_not_void: a_para_format /= void

	set_parent (a_parent: WEL_WINDOW)
			-- Change the parent of the current window.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	set_placement (a_placement: WEL_WINDOW_PLACEMENT)
			-- Set placement with a_placement
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists
			a_placement_not_void: a_placement /= void

	set_timer (timer_id, time_out: INTEGER)
			-- Set a timer identified by timer_id with a
			-- time_out value (in milliseconds).
			-- See also on_timer, kill_timer.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists
			positive_timer_id: timer_id > 0
			positive_time_out: time_out > 0

	set_width (a_width: INTEGER)
			-- Set width with a_width
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	set_x (a_x: INTEGER)
			-- Set x with a_x
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	set_y (a_y: INTEGER)
			-- Set y with a_y
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	unlock_window_update
			-- Unlock a locked window.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists
	
feature -- Removal

	destroy
			-- Destroy the window.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists
		ensure -- from WEL_WINDOW
			not_exists: not exists

	dispose
			-- Destroy the inner structure of Current.
			--
			-- This function should be called by the GC when the
			-- object is collected or by the user if Current is
			-- no more usefull.
			-- (from WEL_ANY)
	
feature -- Conversion

	to_integer: INTEGER
			-- Converts item to an integer.
			-- (from WEL_ANY)
		ensure -- from WEL_ANY
			Result = cwel_pointer_to_integer (item)
	
feature -- Basic operations

	bring_to_top
			-- Bring this window to the top of the Z order.
			--
			-- Note:
			--  * If the window is a top-level window, it is activated.
			--  * If the window is a child window, the top-level parent window
			--    associated with the child window is activated.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	clear
			-- Clear the text
			-- (from WEL_STATIC)
		require -- from WEL_STATIC
			exists: exists
		ensure -- from WEL_STATIC
			text_empty: text.is_empty

	clip_copy
			-- Copy the current selection to the clipboard.
			-- (from WEL_EDIT)
		require -- from WEL_EDIT
			exists: exists
			has_selection: has_selection

	clip_cut
			-- Cut the current selection to the clipboard.
			-- (from WEL_EDIT)
		require -- from WEL_EDIT
			exists: exists
			has_selection: has_selection
		ensure -- from WEL_EDIT
			has_no_selection: not has_selection

	clip_paste
			-- Paste at the current caret position the
			-- content of the clipboard.
			-- (from WEL_EDIT)
		require -- from WEL_EDIT
			exists: exists

	default_process_notification (notification_code: INTEGER)
			-- Process a notification_code which has not been
			-- processed by process_notification.
			-- (from WEL_CONTROL)
		require -- from WEL_CONTROL
			exists: exists

	delete_selection
			-- Delete the current selection.
			-- (from WEL_EDIT)
		require -- from WEL_EDIT
			exists: exists
			has_selection: has_selection
		ensure -- from WEL_EDIT
			has_no_selection: not has_selection

	disable_horizontal_scroll_bar
			-- Disable the horizontal scroll bar.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	disable_vertical_scroll_bar
			-- Disable the vertical scroll bar.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	enable_horizontal_scroll_bar
			-- Enable the horizontal scroll bar.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	enable_vertical_scroll_bar
			-- Enable the vertical scroll bar.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	find (text_to_find: STRING; match_case: BOOLEAN; start_from: INTEGER): INTEGER
			-- Find text_to_find in WEL_RICH_EDIT

	go_to_next_group_item (a_parent: WEL_COMPOSITE_WINDOW; after: BOOLEAN)
			-- Find the previous or following control with the
			-- Wm_tabstop style in the current group in a_parent
			-- depending on the value of after.
			-- (from WEL_CONTROL)
		require -- from WEL_CONTROL
			valid_parent: a_parent /= void and then a_parent.exists

	go_to_next_tab_item (a_parent: WEL_COMPOSITE_WINDOW; after: BOOLEAN)
			-- Find the previous or following control with the
			-- Wm_tabstop style in `a_parent depending on the
			-- value of after.
			-- (from WEL_CONTROL)
		require -- from WEL_CONTROL
			valid_parent: a_parent /= void and then a_parent.exists

	hide_horizontal_scroll_bar
			-- Hide the horizontal scroll bar.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	hide_scroll_bars
			-- Hide the horizontal and vertical scroll bars.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	hide_selection
			-- Hide the selection.
		require
			exists: exists

	hide_vertical_scroll_bar
			-- Hide the vertical scroll bar.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	insert_after (a_window: WEL_WINDOW)
			-- Insert the current window after a_window.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists
			a_window_not_void: a_window /= void
			a_window_not_current: a_window /= Current
			a_window_exists: a_window.exists

	insert_rtf_stream_in (stream: WEL_RICH_EDIT_STREAM_IN)
			-- Start a rtf stream in operation with stream.
		require
			exists: exists
			stream_not_void: stream /= void

	insert_text_stream_in (stream: WEL_RICH_EDIT_STREAM_IN)
			-- Start a text stream in operation with stream.
		require
			exists: exists
			stream_not_void: stream /= void

	invalidate
			-- Invalide the entire client area of the window. The
			-- background will be erased before.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	invalidate_rect (rect: WEL_RECT; erase_background: BOOLEAN)
			-- Invalidate the area rect and erase
			-- the background if erase_background is True.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists
			rect_not_void: rect /= void

	invalidate_region (region: WEL_REGION; erase_background: BOOLEAN)
			-- Invalidate the area region and erase
			-- the background if erase_background is True.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists
			region_not_void: region /= void
			region_exists: region.exists

	invalidate_without_background
			-- Invalidate the entire client area of the window. The
			-- background will not be erased.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	kill_timer (timer_id: INTEGER)
			-- Kill the timer identified by timer_id.
			-- See also set_timer, on_timer.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists
			positive_timer_id: timer_id > 0

	load_rtf_file (file: RAW_FILE)
			-- Load a RTF file in the rich edit control.
		require
			exists: exists
			file_not_void: file /= void
			file_exists: file.exists
			file_is_open_read: file.is_open_read
		ensure
			file_closed: file.is_closed

	load_text_file (file: RAW_FILE)
			-- Load a text file in the rich edit control.
		require
			exists: exists
			file_not_void: file /= void
			file_exists: file.exists
			file_is_open_read: file.is_open_read
		ensure
			file_closed: file.is_closed

	move (a_x, a_y: INTEGER)
			-- Move the window to a_x, a_y.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	move_and_resize (a_x, a_y, a_width, a_height: INTEGER; repaint: BOOLEAN)
			-- Move the window to a_x, a_y position and
			-- resize it with a_width, a_height.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	put_command (a_command: WEL_COMMAND; message: INTEGER; argument: ANY)
			-- Put a_command associated to message.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			a_command_not_void: a_command /= void
			positive_message: message >= 0
		ensure -- from WEL_WINDOW
			command_added: command (message) = a_command and command_argument (message) = argument

	remove_command (message: INTEGER)
			-- Remove the command associated to message.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			positive_message: message >= 0
			command_exists: command_exists (message)
		ensure -- from WEL_WINDOW
			command_removed: not command_exists (message)

	replace_selection (new_text: STRING)
			-- Replace the current selection with new_text.
			-- If there is no selection, new_text is inserted
			-- at the current caret_position.
			-- (from WEL_EDIT)
		require -- from WEL_EDIT
			exists: exists
			new_text_not_void: new_text /= void

	resize (a_width, a_height: INTEGER)
			-- Resize the window with a_width, a_height.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	rtf_stream_in (stream: WEL_RICH_EDIT_STREAM_IN)
			-- Start a rtf stream in operation with stream.
		require
			exists: exists
			stream_not_void: stream /= void

	rtf_stream_out (stream: WEL_RICH_EDIT_STREAM_OUT)
			-- Start a rtf stream out operation with stream.
		require
			exists: exists
			stream_not_void: stream /= void

	save_rtf_file (file: RAW_FILE)
			-- Save the contents of the rich edit control in RTF
			-- format in file.
		require
			exists: exists
			file_not_void: file /= void
			file_exists: file.exists
			file_is_open_read: file.is_open_write
		ensure
			file_closed: file.is_closed

	save_text_file (file: RAW_FILE)
			-- Save the contents of the rich edit control in text
			-- format in file.
		require
			exists: exists
			file_not_void: file /= void
			file_exists: file.exists
			file_is_open_write: file.is_open_write
		ensure
			file_closed: file.is_closed

	scroll (horizontal, vertical: INTEGER)
			-- Scroll the text vertically and horizontally.
			-- horizontal is the number of characters to
			-- scroll horizontally, vertical is the number
			-- of lines to scroll vertically.
			-- (from WEL_MULTIPLE_LINE_EDIT)
		require -- from WEL_WINDOW
			exists: exists

	select_all
			-- Select all the text.
			-- (from WEL_EDIT)
		require -- from WEL_EDIT
			exists: exists
			positive_length: text_length > 0
		ensure -- from WEL_EDIT
			has_selection: has_selection
			selection_start_set: selection_start = 0
			selection_end_set: selection_end <= text_length + 2

	send_stream_in_message (format: INTEGER; stream: WEL_RICH_EDIT_STREAM_IN)
			-- Start stream in operation with stream.
			-- See class WEL_SF_CONSTANTS for format values.
			-- Lowest level stream in procedures.
		require
			exists: exists
			stream_not_void: stream /= void

	send_stream_out_message (format: INTEGER; stream: WEL_RICH_EDIT_STREAM_OUT)
			-- Start stream out operation with stream.
			-- See class WEL_SF_CONSTANTS for format values.
			-- Lowest level stream out procedures.
		require
			exists: exists
			stream_not_void: stream /= void

	set_class_icon (new_icon: WEL_ICON)
			-- Replace the current icon for the class which this window
			-- belongs to.
			--
			-- The SetClassLong function replaces the specified 32-bit (long)
			-- value at the specified offset into the extra class memory
			-- or the WNDCLASSEX structure for the class to which the
			-- specified window belongs.
			-- (from WEL_WINDOW)

	set_class_small_icon (new_icon: WEL_ICON)
			-- Replace the current icon for the class which this window
			-- belongs to.
			--
			-- The SetClassLong function replaces the specified 32-bit (long)
			-- value at the specified offset into the extra class memory
			-- or the WNDCLASSEX structure for the class to which the
			-- specified window belongs.
			-- (from WEL_WINDOW)

	set_z_order (z_order: POINTER)
			-- Set the z-order of the window.
			-- See class WEL_HWND_CONSTANTS for z_order values.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists
			valid_hwnd_constant: valid_hwnd_constant (z_order)

	show_horizontal_scroll_bar
			-- Show the horizontal scroll bar.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	show_scroll_bars
			-- Show the horizontal and vertical scroll bars.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	show_selection
			-- Show selection.
		require
			exists: exists

	show_vertical_scroll_bar
			-- Show the vertical scroll bar.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	show_with_option (cmd_show: INTEGER)
			-- Set the window's visibility with cmd_show.
			-- See class WEL_SW_CONSTANTS for cmd_show value.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists
			parent_shown: parent /= void implies parent.exists and parent.shown

	text_stream_in (stream: WEL_RICH_EDIT_STREAM_IN)
			-- Start a text stream in operation with stream.
		require
			exists: exists
			stream_not_void: stream /= void

	text_stream_out (stream: WEL_RICH_EDIT_STREAM_OUT)
			-- Start a text stream out operation with stream.
		require
			exists: exists
			stream_not_void: stream /= void

	undo
			-- Undo the last operation.
			-- The previously deleted text is restored or the
			-- previously added text is deleted.
			-- (from WEL_EDIT)
		require -- from WEL_EDIT
			exists: exists
			can_undo: can_undo

	unselect
			-- Unselect the current selection.
			-- (from WEL_EDIT)
		require -- from WEL_EDIT
			exists: exists
			has_selection: has_selection
		ensure -- from WEL_EDIT
			has_no_selection: not has_selection

	update
			-- Update the client area by sending a Wm_paint message.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	validate
			-- Validate the entire client area of the window.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists

	validate_rect (rect: WEL_RECT)
			-- Validate the area rect.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists
			rect_not_void: rect /= void

	validate_region (region: WEL_REGION)
			-- Validate the area region.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists
			region_not_void: region /= void
			region_exists: region.exists

	win_help (help_file: STRING; a_command, data: INTEGER)
			-- Start the Windows Help program with help_file.
			-- a_command specifies the type of help requested. See
			-- class WEL_HELP_CONSTANTS for a_command values.
			-- 'data' is depandant on 'a_command'.  Check MSDN for more details.
			-- (from WEL_WINDOW)
		require -- from WEL_WINDOW
			exists: exists
			help_file_not_void: help_file /= void
	
feature -- Element Change

	set_default_processing (value: BOOLEAN)
			-- Enable or disable default processing of window messages.
			-- (from WEL_RETURN_VALUE)
		ensure -- from WEL_RETURN_VALUE
			value_set: default_processing = value

	set_message_return_value (value: INTEGER)
			-- Set the window-procedure-return-value.
			-- (from WEL_RETURN_VALUE)
		ensure -- from WEL_RETURN_VALUE
			has_return_value: has_return_value
			value_set: message_return_value = value
	
feature -- Notifications

	on_en_change
			-- The user has taken an action
			-- that may have altered the text.
			-- (from WEL_EDIT)
		require -- from WEL_EDIT
			exists: exists

	on_en_errspace
			-- Cannot allocate enough memory to
			-- meet a specific request.
			-- (from WEL_EDIT)
		require -- from WEL_EDIT
			exists: exists

	on_en_hscroll
			-- The user click on the horizontal scroll bar.
			-- (from WEL_EDIT)
		require -- from WEL_EDIT
			exists: exists

	on_en_killfocus
			-- Lose the keyboard focus.
			-- (from WEL_EDIT)
		require -- from WEL_EDIT
			exists: exists

	on_en_maxtext
			-- The current text insertion has exceeded
			-- the specified number of characters.
			-- (from WEL_EDIT)
		require -- from WEL_EDIT
			exists: exists

	on_en_msgfilter (a_msg_filter: WEL_MSG_FILTER)
			-- Notfication of a keyboard or mouse event in the control.
			-- Only notfications are sent that are enabled
			-- in the event_mask.
			-- Note:
			-- To prevent the Rich Edit Control from handling the message
			-- indicated with a_msg_filter call ignore_filtered_message
		require
			exists: exists
			msg_filter_exists: a_msg_filter /= void and then a_msg_filter.exists

	on_en_setfocus
			-- Receive the keyboard focus.
			-- (from WEL_EDIT)
		require -- from WEL_EDIT
			exists: exists

	on_en_update
			-- The control is about to display altered text.
			-- (from WEL_EDIT)
		require -- from WEL_EDIT
			exists: exists

	on_en_vscroll
			-- The user click on the vertical scroll bar.
			-- (from WEL_EDIT)
		require -- from WEL_EDIT
			exists: exists
	
feature -- Registration

	register_current_window
			-- Register Current in window manager.
			-- (from WEL_WINDOW)
	
invariant

		-- from ANY
	reflexive_equality: standard_is_equal (Current)
	reflexive_conformance: conforms_to (Current)
		-- from WEL_EDIT
	consistent_selection: exists and then has_selection implies selection_start >= 0 and then selection_start <= text_length and then selection_end >= 0 and then selection_end <= text_length + 2 and then selection_start < selection_end
	valid_caret_position: exists implies caret_position >= 0 and then caret_position <= text_length + 2

end -- class WEL_RICH_EDIT