Community
    • Login

    Replace in Files / "Directory" field scrolls right when clicked

    Scheduled Pinned Locked Moved General Discussion
    17 Posts 6 Posters 267 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • fml2F
      fml2
      last edited by

      Hello,

      I’d like to share a little annoyance I have with NP++ and ask whether anybody also have noticed it and how you cope with it.

      Sometimes I’m editing a file that resides deep in the directory hierarchy. Then I want to perform the operation Replace in files for the whole hierarchy. To do that, I

      1. Press Ctrl+Shift+F to bring up the Find in Files dialog – the field Directory is atomatically filled with the directory of the current file, i.e. a “deep” one. The directory is scrolled to the left, i.e. I see the leftmost part of it. The “root” directory from which I want to perform the “replace” operation can also be seen.
      2. Since I want to perform the operation on the whole hierarchy (i.e. from the root), I want to cut off the tail part of the directory. I move my mouse to the Directory field, locate the right place (the one after the root dir) and click the mouse. I expect that the cursor is placed there so that I can then press Shift+End (mark the tail) and then Delete (remove the tail).

      Instead, when I click the mouse, the Directory field is scrolled to the right and the cursor is on some random point in the text. I have to again scroll it to the left etc.

      The automatic scrolling to the right could be acceptable if the user gets there via pressing Tab. But when it’s done with the mouse I’d expect the cursor be exactly where the mouse was pointing to before the click.

      I hope I could more or less convey the situation.

      Thank you for any hints. And to the authors for the great program.

      Alan KilbornA 1 Reply Last reply Reply Quote 0
      • Alan KilbornA
        Alan Kilborn @fml2
        last edited by Alan Kilborn

        @fml2 said:

        when I click the mouse, the Directory field is scrolled to the right and the cursor is on some random point in the text.

        For me, it isn’t some random point, it’s that the entire text content of the Directory edit/combobox is selected.

        But, I understand your overall point: it IS rather annoying.

        All such controls in the Find family of windows works the same way: Clicking to put input focus in the control selects all text (and scrolls all the way to the right).

        Other edit controls in Notepad++, e.g. the ones in the Column Editor input boxes, do not work the same way. Clicking in these puts the caret in the text at the point of the click, without selecting anything. If it is desired to select all text, a double-click will do that in these boxes.

        You should open an official feature request and see if you can get the behavior changed – good luck.

        A workaround might be to resize the Find window horizontally so that you can see all of the Directory box text. It still takes an additional click to get your caret where you want it to be, but at least there is no awkward repositioning required, because no text “shifting” occurs.

        fml2F CoisesC 2 Replies Last reply Reply Quote 1
        • fml2F
          fml2 @Alan Kilborn
          last edited by

          @Alan-Kilborn said in Replace in Files / "Directory" field scrolls right when clicked:

          For me, it isn’t some random point, it’s that the entire text content of the Directory edit/combobox is selected.

          Yes, you are correct. After the first click, the whole text is selected and scrolled to the right, and after the second click on the same position (i.e. without moving the mouse) the cursor is at a “random” position (“random” in the sense that it’s unpredictable for me in the beginning where I’ll get to after the second click).

          PeterJonesP 1 Reply Last reply Reply Quote 0
          • PeterJonesP
            PeterJones @fml2
            last edited by PeterJones

            @fml2 said in Replace in Files / "Directory" field scrolls right when clicked:

            after the second click on the same position (i.e. without moving the mouse) the cursor is at a “random” position (“random” in the sense that it’s unpredictable for me in the beginning where I’ll get to after the second click).

            For me, it is 100% deterministic / predictable: wherever my mouse was for the second click, that is where the caret will be after the select-all is cleared. (update: obviously, if I don’t wait for it to finish redrawing between the first and second click, then I can’t know where it will be; but if I click, wait a fraction of a second until I can see the character, then click again, it is 100% at that character when the select-all clears. If I do go too fast, it tends to double-click select a “word” rather than having a single caret.)

            If that’s not sufficient for you, then do the first mouse click to select-all in the field, then, instead of clicking a second time, hit HOME to move the caret to the first character in the field, or END to move it to the last character in the field – again, 100% deterministic / predictable.

            Mark OlsonM 1 Reply Last reply Reply Quote 2
            • Mark OlsonM
              Mark Olson @PeterJones
              last edited by

              @PeterJones said in Replace in Files / "Directory" field scrolls right when clicked:

              If that’s not sufficient for you, then do the first mouse click to select-all in the field, then, instead of clicking a second time, hit HOME to move the caret to the first character in the field, or END to move it to the last character in the field – again, 100% deterministic / predictable.

              Yeah, Ctrl+A followed by forward-arrow (to move to the end) or back-arrow (to move to the beginning) is just a really generically useful shortcut that works on all text buffers on Windows, not just in Notepad++.

              1 Reply Last reply Reply Quote 2
              • CoisesC
                Coises @Alan Kilborn
                last edited by

                @Alan-Kilborn said in Replace in Files / "Directory" field scrolls right when clicked:

                All such controls in the Find family of windows works the same way: Clicking to put input focus in the control selects all text (and scrolls all the way to the right).

                Other edit controls in Notepad++, e.g. the ones in the Column Editor input boxes, do not work the same way. Clicking in these puts the caret in the text at the point of the click, without selecting anything. If it is desired to select all text, a double-click will do that in these boxes.

                I am nearly certain the difference is because the ones in Search dialogs are drop-down boxes (with a history) and not simple edit controls. Combo boxes behave that way normally in Windows. That can probably be changed by sub-classing the controls, though I’ve never attempted it. It’s usually a bad idea to alter the standard behavior of Windows controls unless you have a really good reason.

                Alan KilbornA 1 Reply Last reply Reply Quote 3
                • Alan KilbornA
                  Alan Kilborn @Coises
                  last edited by

                  @Coises said :

                  It’s usually a bad idea to alter the standard behavior of Windows controls unless you have a really good reason.

                  This might be one of those times.
                  It’s one of those things that has nagged at me occasionally, but never enough where it was enough of a conscious awareness about what was happening to make me pursue it.

                  CoisesC 1 Reply Last reply Reply Quote 0
                  • CoisesC
                    Coises @Alan Kilborn
                    last edited by

                    @Alan-Kilborn said in Replace in Files / "Directory" field scrolls right when clicked:

                    @Coises said :

                    It’s usually a bad idea to alter the standard behavior of Windows controls unless you have a really good reason.

                    This might be one of those times.
                    It’s one of those things that has nagged at me occasionally, but never enough where it was enough of a conscious awareness about what was happening to make me pursue it.

                    It has annoyed me too. But…

                    Consider that there is almost always something in those fields (either the last used value, or some text from the document in the “Find what” field). To type something entirely new, users would have to first type Ctrl+A — or, less sophisticated users might not know about that and believe they had to delete the existing text character by character or select it with the mouse first.

                    Changing this would be replacing an annoying behavior which users are used to with a different annoying behavior which users are not used to.

                    1 Reply Last reply Reply Quote 1
                    • fml2F
                      fml2
                      last edited by

                      Actually, I’m not against marking the text. What I don’t like is the fact that the text is shown scrolled to the left but then is scrolled to the right when it gets focus. It’s like pulling the ground off under the feet.

                      I was not aware that this is the standard way text controls work in Windows.

                      CoisesC mpheathM 2 Replies Last reply Reply Quote 0
                      • CoisesC
                        Coises @fml2
                        last edited by Coises

                        @fml2 said in Replace in Files / "Directory" field scrolls right when clicked:

                        Actually, I’m not against marking the text. What I don’t like is the fact that the text is shown scrolled to the left but then is scrolled to the right when it gets focus. It’s like pulling the ground off under the feet.

                        I was not aware that this is the standard way text controls work in Windows.

                        It’s not standard for text controls. It’s standard for “drop-down” controls, where there is a downward-pointing arrow at the right side which you can click to get a list of choices, any of which you can then click to fill in the box.

                        It is allowed, but not common, to use this kind of control when the text is often too long to fit the width of the box.

                        Edit to add: I think the scrolling-to-the-right behavior is somehow implicit in the select-all behavior, but I wouldn’t want to say either way whether it would be possible to change it without causing other inconsistent behaviors.

                        fml2F 1 Reply Last reply Reply Quote 2
                        • mpheathM
                          mpheath @fml2
                          last edited by

                          @fml2 Seems to be the behavior of the CBS_AUTOHSCROLL style.

                          Constant Description
                          CBS_AUTOHSCROLL Automatically scrolls the text in an edit control to the right when the user types a character at the end of the line. If this style is not set, only text that fits within the rectangular boundary is allowed.

                          It’s like pulling the ground off under the feet.

                          At the moment you have some ground to stand on.

                          Removing this style means that the text width cannot exceed the edit control width. The ground may be pulled from under your feet entirely with removing this style as your long path would be too long in length.

                          I removed this style with Resource Hacker, tested the behavior and the result would disgust you. It is quite limiting of an experience.

                          fml2F 1 Reply Last reply Reply Quote 1
                          • fml2F
                            fml2 @mpheath
                            last edited by fml2

                            @mpheath said in Replace in Files / "Directory" field scrolls right when clicked:

                            Automatically scrolls the text in an edit control to the right when the user types a character at the end of the line.

                            Hrm… I don’t think this describes adequately what happens since the scrolling is done without me typing anything. The edit field just gets focus. I surely want to see the caret at all times if I’m actually typing something, i.e. the style you named is a good thing.

                            Is it possible to mark the text (I can see the benefit of marking the text on focus) but preserve the scrolling position? Is there a style responsible for that behaviour?

                            As of now it’s like you come to a store, see a price tag and want to buy the item. But in the moment you take it the price changes (I’ve actually experienced such thing on a hotel booking site). I.e. you don’t get what is advertised.

                            Upd: anyway, I see that it’s somehow a standard (or not unusual) behaviour, and, since it’s just a minor annoyance for me, I won’t pursue to change anything in the current way it works. Thank you all for your replies!

                            1 Reply Last reply Reply Quote 0
                            • fml2F
                              fml2 @Coises
                              last edited by

                              @Coises said in Replace in Files / "Directory" field scrolls right when clicked:

                              It’s not standard for text controls. It’s standard for “drop-down” controls, where there is a downward-pointing arrow at the right side which you can click to get a list of choices, any of which you can then click to fill in the box.

                              Interestingly, the behaviour of the “Find what” field in the same dialog (which is also a drop down list) is different: it’s shown scrolled to the right (both in “Find” and “Find in files” tab). This is OK IMO since the scrolling position is not changed when the field gets focus. Changing displayed part on focus is my main concern.

                              CoisesC 1 Reply Last reply Reply Quote 0
                              • CoisesC
                                Coises @fml2
                                last edited by Coises

                                @fml2 said in Replace in Files / "Directory" field scrolls right when clicked:

                                Interestingly, the behaviour of the “Find what” field in the same dialog (which is also a drop down list) is different: it’s shown scrolled to the right (both in “Find” and “Find in files” tab). This is OK IMO since the scrolling position is not changed when the field gets focus. Changing displayed part on focus is my main concern.

                                I don’t see this. If both the “Find what” field and the “Directory” field are longer than will fit, when I open the dialog, the "Find what” field is highlighted and scrolled right, while the “Directory” field is scrolled left. If I then focus the “Directory” field (whether by clicking in it or by typing Alt+E), it is highlighted and scrolled right, while the “Find what” field loses highlighting and scrolls left.

                                It’s consistent for me: whenever a drop-down control receives focus, the entire control is highlighted (whether by mouse, keyboard or because it is the control that receives focus when the dialog is first opened), the insertion point is set to the far right, and if the text won’t fit in the control, the text is scrolled to the right. If focus is given by clicking, the position of the click is ignored.

                                Whenever focus leaves a drop-down control, highlighting is removed and if the text does not fit within the control, it is scrolled to the left.

                                fml2F 1 Reply Last reply Reply Quote 0
                                • fml2F
                                  fml2 @Coises
                                  last edited by

                                  @Coises said in Replace in Files / "Directory" field scrolls right when clicked:

                                  the "Find what” field is highlighted and scrolled right, while the “Directory” field is scrolled left.

                                  My point exactly. This is the difference. To me, it would be more logical if no scrolling took place upon focus. Why should the field be scrolled on focus? This disrupts the mental user context IMO.

                                  PeterJonesP 1 Reply Last reply Reply Quote 0
                                  • PeterJonesP
                                    PeterJones @fml2
                                    last edited by PeterJones

                                    @fml2 said in Replace in Files / "Directory" field scrolls right when clicked:

                                    My point exactly. This is the difference. To me, it would be more logical if no scrolling took place upon focus. Why should the field be scrolled on focus? This disrupts the mental user context IMO.

                                    There is no difference. You misunderstood what @Coises was trying to say: whichever combobox field you click in, that one highlights all the text and scrolls to the right; the other fields go back to their default state.

                                    Follow this sequence:

                                    1. STATE = nothing active/selected/focused: both Find What and Directory show the beginning of the value (“scrolled left”)
                                      a1f36bfd-ee45-4f68-b901-c55183d06b89-image.png
                                    2. STATE = click in Find What: Find What text shows the end (“scrolled right”), no change to Directory
                                      1a0936c3-5263-48ca-9c0d-499846b7761d-image.png
                                    3. STATE = click in Directory: Find What text deselects, and goes back to the beginning (“scrolled left”), and Directory selects all and shows the end (“scrolled right”)
                                      205ac65a-1a76-48f0-997f-90fe3dc84896-image.png
                                    4. STATE = click back in Find What: it goes back to the exact same thing as state 2

                                    They behave exactly the same: whichever one you click selects all and scrolls to the far right. There is no difference. This is standard Windows GUI behavior, and has been for at least two decades. This is not Notepad++ specific.


                                    update: for example, in Microsoft notepad.exe, using the Save As dialog, where the File name field uses a combobox (typeable box with pulldown arrow on right for accessing other values):

                                    1. STATE = nothing clicked/selected: the File name box is scrolled to the left, showing the beginning of the filename
                                      e8c1df76-cbe4-4a2a-8ff7-374f8b50b99e-image.png
                                    2. STATE = click in File name: it selects all and scrolls to the far right to show the end of the filename
                                      74fc3dd1-7ffa-4238-a410-db6d967adc02-image.png

                                    This is the exact same behavior as in the Notepad++ dialog box. This is standard Windows GUI behavior.

                                    1 Reply Last reply Reply Quote 2
                                    • fml2F
                                      fml2
                                      last edited by fml2

                                      @Coises , @PeterJones Now I see your point. So the “Find what” field is not scrolled to the right per se, but just because it happens to have focus when the dialog is opened. When I leave the field it gets scrolled back to the left (and the field receivinf focus is scrolled to the right).

                                      I’ve tried several applications (including Editor and Excel) and found out that this last point (scrolling to the left when the field is left) is not done everywhere. Ofter, the text remains scrolled to the far right.

                                      I don’t understand the logic begind it (when it’s done and when not), but I see that NP++'s behaviour does not differ (much) from that of other Windows applications.

                                      Thank you for your patience.

                                      Upd: Though it seems to be the standard behaviour with the drop dow lists, I still don’t get the rationale behind it. Why should something be shown one way when it doesn’t have focus and the other way when it does?

                                      1 Reply Last reply Reply Quote 0
                                      • First post
                                        Last post
                                      The Community of users of the Notepad++ text editor.
                                      Powered by NodeBB | Contributors