From e079c4b168e50dbcbe8038abcc6f8e88303e0b2d Mon Sep 17 00:00:00 2001 From: Marijn Haverbeke <marijnh@gmail.com> Date: Wed, 26 Sep 2012 13:41:36 +0200 Subject: [PATCH] Add cursorHeight option --- doc/manual.html | 7 +++++++ lib/codemirror.js | 3 ++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/manual.html b/doc/manual.html index 3d1cb921..f40bee2d 100644 --- a/doc/manual.html +++ b/doc/manual.html @@ -222,6 +222,13 @@ <dd>Half-period in milliseconds used for cursor blinking. The default blink rate is 530ms.</dd> + <dt id="option_cursorHeight"><code>cursorHeight (number)</code></dt> + <dd>Determines the height of the cursor. Default is 1, meaning + it spans the whole height of the line. For some fonts (and by + some tastes) a smaller height (for example <code>0.85</code>), + which causes the cursor to not reach all the way to the bottom + of the line, looks better</dd> + <dt id="option_workTime"><code>workTime, workDelay (number)</code></dt> <dd>Highlighting is done by a pseudo background-thread that will work for <code>workTime</code> milliseconds, and then use diff --git a/lib/codemirror.js b/lib/codemirror.js index 12918562..2764f168 100644 --- a/lib/codemirror.js +++ b/lib/codemirror.js @@ -576,7 +576,7 @@ window.CodeMirror = (function() { var pos = headPos = cursorCoords(cm, sel.from, "div"); display.cursor.style.left = pos.left + "px"; display.cursor.style.top = pos.top + "px"; - display.cursor.style.height = (pos.bottom - pos.top) * .85 + "px"; + display.cursor.style.height = (pos.bottom - pos.top) * cm.options.cursorHeight + "px"; display.cursor.style.display = ""; display.selectionDiv.style.display = "none"; @@ -2475,6 +2475,7 @@ window.CodeMirror = (function() { readOnly: false, dragDrop: true, cursorBlinkRate: 530, + cursorHeight: 1, workTime: 100, workDelay: 200, pollInterval: 100, -- GitLab