Menu

#1561 Map invalid cursor to blank cursor.

Initial
open
johnsonj
5
2025-07-02
2025-05-24
johnsonj
No

Window::Cursor:invalid is visualized to blank cursor.
patch attached:

1 Attachments

Discussion

  • Neil Hodgson

    Neil Hodgson - 2025-05-25

    Why? Cursor::invalid currently has a specific meaning that the previous cursor is not known. Reusing it for some other meaning is just massively confusing.

     

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

      johnsonj - 2025-05-25

      I'd like to implement noCursorTyping for Win, Gtk and Qt.
      I find it is simple to implement the feature in Editor.cxx.

       
      • Neil Hodgson

        Neil Hodgson - 2025-05-25

        There's quite a bit more code required to implement cursor hiding, including setting discovery as well as the additions inside Editor.

         
  • johnsonj

    johnsonj - 2025-05-30

    I have tried noCursurTyping feature of Win32 to be moved into Editor for supporting all platforms.
    macOS gives no blank cursor.
    This diff uses setHiddenUntilMouseMoves instead of custom blank cursor for macOS style
    But I saw custom blank cursor with transparent image works perfect either.

     
  • Neil Hodgson

    Neil Hodgson - 2025-05-31

    This doesn't unhide the cursor in as many circumstances as before since it requires that the mouse position really moved and Windows sends extra WM_MOUSEMOVE messages in some situations. For example, use Ctrl+Tab to switch between documents and SciTE would previously reshow the cursor. With the patch, it doesn't.

    https://devblogs.microsoft.com/oldnewthing/20031001-00/?p=42343

    There's not much reason to protect the reset of cursorIsHidden with if (typingWithoutCursor) and it more likely to leave the cursor hidden when its not required.

     
  • johnsonj

    johnsonj - 2025-06-01

    it works well on all platforms.
    naming refined.

     
  • Neil Hodgson

    Neil Hodgson - 2025-06-01

    For example, use Ctrl+Tab to switch between documents and SciTE would previously reshow the cursor. With the patch, it doesn't.

    It still doesn't. In case I wasn't clear: the cursor should show when the document is switched. Hide-pointer-while-typing is a light, temporary convenience mode that should be abandoned whenever the use stops typing by performing a larger scope command.

    hideCursor0601.diff made the opposite to the wanted change. For Win32, it needs to set cursorIsVisible = true on every WM_MOUSEMOVE, even for the extra messages that did not really move the mouse since they indicate a major change to the window.

     
    • johnsonj

      johnsonj - 2025-06-03

      Semantics changed: cursorIsHidden -> cursorIsVisible -> cursorIsIn
      Win32 behaves as your instruction for ctrl+tab, ctrl+N and so forth.
      Gtk does keep its cursor state as is.
      I am not sure Qt and macOS since I have no tab-featured test application.
      But I guess they also behaves as Gtk.

       
  • Neil Hodgson

    Neil Hodgson - 2025-06-11

    Semantics changed: cursorIsHidden -> cursorIsVisible -> cursorIsIn

    This change doesn't make sense to me: in what?

    Win32 behaves as your instruction for ctrl+tab, ctrl+N and so forth.

    It doesn't work for me in SciTE:

    action cursor
    start visible
    type 'a' invisible
    Ctrl+Tab invisible

    typingWithoutCursor remains false forever except on Win32. Therefore it has no effect and is useless on other platforms. There has to be enabling code that can set it to true.

     
    • johnsonj

      johnsonj - 2025-06-12

      I realize hidden cursor does not depend on visibility.
      It depends on character added and whether in or out of edit pane.
      (it triggers when character added and only if within edit pane.)

      My plan is moving win32 code to Editor, so that make it work for all platforms.
      I'd like to expose typingWithoutCursor to user option.
      but I did not work on this yet.

      Respond spurious event of mouse moving on win32
      Ctrl+N, Ctrl+Tab etc revives cursor to be normal.
      https://youtu.be/4itLcZUkN9o

      Hide cursor while typing for scintilla on macOS
      implemented with 16x16 transeparent PNG
      https://youtu.be/dlh7dGbdfRo

       
      • Neil Hodgson

        Neil Hodgson - 2025-06-12

        Sometimes it works but not other times.
        https://www.youtube.com/watch?v=DnWpkmVeRpk

         
        • johnsonj

          johnsonj - 2025-06-16

          Avoding spurious mouse move event on win32, I bind "cursorIsVisible" with keyboard modifiers. To my surprise, GTK can show cursor between tabs.
          but I gave up mouse leave event, which is too elusive to catch.

          Hide cursor while typing for scintilla on GTK
          https://youtu.be/yQl-mf3XC9w

           
          • Neil Hodgson

            Neil Hodgson - 2025-06-18

            That is flipping cursorIsVisible on and off with WM_KEYDOWN then WM_CHAR for typing. Just holding down Shift prior to typing a capital letter sets cursorIsVisible. This is more difficult to understand than a mode that lasts from the user starting typing until moving the mouse or performing a command. It could result in spurious showing of the cursor in unexpected situations since cursorIsVisible may be true when WM_SETCURSOR is received.

            It might be better to set cursorIsVisible in Editor::SetDocPointer as that occurs for some of the most important commands. There may be other circumstances that need setting cursorIsVisible.

            This feature still needs to define an API or access to system settings on non-Win32 platforms before there is a benefit to adding it.

             
  • johnsonj

    johnsonj - 2025-06-21

    I managed to build scite working.

    • Set or Get whether hiding mouse cursor or not while typing text.
    • Blank cursor is set (hidden) when any character is typed in.
    • Either mouse moving or buffer switching restores cursor to be normal (shown).
     
  • johnsonj

    johnsonj - 2025-06-21

    also needed!

     
    • Neil Hodgson

      Neil Hodgson - 2025-06-23

      With this change, typingWithoutCursor will revert to the system setting every time WM_SETTINGCHANGE is processed which may be for a wide range of conditions that occur during a run. This makes SCI_SETTYPINGWITHOUTCURSOR unreliable on Windows.

      There needs to be a clear plan on how to decide which source is authoritative: SCI_SETTYPINGWITHOUTCURSOR or WM_SETTINGCHANGE.SPI_GETMOUSEVANISH.

       
      • johnsonj

        johnsonj - 2025-06-23

        I prefer SCI_SETTYPINGWITHOUTCURSOR.

         
        • Neil Hodgson

          Neil Hodgson - 2025-06-23

          That is removing functionality that is wanted by other users.

           
          • johnsonj

            johnsonj - 2025-06-24

            SPI_GETMOUSEVANISH reflected!

             
          • johnsonj

            johnsonj - 2025-06-24

            for scintilla

             
            • Neil Hodgson

              Neil Hodgson - 2025-06-25

              Current behaviour should be preserved with cursor visible when typing as the default.
              Even when I go to the Windows settings and turn off "Hide pointer while typing", it still disappears. There will be upset users if this implementation is committed.

               
              • johnsonj

                johnsonj - 2025-06-26

                it defaults false

                 
              • johnsonj

                johnsonj - 2025-06-26

                for scite

                 
                • Neil Hodgson

                  Neil Hodgson - 2025-07-02

                  To avoid changing behaviour unexpectedly, SciTE should also default to no hiding or to hiding only on Win32.

                   
      • johnsonj

        johnsonj - 2025-06-23

        for scite

         

Log in to post a comment.

MongoDB Logo MongoDB