Commit Graph

2760 Commits

Author SHA1 Message Date
Kim Silkebækken d3bace24ec Improve the Segment class and rendering
The Segment class has been given two new properties: priority and
filler. The render method has been given a width argument.

If the width argument is specified when rendering a segment and the
rendered segments are too wide, segments are dropped in order of
priority, with the lowest priority (highest number) being dropped first
and any segment with priority < 0 is kept, regardless of the specified
width.

If the width argument is specified along with one or more filler
segments, the filler segments will pad the remaining space with space
characters until the desired width has been reached.

The handling of segment attributes has also been improved by lazily
looking up the correct attributes in the segment tree when it's being
rendered.

Finally, the rendering code itself has been improved a bit with less
code duplication and much more readable code.
2012-11-14 12:02:49 +01:00
Kim Silkebækken 21a48e997a Move vimscript hl statement generation to vim renderer 2012-11-12 13:11:19 +01:00
Kim Silkebækken f47dc4bffd Change wording: separator -> divider 2012-11-08 15:01:47 +01:00
Kim Silkebækken b461ab1358 Create basic vim segment renderer
This commit also includes a basic proof-of-concept demo for creating vim
statuslines. When creating vim statuslines you basically need to first
create the statusline the same way as the terminal demo, use the vim
renderer and then afterwards loop through the collected highlight groups
in the vim renderer and write those as vim highlight statements.

Vim obviously needs a ton of wrapper code to make everything work
properly (separate modes, callbacks, all that stuff) so the current demo
only shows some basic statusline highlighting.
2012-11-08 14:05:48 +01:00
Kim Silkebækken 20892b14d8 Fix default segment attribute value 2012-11-08 14:05:16 +01:00
Kim Silkebækken 59a760c3c6 Join the fg/bg/attr methods of the renderers
This change joins the fg/bg/attr methods into a single hl method in the
renderers. This provides the same functionality, and it simplifies the
terminal rendering by being able to join all the attributes into one
escape sequence.

It's also a necessary change for the vim renderer, as this renderer
needs to log all the highlighting and create separate highlighting
classes for every single color and attribute combination. The only way
to do this is to have a single highlighting method.
2012-11-08 13:16:22 +01:00
Kim Silkebækken ffbdcc0f75 Fix soft separator issue with vim divider segments 2012-11-08 12:51:15 +01:00
Kim Silkebækken 99ded1d0c6 Add vim statusline example
This is currently rendered with the terminal renderer, and is just
a simple proof-of-concept of how vim statuslines can be defined with the
Python API.
2012-11-08 12:44:46 +01:00
Kim Silkebækken cf88b086c0 Add initial project files 2012-11-08 12:23:57 +01:00
Kim Silkebækken adb67e1e1f Initial commit 2012-11-08 11:12:49 +01:00