mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-10 18:24:09 +03:00
Gutter adjusts its width to account for the width of the last line number
This commit is contained in:
parent
7a82bf2679
commit
0e09659d79
@ -558,6 +558,15 @@ describe "Editor", ->
|
||||
expect(editor.gutter.find('.line-number:first').text()).toBe "2"
|
||||
expect(editor.gutter.find('.line-number:last').text()).toBe "7"
|
||||
|
||||
describe "width", ->
|
||||
it "sets the width based on last line number", ->
|
||||
expect(editor.gutter.lineNumbers.outerWidth()).toBe editor.charWidth * 2
|
||||
|
||||
it "updates the width when total number of lines gains a digit", ->
|
||||
oneHundredLines = [0..100].join("\n")
|
||||
editor.insertText(oneHundredLines)
|
||||
expect(editor.gutter.lineNumbers.outerWidth()).toBe editor.charWidth * 3
|
||||
|
||||
describe "when wrapping is on", ->
|
||||
it "renders a • instead of line number for wrapped portions of lines", ->
|
||||
editor.setMaxLineLength(50)
|
||||
|
@ -17,4 +17,6 @@ class Gutter extends View
|
||||
@lineNumbers[0].innerHTML = $$$ ->
|
||||
for row in rows
|
||||
@div {class: 'line-number'}, if row == lastScreenRow then '•' else row + 1
|
||||
lastScreenRow = row
|
||||
lastScreenRow = row
|
||||
|
||||
@lineNumbers.width(editor.getLastScreenRow().toString().length * editor.charWidth)
|
||||
|
Loading…
Reference in New Issue
Block a user