codejar icon indicating copy to clipboard operation
codejar copied to clipboard

[WIP] Improve line numbers feature & better carriage return compatibility

Open sirkadirov opened this issue 5 years ago • 7 comments

DONE:

  • Fix line counting issue
  • Disable line numbers selection
  • Temporary disable line numbers background
  • Force X and Y overflow when using line numbers
  • Make line numbers bar scrollable
  • Improve line breaks (use universal \r\n instead of \n

TODO:

  • Try to fix #19
  • Try to fix #22
  • Static line numbers bar (now broken) - help needed
  • Implement current line highlighting
  • Look for breaking changes

Work in progress - do not merge 😅! Comments and suggestions welcome.

sirkadirov avatar Jul 10 '20 12:07 sirkadirov

Awesome! 👏 Also, it will be cool to have something online to see how your changes work. Maybe in playground.

antonmedv avatar Jul 10 '20 13:07 antonmedv

@antonmedv Sure, I'll make a demo later. Any ideas on good online playground? :)

sirkadirov avatar Jul 11 '20 11:07 sirkadirov

I usually upload everything to my site.

antonmedv avatar Jul 11 '20 13:07 antonmedv

So any news?

antonmedv avatar Dec 01 '20 21:12 antonmedv

Any progress?

antonmedv avatar Dec 05 '20 20:12 antonmedv

Static line numbers bar (now broken) - help needed

Line numbers were fixed in this commit.

Improve line breaks (use universal \r\n instead of \n)

I'm not savvy enough to know when Windows line endings are universally preferred over Unix line endings, but if Unix line endings are kept, then this regex can be simplified to:

code.split(/\n/).length + (code.endsWith('\n') ? 0 : 1)

Either way, it fixes the issue where line numbers aren't added to the end of the editor.

@antonmedv Here are before and after gif's. Observe the line numbers as new lines are added. The first gif was captured using the latest master branch and second gif was captured with the regex fix:

before_fix after_fix

hgs3 avatar Dec 28 '20 16:12 hgs3

Any progress? Someone what to continue from this PR?

antonmedv avatar Jun 26 '21 11:06 antonmedv