I messed up the maths, but that’s still missing the point.

```
pointA = [1, 5]
pointB = [2, 4]
diff = [1, -1]
midpoint = [1+(1/2), 5-(1/2)]
= [2, 5]
```

The actual midpoint can’t be [2, 5], it should be somewhere less than point B.

The real problem is, you need to know how long line 1 is in order to calculate the midpoint. For example, if we had the following text, with the bolded text indicating a Range that we want to find the midpoint of:

for **(let i=0; i < 20; i++){**

**cons**ole.log(i);

}

The selection consists of 23 characters on line 1, and 4 characters on line 2, adding to 27 characters total. The midpoint is then 13 characters after the start of the selection (the left parenthesis), so is actually the < symbol. You can’t work this out just by adding together the start and the end and dividing by two.