jonashaag / klaus

docker run klaus / pip install klaus — the first Git web viewer that Just Works™.
http://klausdemo.lophus.org
Other
685 stars 101 forks source link

Highlight lines of code #263

Open district10 opened 3 years ago

district10 commented 3 years ago

Currently, klaus supports hightlight one line, e.g. http://klausdemo.lophus.org/~jonashaag/klaus/blob/master/setup.py#L-18

Could it be possible to support range selection like on Github: https://github.com/jonashaag/klaus/blob/master/setup.py#L18-L27 (hold shift to select lines)

Thank you.

jonashaag commented 3 years ago

Yes, if anyone wants to work it that would be great!

castellanprime commented 3 years ago

Hi, I would like to work on this feature. Based on the request, I am trying to decide between two approaches: (a) A new query string parameter (selections). This allows us to keep the previous single selection instead of overloading the single selection (b) Overloading the single selection, with something like http://klausdemo.lophus.org/~jonashaag/klaus/blob/master/setup.py#L-18&L-27.

Are this approaches sufficient or is there an approach that would be preferable, in line with the structure of the project.

jonashaag commented 3 years ago

Nice! Can we make it like GitHub?

castellanprime commented 3 years ago

Oh. Okay. I will look into making it like Github. Thanks.

castellanprime commented 3 years ago

I am sorry if this question sounds foolish. I wanted to ask how the testing in this project is normally done. I am trying to manually test, that is, view some kind of log of the variables but I am so far unable to do so. First, (a) I tried using pdb but pdb never reaches the breakpoint I set in views.py. (b) I tried to using python logging, but the logs are not showing up, Coming from Tornado, i would normally disable the tornado.access module to get the logs that I want, but I do not know module to disable for Flask. My only recourse now is to write a "unit test" to test my changes. Is my situation unique and if so, how do I go about resolving it? Thanks.

jonashaag commented 3 years ago

How do you start Klaus exactly? If you use the CLI the logs should show up in the terminal. Flask also has a very nice debugger. You can also start Klaus using another WSGI server if you want.

castellanprime commented 3 years ago

I normally start it with the cli, like klaus [dir1] ... What i wanted to was to print not the request logs, the actual application logs. That is, if I put a print statement in the views.py, I want to see it in the consoie logs as well.

jonashaag commented 3 years ago

That should be exactly what’s happening by default. Are you sure your changes are even effective? Maybe the CLI loads the Klaus modules from some other path outside of the Git checkout? (eg installed with pip)