porcupine icon indicating copy to clipboard operation
porcupine copied to clipboard

Line length marker in your face (opacity and Z-index)

Open ThePhilgrim opened this issue 1 year ago • 8 comments

As seen in the screenshot below, the line length marker covers the code, and the opacity 1 makes it way too prominent. This seems to be the same for all pyments styles I've tried.

~~Note: Potentially only an issue on Mac.~~

Screenshot 2023-07-07 at 19 25 10

ThePhilgrim avatar Jul 07 '23 17:07 ThePhilgrim

Some ways to disable the line length marker:

  • Project-specific: set max_line_length = 0 or max_line_length = -1 in editorconfig (not sure what other editors do, this doesn't seem to be specified in editorconfig spec)
  • All Python files: max_line_length = 0 or max_line_length = -1 in filetypes.toml
  • Always: Disable the plugin

Tkinter doesn't really know what opacity is, but we could change the color of the marker to be closer to the background color with e.g. utils.mix_colors() (and make sure to update the color whenever the user changes their pygments style).

Akuli avatar Jul 07 '23 17:07 Akuli

Maybe the entire marker is off by one pixel or so? Not sure. I'm looking at this part of your screenshot:

s

Akuli avatar Jul 07 '23 17:07 Akuli

@Akuli Is there a Z-index in tkinter? Or can we in some way set the line behind the code?

ThePhilgrim avatar Jul 07 '23 19:07 ThePhilgrim

As far as I know there's no good way to place a line between the background and the text, apart from turning the entire text widget into a Canvas which is really not something I want to do.

The text widget doesn't really support anything marker-related at all. The marker is a 1px wide frame placed on top of the text widget.

Akuli avatar Jul 07 '23 19:07 Akuli

Alpha?

Moosems avatar Jul 08 '23 00:07 Moosems

Alpha is only a thing on Tk and Toplevel, so if we use that, the line length marker would work by creating a 1px wide window on top of the Porcupine window. The minimap plugin used to work this way, but it caused problems for some users and I don't want to try it again.

Akuli avatar Jul 08 '23 09:07 Akuli

It definitely is one pixel to the right but otherwise it seems to be fine.

Moosems avatar Jul 08 '23 14:07 Moosems

Another way to see it is the idea was to tell when a line is too long so if it's covering code that's your issue due to maintaining such long lines.

Moosems avatar Jul 08 '23 14:07 Moosems