Project

General

Profile

unexist.dev

Assorted tidbits and projects

REQUEST: Exact screen coordinates for grid instead of percentages...

Added by Phil Thompson about 12 years ago

...or decimal percentages.

I know in the sublte.rb comments it says percentages are used to make grids work on any monitor but in all my use cases I'm dealing with a single display area.

So the problem with integer percentages - gaps.

It's impossible to make the grids use all the space with percentages. It's easy to see when using the default grid and setting two windows to use 33% and 66% (vertically with the default config). Changing the percentages to floats may help but I think pixels would be a more accurate solution. It's especially important on really high res setups where 1% is like 35 pixels.

Any chance this is something you'd be able to implement?


Replies (3)

RE: REQUEST: Exact screen coordinates for grid instead of percentages... - Added by Christoph Kappel about 12 years ago

Technically that would be possible and no big deal, when I consider the codebase.

BUT that might not work out like you expect, especially with windows that have size constraints like the average terminal. They usually prefer full column and rows instead of fractions of it. I thought about decimal places, but discard the idea, because it is as unreliable as the current system. Just wastes more memory.

One major problem is the config, I have no idea how I should distinguish in the config case syntax-wise. Any suggestions?

RE: REQUEST: Exact screen coordinates for grid instead of percentages... - Added by Phil Thompson about 12 years ago

Yeah good point on the terminal windows but I think a few of them have options that allow you to switch between absolute sizing and fixed cursor height/width these days.

Syntax-wise a couple of ideas spring to mind.

1. Like CSS: "55px" for example. The most flexible as you can mix and match but probably a bit more work for the string splitting.
2. Have an option in the config to indicate whether the dimensions are in percentages or pixels. Less flexible but I can't think of a reason why I'd want to use both pixels and percentages in the same grid setup.

RE: REQUEST: Exact screen coordinates for grid instead of percentages... - Added by Christoph Kappel about 12 years ago

Well, there are some weird patches like the one for urxvt, I just deal with the gaps and applied a even bigger one so that there's always a gap. ;)

1. String splitting would be easy, actually it is worse: The config is plain ruby and '55px' woud be a method call of a method named '55px' and I'd have to use metaprogramming to catch this. And '55%' would be worse. Sizes in quotes could work, but syntax-wise horrible..

2. I barely see why you need absolute values, but trust me people want to mix that, when both percentage and absolute values are possible.

The current format doesn't allow so many ways to specifiy it.

gravity :foobar, [ 100, 100, 100, 100 ]

I could add methods to Numeric to allow e.g. '100.px' or '100.percent', but hacking base classes is gruesome.

    (1-3/3)