Menu

#2333 [Scintilla] Mouse cursor visibility when typing starts

Feature_Request
closed-fixed
nobody
5
2025-05-23
2022-05-20
No

In Notepad++ usage of Scintilla, my Windows 10 mouse options choice for "Hide pointer while typing" isn't respected when the mouse cursor and keyboard input focus is in a Scintilla control/window. Some further discussion is located here: https://community.notepad-plus-plus.org/topic/23017/mouse-cursor-visibility-when-typing-starts

Discussion

  • pryrt

    pryrt - 2022-05-20

    The same happens in SciTE 5.2.2, so it's not just Notepad++'s usage of the library.

     
  • Neil Hodgson

    Neil Hodgson - 2022-05-20
    • labels: --> scintilla, win32
    • status: open --> open-accepted
    • Group: Bug --> Feature_Request
     
  • johnsonj

    johnsonj - 2023-05-31

    Inspired from sakura editor.
    patch added:

     
  • johnsonj

    johnsonj - 2023-05-31

    Respect SPI_GETMOUSEVANISH from OS

     
  • Neil Hodgson

    Neil Hodgson - 2023-06-02

    SPI_GETMOUSEVANISH sets a BOOL (4 bytes), not a bool (1 byte).

    sizeof(bool)
    0x0000000000000001
    
    sizeof(BOOL)
    0x0000000000000004
    

    RequestShowCursor doesn't need to call DisplayCursor as the cursor will be set in soon-to-be-called ButtonMoveWithModifiers and there could be flicker if set twice. Therefore RequestShowCursor can just be isCursorHidden = false;.

     
  • Zufu Liu

    Zufu Liu - 2023-06-04

    how about move SystemParametersInfoW(SPI_GETMOUSEVANISH, ... into GetIntelliMouseParameters()?

     
  • johnsonj

    johnsonj - 2023-06-06

    A function Shoud have only one function according its name.

     
    • Neil Hodgson

      Neil Hodgson - 2023-06-06

      GetMouseParameters or GetSystemParameters.

       
      👍
      1
  • Neil Hodgson

    Neil Hodgson - 2023-06-08
    • labels: scintilla, win32 --> scintilla, win32, mouse
    • status: open-accepted --> open-fixed
     
  • Neil Hodgson

    Neil Hodgson - 2023-06-08

    Committed as [5bd06e] with some name changes:
    TypingWithoutCursor -> HideCursorIfPreferred
    typingWithoutCursorByOS -> typingWithoutCursor
    isCursorHidden -> cursorIsHidden

     

    Related

    Commit: [5bd06e]

    • Zufu Liu

      Zufu Liu - 2023-06-11

      It seems this needs further works: in Windows Notepad deleting character (e.g. with Backspace) mouse is still hidden.

      Edit: It's my fail on sync the patch for case WM_CHAR:.

       

      Last edit: Zufu Liu 2023-06-11
    • johnsonj

      johnsonj - 2025-05-21

      code simplified.
      easier reading!

       

      Last edit: johnsonj 2025-05-21
      • Neil Hodgson

        Neil Hodgson - 2025-05-21

        That doesn't work for me. The cursor flickers for the first character typed then switches to the arrow on the next.

         
        • johnsonj

          johnsonj - 2025-05-22

          Thank you for your testing.
          I am sorry I did not catch it.
          patch attached:

           
          • Neil Hodgson

            Neil Hodgson - 2025-05-22

            By placing the cursor hiding inside WM_KEYDOWN the cursor is hidden for arrow movement and other keyboard commands. The "Hide pointer while typing" option is only meant for typing visible characters as demonstrated by Notepad and edit fields in system dialogs.

            In the code NULL is strongly disliked by code checking tools and comparing a HCURSOR to nullptr is also iffy so its best to rely on the falsy value of HCURSOR{} with a bare if (::GetCursor()).

             
            • johnsonj

              johnsonj - 2025-05-23

              Thank you for your instructions.
              Gtk patch attached according your instructions.

               
              • Neil Hodgson

                Neil Hodgson - 2025-05-23

                This doesn't appear to be checking the system for the equivalent to the "hide pointer while typing" choice SPI_GETMOUSEVANISH.

                 
  • johnsonj

    johnsonj - 2023-06-10

    I appreciate you for your hard works.
    I submit a patch for Qt.

     
    • Neil Hodgson

      Neil Hodgson - 2023-06-11

      Setting a global override cursor seems too likely to interfere with other elements of the application. It may be safer to set the cursor for the window as is done by Window::SetCursorcalling QWidget::setCursor in qt/ScintillaEditBase/PlatQt.cpp.

      Despite having system settings support for "Hide pointer while typing", it is not commonly implemented on Windows. Even Microsoft products like Visual C++ and OneNote do not have it. Since it is unusual on Windows, it shouldn't be active unless the option has ben chosen but this Qt patch turns it on without checking the option.

       
  • Neil Hodgson

    Neil Hodgson - 2023-07-26
    • status: open-fixed --> closed-fixed
     

Log in to post a comment.

MongoDB Logo MongoDB