bruiken / Notepad--

Notepad--, a lightweight web based editor with numerous optional features.
MIT License
3 stars 0 forks source link

Feature: Line numbers #8

Closed bruiken closed 3 years ago

bruiken commented 3 years ago

Implementation for Issue #6.

This implements basic line numbers at the left side of the editor. These line numbers are non-selectable and automatically scroll with the editor.

To make sure the feature works correctly with the highlighting feature, we had to make some edits to both the basic html template and the highlighting feature CSS.

The editor template now works with a new div which is of type display: flex. In this div, we can just show the normal textarea, or the textarea with the extra div for highlighting. But we can also first show a column for line numbers and then the editor. The textarea itself has flex-grow set to 1 so that it grows the rest of the horizontal space.

jwijenbergh commented 3 years ago

Works very well on my browser and machine :)

One thing to keep in mind though, is that without syntax highlighting the text still wraps (on firefox/chrome?). And with syntax highlighting it only wraps when there are multiple words, e.g. if it's not one long word.