Visual Studio find text in code editor auto jumps from the current line to another one

Liviu Ionut Olteanu 11 Reputation points
2021-12-14T15:38:27.647+00:00

Hello,

Does someone knows how to fix an annoying behaviour in the code editor of Visual Studio.?
I have a .cs file with 10 000 lines of code.
I am positioned within the file to see the lines from 920 to 950
I am trying to find a specific text (let's say "contract")
While i am typing the "contract" word, Visual Studio automatically jumps to the closest occurence of the "contract" word, even i did not clicked on the Find Next button.
If the .cs file is very large (and it is) it's very hard to know if the found occurrence is in the scope you are interested or not.

Would be better to remove this behaviour and make Visual Studio act lke a normal editor:

  • Do not jump to the first occurrence until you click on Find Next button, because you just want to analyse the code that is in your sight, for highlighted words

It's the only text editor from Microsoft Stack that has this issue, Visual Studio Code and Sql Server Management Studio acts normal.

Thanks,

Liviu

Visual Studio
Visual Studio
A family of Microsoft suites of integrated development tools for building applications for Windows, the web and mobile devices.
4,862 questions
C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,616 questions
{count} votes

6 answers

Sort by: Most helpful
  1. Rory Apperson 11 Reputation points
    2022-06-03T15:27:09.54+00:00
    2 people found this answer helpful.

  2. Liviu Ionut Olteanu 11 Reputation points
    2021-12-15T13:06:17.873+00:00

    @Peter Fleischer (former MVP) it's Microsoft Visual Studio Professional 2019
    Version 16.11.4, and yes, some .cs files have over 20 000 lines of codes.

    @Karen Payne MVP It's a critical application deployed in production in 2008 and it cannot be refactored because the company that is using it does not have the resources for that. Even more, there are tens of files with more than 20 000 lines of codes, hence the effort to change it would be huge.

    @Anna Xiu-MSFT I am using Microsoft Visual Studio Professional 2019 Version 16.11.4. I've created a new Console App with 100 lines of codes. I've inserted the keyword "contract" on line 100. If my screen is focused on lines 0-30, when i click CTR+F and I input "contract", auto jumps to the line 100.

    0 comments No comments

  3. WayneAKing 4,921 Reputation points
    2021-12-15T13:47:50.247+00:00

    If my screen is focused on lines 0-30, when i
    click CTR+F and I input "contract", auto jumps
    to the line 100.

    Well, wouldn't it jump to that line when you do a
    Find Next anyway?

    One work-around is to select the lines of text you
    want to search. Then if you have the option set to
    "Automatically limit search to selection"
    it will only search those lines.

    • Wayne

  4. WayneAKing 4,921 Reputation points
    2021-12-19T23:36:23.237+00:00

    Maybe they call Ctrl-F "Quick Find" for a reason.

    Perhaps you would prefer Ctrl-Shift-F over Ctrl-F,
    I don't think it "auto jumps".

    In any event, I doubt that anyone here can change
    the behaviour of Ctrl-F and there doesn't appear
    to be any Option setting to alter it. I suppose
    you could submit a change request to MS.

    • Wayne

  5. Anna Xiu-MSFT 27,731 Reputation points Microsoft Vendor
    2021-12-22T02:19:20.943+00:00

    Hi @Liviu Ionut Olteanu ,

    When you type string through the shortcut ‘Ctrl + F’, it will immediately jump from your focus position to the next position of search string.
    It is designed like this. For any suggestions about the feature, please report it to product team in the Developer Community.

    Thank you for helping us build a better Visual Studio!

    Sincerely,
    Anna
    *
    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.