laurent22 / joplin

Joplin - the privacy-focused note taking app with sync capabilities for Windows, macOS, Linux, Android and iOS.
https://joplinapp.org
Other
45.1k stars 4.9k forks source link

Cursor blink rate ignores system settings on MacOS #2312

Open timmb opened 4 years ago

timmb commented 4 years ago

MacOS provides two global preferences to control the blink rate of the cursor when editing text:

It's particularly important for people like me who find it nearly impossible to focus while there is animation on the screen. On my system I have the On period set to 999999ms and the Off set to 0ms.

Environment

Joplin version: 1.0.175 Platform: macOS 10.14.6 OS specifcs: macOS

Steps To Reproduce

  1. Open Terminal
  2. Enter these two commands
  3. defaults write -g NSTextInsertionPointBlinkPeriodOn -float 999999 defaults write -g NSTextInsertionPointBlinkPeriodOf -float 0
  4. Log out and log back in again.
  5. Focus on the editor of a new note.

Describe what you expected to happen: The text cursor should remain a solid bar.

What actually happens: The text cursor (a.k.a. the caret / text-insertion-point) blinks (i.e. it appears and disappears every half a second).

Logfile

Let me know if a log file would be helpful and I'll upload one.

timmb commented 4 years ago

This issue and commit in Electron may be relevant.

tessus commented 4 years ago

We switched to Electron 7 lately, but only in the pre-release. It will be available in the next release.

timmb commented 4 years ago

Unfortunately this issue has not been resolved in v1.0.178, which includes #2314 (Update Electron to 7.1.9).

timmb commented 4 years ago

Anyone looking to stop the cursor blinking in the short term can add this to the userstyles.css ('Custom stylesheet for Joplin-wide app styles' in the Appearance tab of preferences):

.ace_cursor-layer:not(.ace_hidden-cursors) .ace_cursor {
    opacity: 1 !important;
}
tessus commented 4 years ago

@timmb great workaround. maybe you want to post this in https://discourse.joplinapp.org/t/share-your-css/1730/16

I'm sure others would love this. I doubt that many people read issues on gh. Most people don't search before they open a new one, let alone just read issues for fun.

Since we have upgraded Electron and it still does not work, maybe it's also a problem with the editor. Or the problem was not fixed properly. Any chance you could open separate issues with ace and electron?

I really doubt that we can fix this problem within the Joplin code.

timmb commented 4 years ago

Thanks @tessus - I've posted the CSS workaround.

There does actually appear to be an option in ACE editor to stop the cursor from blinking - see here. However, it doesn't appear to be an option to set the rate of the blink which is what most OSes seem to define so I can understand if it doesn't make sense for Joplin to set this value in ACE by testing the OS cursor blink speed.

bboles commented 4 years ago

One issue with the workaround provided by @timmb is that it for sure stops the cursor from blinking but also makes it so that the cursor covers up the character behind it (not surprising since it works by making the cursor completely opaque). I have "Keyboard Mode" set to "Vim" so this kinda makes this workaround unusable for me since I can't see what is under the cursor. It may seem nit-picky, but it is disruptive. Any update on getting this fixed correctly?

otterlover24 commented 3 years ago

Anyone looking to stop the cursor blinking in the short term can add this to the userstyles.css ('Custom stylesheet for Joplin-wide app styles' in the Appearance tab of preferences):

.ace_cursor-layer:not(.ace_hidden-cursors) .ace_cursor {
  opacity: 1 !important;
}

Think my version of Joplin on Windows 10 Pro uses CodeMirror. Version info below:

Joplin 1.5.11 (prod, win32)

Client ID: ee8410e0820746f89e8159576661520e Sync Version: 2 Profile Version: 34 Keychain Supported: Yes

Revision: c158878b6 (master)

I looked at the DevTools panel and searched around for "cursor", and tried the following in my userchrome.css:

.CodeMirror-cursor .cm-fat-cursor div.CodeMirror-cursors .cm-fat-cursor-mark .cm-animate-fat-cursor{
    opacity: 1 !important;
    animation: none !important;
}

However, my cursor is still blinking. Any idea what I'm missing here?

Any idea what I'm missing?

cowabungaa commented 3 years ago

The following workaround works for me

Joplin 2.3.5 (prod, linux)

div.CodeMirror-cursors {
  visibility: visible !important;
}
bboles commented 3 years ago

Thanks @cowabungaa , that also worked for me on MacOS 11, Joplin 2.3.5 with Vim Mode turned on. Cursor doesn't blink and I can also see the character under the cursor.