Comments (8)
This is definitely something I want. It's a difficult problem, though, and I'm not sure how to do it efficiently. Yet.
from telephone-line.
Is the difficulty with implementing the code in an efficient manner or is it with writing an effective interface for the feature? I don't really have much to contribute either way, I'm just curious.
from telephone-line.
Figuring out how large a segment is requires rendering it. In order to figure out whether to collapse a given segment, you'd need to find out how big every other segment is. So, this would require doubling the amount of rendering going on.
...However, it's not as bad as it sounds, since empty segment detection already involves duplicated rendering. There's still logic on top of that, though...
from telephone-line.
I wonder if you could take a page from css and just give pixel minimums. Leave it up to the user to specify at which point each section gets removed from the mode line. I would be happy to just add an integer to each section which is minimum width in pixels or some such. I don't think it's necessary to over engineer the problem. That's just my two cents though.
from telephone-line.
Do you mean a maximum width?
Pixel count is actually really difficult to do. Luckily we're dealing in fixed-width fonts, though, so we can do character count. It'd be trivial to add truncation past a certain max, but that isn't really intelligent.
EDIT: Oh, do you mean a minimum amount of space you'd need to render the segment? So if there's not enough room, just skip it? This is what I was originally thinking of.
from telephone-line.
Haha words suck. What I was thinking is to add a number associated with each section which is the width, probably in characters sounds like, at which point for any width of the window smaller than that width, the section will not render.
Said differently, it is the minimum width of the window that a given section will display in. In many ways this might be sufficient for the majority of sections because they often have a constant width. Even more interesting would be to let the user specify a function which returns the width of the section. I would guess that usually the width could be known ahead of time without having to render the whole thing. Then taking that information it would be trivial to add a priority for what sections are more important to be included than others.
I could be completely mistaken though, as I haven't had the time to dig in to the code 😄.
from telephone-line.
Yeah, the rub is still that to find out how much space you have available, you need to check all the other ones... For some cases, true, you can easily figure out what it'll be. For others, it's highly variable (e.g. minor modes).
My original thought would be to attach a number for priority -- if there's not enough room to fit the whole thing, the segment with the lowest priority is booted first.
from telephone-line.
Smart mode line does something like this.
https://github.com/Malabarba/smart-mode-line
from telephone-line.
Related Issues (20)
- Customize problems
- Support for changing font size HOT 5
- Feature request (and sample solution): Evil-like indicator for buffer modified state HOT 1
- Separator not rendering correctly when window is inactive. HOT 2
- Org-clock segment possible? HOT 1
- Rendering errors HOT 1
- Gap after airline segment HOT 3
- Optionally don't render segments if they are empty? HOT 1
- The mode line cannot display color
- hud segment rendering errors in terminal Emacs HOT 1
- Add support for project.el ? HOT 5
- Looking to apply airline-theme colors using telephone-line
- How can suppress the smiley face (`: )`) on the right corner?
- I'm too dumb: passing arguments to segments? HOT 3
- Some `mode-line` elements do not respect `telephone-line-accent-active`
- Error during redisplay: (eval (telephone-line-separator-render telephone-line-gradient
- Support for colors when using meow
- Right margin incorrect for proportional-width fonts
- Telephone line is slow to update HOT 1
- `(fn FACE)"]) telephone-line-tan-hollow-right 'evil)) signaled (wrong-type-argument number-or-marker-p nil)`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from telephone-line.