Questions tagged [textrange]

Represents a selection of content between two TextPointer positions.

The TextRange class introduces the following terminology.

Selection - A TextRange is a selection of content between two positions indicated by TextPointers. One of these positions a fixed anchor with respect to the selection, while the other position is movable. This is similar to how a selection made by a user using the mouse or keyboard behaves.

Current Selection - Because a TextRange always indicates a selection in content, it makes sense to simply refer to the selection indicated by a TextRange as the current selection.

Text Container - A text container is the element that forms the ultimate border for the flow content at hand; the selection indicated by a TextRange always falls within a text container. Currently, a text container must be either a FlowDocument or a TextBlock. Document - The content collectively contained within a text container is referred to as a document. For more information about other related terms like position, see TextPointer.

92 questions
3
votes
2 answers

GetPositionAtOffset() don't return good position

I use a RichTextBox in WPF (4.0) and I use the GetPositionAtOffset() method to get a text range between two position in the content in RichTextBox. 1) I initialize the text pointer "position" from MyRichTextBox.Document.ContentStart : TextPointer…
Flo
  • 83
  • 8
3
votes
1 answer

How to get TextRange of text written by user in RichTextBox

I have RichTextBox which is like "console". In 'cmd' I displaying data from SSH connection and I also allowing to write something into 'cmd' RichTextBox. public void ConnectTTY() { NewTerminal = new TTY(HostBox.Text, "", LoginBox.Text,…
Wiktor
  • 754
  • 1
  • 7
  • 24
3
votes
2 answers

Highlight a line in a RichTextBox

I'm trying to highlight a line in my RichTextBox. My attempt was to get the line's position in the text and then create a TextRange representing text.Substring(offset, word.Length). But somehow the RichTextBox only highlights the last 2 characters…
michaeln
  • 1,032
  • 17
  • 33
3
votes
4 answers

Change cursor type when the mouse gets over some selected text using HTML/Javascript

I need to change cursor type when the mouse gets over a selected text. Here you can find an explanatory image : Image to explain the type of cursor I want http://img190.imageshack.us/img190/1786/72162829.png In this example the user has to drag…
Licx
  • 1,293
  • 2
  • 11
  • 12
2
votes
4 answers

highlight text on single click (javascript jquery html)

When you double click on a word in all browsers, they automatically highlight the word under the click. But is it possible to find a way to have the exact same thing happen on a single click? I imagine things involved in this might be: - TextRange…
Nicholas Petersen
  • 9,104
  • 7
  • 59
  • 69
2
votes
1 answer

Can jQuery work with partial elements? (ranges)

Is it possible for jQuery to work with partial elements (aka ranges)? Probably not, but does anyone know any plugins? - or would anyone like to collaborate with me on making such a plugin? Essentially, this is the functionality I'm after: var $el =…
balupton
  • 47,113
  • 32
  • 131
  • 182
2
votes
1 answer

Syncfusion SfRichTextBoxAdv - Replicating the WPF TextRange functionality?

I'm trying to let the user make selections in the SfRichTextBoxAdv and save these selections (text ranges) to a collection. The thing is i also want the text ranges to update their start/end positions when text is added or deleted before them. i.e:…
moonlander
  • 143
  • 2
  • 8
2
votes
1 answer

In Webkit, how do I add another word to the range?

Suppose I've made my range so that it covers a word, using range.expand('word'). Typically to add the next word, I would write range.moveEnd('word', 1). But this seems not to work in Webkit. Perhaps it should be implemented differently?
tofutim
  • 22,664
  • 20
  • 87
  • 148
2
votes
1 answer

How to serialize a class with a TextRange property?

I'm trying to serialize a class that has a property of type TextRange in it. Example: public class MyClass { private string someProp; public string SomeProp { get { return someProp; } set { someProp = value; } } …
moonlander
  • 143
  • 2
  • 8
2
votes
1 answer

Javascript: remember selected range of a text

I am trying to find a way to remember/store a JScript textrange and then apply it back to a text and convert it into a selection. An example: in an iframe which is in "designmode" and contains the text "This is text inside the frame", the user…
Krumelur
  • 32,180
  • 27
  • 124
  • 263
2
votes
0 answers

How can I split an HTML element?

I try to split an HTML section according to the selection point. For example suppose I have :
one
two
tree
Now if the user selects two with mouse and click on a…
Ahmad
  • 8,811
  • 11
  • 76
  • 141
2
votes
1 answer

Find start position of text range in IE11

I've got the following code to find a piece of text in IE11 var search_position = 0; function findMyText(find) { // create range (selects all text) var range = document.body.createTextRange(); …
roryok
  • 9,325
  • 17
  • 71
  • 138
2
votes
1 answer

WPF RichTextBox - Formatting of typed text

I am applying formatting to selected tokens in a WPF RichTextBox. To do this I get a TextRange that encompasses the token that I would like to highlight. I will then change the color of the text like this: // Get start and end pointer for…
Alan Spark
  • 8,152
  • 8
  • 56
  • 91
2
votes
4 answers

WPF RichTextBox increment font size

As the title suggests, my aim is to increment/decrement the font size of the current selection of text inside the RichTextBox. This may seem trivial, and in fact it is - so long as the font size is the same for all text in the TextRange. When the…
JessMcintosh
  • 460
  • 2
  • 6
  • 21
2
votes
0 answers

HTML plaintext editor: how to enrich with "intelligent section headings"?

I'm trying to create a (plain text) editor in a HTML page. I want the user to be able to create section and subsection headings anywhere inside the editor. These titles have pre-defined css and smart functions such as ability to control section…
bebbi
  • 2,489
  • 3
  • 22
  • 36