mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Make react cursor the width of a default character at the end of lines
When the cursor is positioned before a character, we always make it the width of that character. But at the end of a line, there is no character to use to set the width, so we just use the defaultCharWidth. This makes the block cursor visible on empty lines in vim-mode.
This commit is contained in:
@@ -6,10 +6,11 @@ CursorComponent = React.createClass
|
||||
displayName: 'CursorComponent'
|
||||
|
||||
render: ->
|
||||
{editor, screenRange, scrollTop, scrollLeft} = @props
|
||||
{editor, screenRange, scrollTop, scrollLeft, defaultCharWidth} = @props
|
||||
{top, left, height, width} = editor.pixelRectForScreenRange(screenRange)
|
||||
top -= scrollTop
|
||||
left -= scrollLeft
|
||||
width = defaultCharWidth if width is 0
|
||||
WebkitTransform = "translate3d(#{left}px, #{top}px, 0px)"
|
||||
|
||||
div className: 'cursor', style: {height, width, WebkitTransform}
|
||||
|
||||
Reference in New Issue
Block a user