What is meta? ×
Meta Stack Exchange is where users like you discuss bugs, features, and support issues that affect the software powering all 127 Stack Exchange communities.

This feature request is to position cursor at appropriate place i.e. the corresponding place where the mouse pointer is clicked over the preview of the post.

This would be helpful while asking the question and more helpful while editing long post (or post that contain long piece of code).

I created a gif(not a great one, but learn't to create a gif to demonstrate this ;)) to explain this. If we click at point A the cursor should be placed at the <?php line in the text-area, if mouse pointer is clicked at point B, then the cursor should be placed at it's respective position in text-area.

Example of Points A & B

share|improve this question
    
+1 for suggestion, -1 for yellow text on gray background –  Jeff Nov 24 '12 at 21:33
3  
Holy shmoly, thanks, @animuson (If I could upvote edits...). –  Daniel Fischer Nov 24 '12 at 21:42
    
Thanks @animuson. But had thought a gif would be more appealing in this case. –  mtk Nov 25 '12 at 8:16
add comment

2 Answers

This is close to impossible to get really right, but I have a userscript that tries to come as close as possible: Dude, where's my cursor?.

It comes with a few caveats, so be sure to read the description.

share|improve this answer
add comment

A feature like this would be quite difficult to implement I imagine, particularly because it is unprecedented.

The current state of DOM API doesn't give you anything that lets you detect what two characters a click occurred between, which means you're stuck either using unreliable coordinate based checks or adding a wrapping element + hook to each and every character in the body of your text.

Here are a few proposals for more realistic requirements:

  1. Navigate to the beginning of the relevant code block, quote or text run on click.
  2. Navigate on drag selection instead of on click, which is much easier to implement
share|improve this answer
    
It is possible to get the selected text in most browsers, though not on a standard way. So this could be made to work if it was match selection rather than just location. –  EdC Nov 25 '12 at 8:50
    
@EdC Yes, that is why I proposed the second alternative. Constructing a range from the selection and processing it shouldn't be too difficult. –  Asad Nov 25 '12 at 8:56
add comment

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .