Git Product home page Git Product logo

Comments (15)

dbordak avatar dbordak commented on August 15, 2024

This might be possible, but it'd be pretty difficult. I've been considering it, but I was never really sure if there was much of a demand for this, besides the fact that it probably wouldn't work too well with an lhs+rhs.

Consider, any time any of the center-aligned segments changes length, they all move. With lhs/rhs, you sorta sort them in priority order -- only the buffer name and minor modes tend to change locations.

If you want it, though, I'll see if it'd be possible

from telephone-line.

ogdenwebb avatar ogdenwebb commented on August 15, 2024

Yeah, I really want to get this one. Even if centering doesn't stack well with lhs and rhs, an user can create only centered segments(if I understand your note about lhs+rhs correctly).

Consider, any time any of the center-aligned segments changes length, they all move.

Probably we need ability to create fixed-length segments in this case.

I don't know how much it will useful, but powerline for Emacs has ability to centering elements powerline-themes.el#L146

from telephone-line.

dbordak avatar dbordak commented on August 15, 2024

Ok, it's very rough, but I think I've got this working
centering-demo

It isn't documented yet, so here's how you can use it:

(setq telephone-line-center
        '((segment pairs...)
          center
          (segment pairs...)))

You need to put a center keyword in the middle (bare -- don't put it in a pair like everything else, this is no longer a proper alist) to mark where it switches from using right-separators to left-separators (left-right is reversed for appearance)

from telephone-line.

dbordak avatar dbordak commented on August 15, 2024

Things that don't work:

There's no concept of a center subseparator; there's nothing put where the 'center keyword shows up. You can see that in the example above between 0 and NO. I'm not going to add anything here, however; I think a space should be fine (otherwise, you can probably add your own graphic if you need -- it's not something I think I should automate anyway).

The center keyword doesn't necessarily end up in the center of the screen; the entire center supersegment will be centered, yes, but the left and right halves can be of any length; to center them, they'd need to be equal. I'm also not going to try to change this because forcing centering on the keyword would mean the supersegment isn't centered on unequal halves, which is just as bad.

EDIT: Basically, imagine you have length-4 stuff before the center keyword, and length-2 after it. I could handle it like this:
|..<****|**>..|
or like this:
|.<****|**>...|

In the former case, the entire <*|*> is centered, though the middle bar is not, and in the latter it's the opposite. I went with the former.

from telephone-line.

dbordak avatar dbordak commented on August 15, 2024

Right, and to give you a full example, here's what I had to generate the center in that screenshot above:

(setq telephone-line-center
        '((nil    . (telephone-line-misc-info-segment))
          (accent . (telephone-line-major-mode-segment))
          (evil   . (telephone-line-airline-position-segment))
          center
          (evil   . (telephone-line-evil-tag-segment))
          (accent . (telephone-line-vc-segment
                     telephone-line-erc-modified-channels-segment
                     telephone-line-process-segment))
          (nil    . (telephone-line-simple-minor-mode-segment
                     telephone-line-narrow-segment
                     telephone-line-simple-buffer-info-segment
                     telephone-line-simple-buffer-name-segment))))

from telephone-line.

dbordak avatar dbordak commented on August 15, 2024

I'm going to change the 'center keyword thing because it's a bit too magic. Either telephone-line-center will be a cons of the left and right halves of the center, or I'll split it into telephone-line-center-lhs and telephone-line-center-rhs. Opinion?

The latter would make it easier to customize in customize, but the former would probably internally be a cleaner interface. I think the latter is more idiomatic though?

from telephone-line.

ogdenwebb avatar ogdenwebb commented on August 15, 2024

Awesome. 👍

In the former case, the entire <|> is centered, though the middle bar is not, and in the latter it's the opposite. I went with the former.

Yes, the former is better for me too.

I'll split it into telephone-line-center-lhs and telephone-line-center-rhs. Opinion?

Imagine we have center-lhs and center-rhs, how to align only one segment in this case? If center-lhs and center-rhs will work with one segment, it's okay in my opinion. But as a user I want to put my segment in some variable and forget about them, i.e. I find their customization with two part of center segment a bit annoying. Not sure about customize, because I'm not using that.

from telephone-line.

dbordak avatar dbordak commented on August 15, 2024

Doing one segment, regardless of which method I use, is going to be ugly no matter what. You'll need to mirror it with a nil segment of the same color on the other side (this includes what I have right now -- you'd need to put a nil segment before/after the 'center). I have to do this so that there's some way of inserting two types of separators -- any way of automating that would be extremely complicated and magic, I think.

from telephone-line.

dbordak avatar dbordak commented on August 15, 2024

Oh right, that said, if you're not using a separator, or if your single centered segment is using nil for its color, then there's no need to mirror it.

from telephone-line.

dbordak avatar dbordak commented on August 15, 2024

I've decided on using telephone-line-center-(l/r)hs. I figure since it wasn't obvious to you that you (almost always) need both, it's better to make it more explicit that way. Doing a pair makes it somewhat more hidden.

from telephone-line.

ogdenwebb avatar ogdenwebb commented on August 15, 2024

I figure since it wasn't obvious to you that you (almost always) need both

I don't oppose using telephone-line-center-(l/r)hs, but it was a bit kinky at first glance. Now I can accept this. I mean no difference between just a single segment and segment with an extra segment for alignment in fact.

Though customization of segments is taking up a lot of time, so there's no point for me to be bothered about this split.

from telephone-line.

dbordak avatar dbordak commented on August 15, 2024

Well, the other thing is that keeping it this way means that customizing the center is as similar as possible to customizing the left and right. The first solution was an improper alist, which I don't like, and the other option was a pair of alists, which I think requires more explanation than the whole lhs/rhs thing.

Anyway, once the latest commit is up on MELPA, you should be good to go, I think.

from telephone-line.

dbordak avatar dbordak commented on August 15, 2024

Looks like it's up. Tell me when you try it out!

from telephone-line.

ogdenwebb avatar ogdenwebb commented on August 15, 2024

b3eaf4b works without any troubles for me. Thank you for your work! Also I'm glad that it works directly as telephone-line-lhs/rhs. 🍾

p.s. What's your Emacs font?

from telephone-line.

dbordak avatar dbordak commented on August 15, 2024

p.s. What's your Emacs font?

Iosevka, it's my favorite font https://be5invis.github.io/Iosevka/

from telephone-line.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.