tarkah / tickrs

Realtime ticker data in your terminal 📈
MIT License
1.16k stars 58 forks source link

Disable MouseCapture #72

Closed miraclx closed 3 years ago

miraclx commented 3 years ago

As at the moment of writing, (4ba57c0), tickrs always captures the mouse despite only needing to show cursor location in the debug information.

Only, this debug information only shows with the SHOW_DEBUG=1 env set

This effectively disallows all forms of text selection within tickrs whether in/out of debug mode.

Unless we can selectively enable capturing the mouse for certain parts of the interface (maybe on the graphs for future purposes), we probably shouldn't at all since we aren't actually using it.

At this point you can't actually "copy" debug information, you would have to manually retype it.

tarkah commented 3 years ago

Yeah, this is an artifact of me wanting to see if I could enhance the stock widget with mouse interactivity. I never got around to it. I'll probably go with #74. Hopefully one day I can figure out some sort of feature to get OHLCV data to display wherever the mouse is located on the chart.

miraclx commented 3 years ago

+1

I've been nursing the idea of having a custom widget for displaying an interactive candlestick chart, but that would have to depend on that OHLCV data

I doubt we can only capture the mouse on interaction with the chart, allowing selection everywhere else, that would've been cool.

tarkah commented 3 years ago

So I have the OHLCV data, just need to figure out how to display it. There is a Canvas widget, so it should be possible to draw rectangles and lines for the candlestick. The harder part is grouping the data appropriately to fit whatever width the terminal is set to. I kind of have that figured out with the volumes graph so maybe its not as hard anymore.

I doubt we can only capture the mouse on interaction with the chart, allowing selection everywhere else, that would've been cool.

Yeah, we can call those execute! commands for mouse capturing when switching to / off whatever mode has the candlestick widget. But anything else in view when that mode is active can't be selected, just not when the candlestick widget is in view.

miraclx commented 3 years ago

It's no hurdle, let's go!

miraclx commented 3 years ago

But anything else in view when that mode is active can't be selected, just not when the candlestick widget is in view.

we could maybe toggle chart selection with a special key, M (mouse), C (chart), ??, so you can dynamically switch between those mouse modes

Unless there's a fullscreen chart view where we can enable mouse exclusively, there's currently a chart on every pane, summary, and stock view.

So, there could be a candlestick chart in the summary view too.

In which "case", we'd need that key-bound toggle.

tarkah commented 3 years ago

Yeah I like the M hotkey to toggle mouse capture. I think it makes sense to also have a fullscreen view if candlestick is implemented to get as many pixels as possible towards rendering it. Then do some sort of overlay in the top left / right corner with the OHCLV data for wherever mouse position is at (this would be a phase 2 add).

I'm skeptical candlesticks would look like anything in summary view due to the restricted height. The min / max / median / Q1 / Q3 may all be within 1-2 "braille" dots of each other. But this is something I can easily test once I have the chart type figured out.

tarkah commented 3 years ago

FYI, I have a discussion around this from someone else who previously requested a candlestick chart. We should carry out further conversation there.

https://github.com/tarkah/tickrs/discussions/30