Menu

#92 cursor blinking speed

Next_Nightly
fixed
ollydbg
2016-01-30
2014-11-14
Clay S
No

ability to set the cursor blink speed higher than 500 ms its too fast

Discussion

  • ollydbg

    ollydbg - 2014-11-15

    Yes, I also think it was too fast.

     
  • Teodor Petrov

    Teodor Petrov - 2014-11-15

    ollydbg: Would you do it?

     
  • ollydbg

    ollydbg - 2014-11-17

    I extended to 1500ms, but I see the caret does not blink correctly compared with Windows native notepad.exe. Maybe, it is a scintilla bug.

    src/src/resources/editor_configuration.xrc | 2 +-
     1 file changed, 1 insertion(+), 1 deletion(-)
    
    diff --git a/src/src/resources/editor_configuration.xrc b/src/src/resources/editor_configuration.xrc
    index 3db3e60..510b516 100644
    --- a/src/src/resources/editor_configuration.xrc
    +++ b/src/src/resources/editor_configuration.xrc
    @@ -874,7 +874,7 @@
                                                    <object class="sizeritem">
                                                        <object class="wxSlider" name="slCaretPeriod">
                                                            <value>500</value>
    -                                                       <max>500</max>
    +                                                       <max>1500</max>
                                                            <style>wxSL_LABELS|wxSL_TOP</style>
                                                        </object>
                                                        <flag>wxEXPAND|wxALIGN_LEFT|wxALIGN_TOP</flag>
    
     
    • ollydbg

      ollydbg - 2014-11-18

      This is patch can be abandoned, since it doesn't solve the core issue, my later patch should fix the issue.

       
  • ollydbg

    ollydbg - 2014-11-17

    I also test the windows version of SciTE, if I change the caret.period=1000 (in SciTEGlobal.properties), it also blink correctly, so it is a bug in wxScintilla or in our cbEditor.

     
  • Teodor Petrov

    Teodor Petrov - 2014-11-17

    Probably it is wxscintilla related bug. If you have time it will be best if you can test the same thing in wxstc.

     
  • ollydbg

    ollydbg - 2014-11-18

    When reading and debugging the code, I see the multiply timers were introduced in the merge of the Scintilla 3.5.0 branch.
    I see the multiply timers (wxTimer* timers[tickDwell+1];) are conflict with the wxSCITimer, this is the only usage of SCITimer, do we need them?
    Or, shall we need the multiply timers here?

    void ScintillaWX::SetTicking(bool on) {
        wxSCITimer* sciTimer;
        if (timer.ticking != on) {
            timer.ticking = on;
            if (timer.ticking) {
                sciTimer = new wxSCITimer(this);
                sciTimer->Start(timer.tickSize);
                timer.tickerID = sciTimer;
            } else {
                sciTimer = (wxSCITimer*)timer.tickerID;
                sciTimer->Stop();
                delete sciTimer;
                timer.tickerID = 0;
            }
        }
        timer.ticksToWait = caret.period;
    }
    

    Here is the patch to fix this issue, it works fine here under my Windows XP.

     src/sdk/wxscintilla/src/ScintillaWX.cpp | 9 ++-------
     1 file changed, 2 insertions(+), 7 deletions(-)
    
    diff --git a/src/sdk/wxscintilla/src/ScintillaWX.cpp b/src/sdk/wxscintilla/src/ScintillaWX.cpp
    index da1538c..ef647e6 100644
    --- a/src/sdk/wxscintilla/src/ScintillaWX.cpp
    +++ b/src/sdk/wxscintilla/src/ScintillaWX.cpp
    @@ -411,14 +411,9 @@ void ScintillaWX::SetTicking(bool on) {
         if (timer.ticking != on) {
             timer.ticking = on;
             if (timer.ticking) {
    -            sciTimer = new wxSCITimer(this);
    -            sciTimer->Start(timer.tickSize);
    -            timer.tickerID = sciTimer;
    +            FineTickerStart(tickCaret, caret.period, caret.period/10);
             } else {
    -            sciTimer = (wxSCITimer*)timer.tickerID;
    -            sciTimer->Stop();
    -            delete sciTimer;
    -            timer.tickerID = 0;
    +            FineTickerCancel(tickCaret);
             }
         }
         timer.ticksToWait = caret.period;
    

    Not sure other platform's result.

     
  • Teodor Petrov

    Teodor Petrov - 2014-11-18

    I don't know, you should probably talk to the scintilla maintainers about this. Or see if wx guys have fix similar issue recently.

     
  • ollydbg

    ollydbg - 2014-11-18

    It is related to the wxWidgets port of the scintilla control, I looked at the wx trunk head, they don't have the multiply timers implementation in their wxScintilla(wxSTC), I think those improvements were done by Morten, so I wrote an email to Morten to ask his help.

     
  • ollydbg

    ollydbg - 2014-11-18

    Look at code of scintilla implementation for different platforms in scintilla's Mercurial code repo. I see that many platform use the multiply timers, but the SetTicking() is deprecated and never used any more, so I think we should not use this function call either.

    void ScintillaWX::DoLoseFocus(){
        focusEvent = true;
        SetFocusState(false);
        focusEvent = false;
    /* C::B begin */
        SetMouseCapture(false);
    /* C::B end */
        DestroySystemCaret();
        SetTicking(false);
    }
    
    void ScintillaWX::DoGainFocus(){
        focusEvent = true;
        SetFocusState(true);
        focusEvent = false;
        DestroySystemCaret();
        CreateSystemCaret();
        SetTicking(true);
    }
    

    Now, I see that the SetFocusState() function already modify the caret status in ShowCaretAtCurrentPosition() and DropCaret().

    void Editor::SetFocusState(bool focusState) {
        hasFocus = focusState;
        NotifyFocus(hasFocus);
        if (hasFocus) {
            ShowCaretAtCurrentPosition();
        } else {
            CancelModes();
            DropCaret();
        }
    }
    

    So, just comment out all the function call of SetTicking() in the ScintillaWX.cpp. It also works fine.

     
  • Clay S

    Clay S - 2014-11-18

    thanks ollydbg, seemed like alot of work for something silly but it really does make a difference when your staring at it.

     
  • ollydbg

    ollydbg - 2014-11-29

    Commit the fix now.

     
  • ollydbg

    ollydbg - 2014-11-30
    • labels: gui --> gui, wxScintilla
    • status: open --> fixed
    • assigned_to: ollydbg
    • Milestone: Next Release --> Next Nightly
     

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.