gphalkes / tilde

The Tilde text editor
395 stars 20 forks source link

Show line numbers #2

Open dario2994 opened 9 years ago

dario2994 commented 9 years ago

It would be nice to have the "Show line numbers" feature.

ulno commented 7 years ago

Especially when you turn on line wrapping, being able to see the line number sin beginning of line (like in mcedit) would be great.

magiblot commented 5 years ago

I second this.

tjaacks commented 4 years ago

I would love this feature as well.

gphalkes commented 4 years ago

Sounds like this will be the feature to work on once I finish the work on theming :-)

tfpk commented 3 years ago

Hi @gphalkes -- is this a feature that's being worked on (or that has been worked on)? I'd be interested in looking into it, but am not sure where to start..

gphalkes commented 3 years ago

This is not being worked on at the moment, and I would welcome your contribution.

As to where to start: ideally you would add another t3window::window_t (which is a rectangular screen area which can hold contents) to the implementation of the edit_window_t. You will also need to add a new bool variable there to allow enabling and disabling the feature. This will need to be mirrored in the edit_window_t::behavior_parameters_t::implementation_t. No need to implement it in the edit_window_t::view_parameters_t class though, as that is deprecated and should remain frozen.

Once you have that, you need to compute the size of the window in the relevant places and draw its contents. A good way to find the places you need to update is to look at the manipulation of the indicator_window window as that is similar to what you would need to do here. You would of course also need to modify the size of the edit_window to make room for the new window.

If that is all complete, then wiring up the options in tilde itself and providing the UI is needed. I can give you some hints there as well, if you like, but you can probably copy what is done for e.g. tab_spaces as that is another boolean variable for the edit_window_t class.

tfpk commented 3 years ago

Hi @gphalkes ,

Thanks for the summary above -- I've been slowly working through it; though I'll admit my cpp is pretty rusty (and I've been quite busy) so it's been slower than I'd otherwise want.

I've managed to, so far:

I'm now trying to use addstr inside window_t to add text; but it won't allow me to use newlines. I'm wondering if this is something to do with the underlying implementation (either in t3window, or curses itself)?

Is there a better method for adding text to the window (a text_buffer_t, perhaps?). Or anywhere else that has a similar challenge I can borrow from?

Thanks so much!

~tfpk

Dkurupp commented 1 year ago

Any updates on this ticket? I have just installed tilde and loving it, but showing line numbers is quite an important one for me ...

Thebinoman commented 6 months ago

+1 !!!

l-pastor commented 6 months ago

I really like this editor, but it really lacks line numbering.