MIME type names are inconsistent across different systems, so only first
component is used. For example, `file` in Travis Ubuntu detects Python scripts
as `text/x-java`, in Gentoo these are `text/x-python`.
Travis Ubuntu also uses magic file format different from the one
sys-apps/file-5.22 from Gentoo has, making it impossible to fix the issue by
just copying the files from my system.
This commit refactors `TestVim` test class in test_configuration so that
1. `test_environ_update` does not leave state (value of `powerline_config_paths`
global Vim variable) behind other tests can use.
2. `test_local_themes` does not rely on state left from `test_environ_update`,
instead using new facility for providing needed value of
`Powerline.get_config_paths` call. This facility will be used later in BAR
tests.
Ref #1256
Reasoning:
1. vt* TERMs (used to be vt100 here) make tmux-1.9 use different and identical
colors for inactive windows. This is not like tmux-1.6: foreground color is
different from separator color and equal to (0, 102, 153) for some reason
(separator has correct color). tmux-1.8 is fine, so are older versions
(though tmux-1.6 and tmux-1.7 do not have highlighting for previously active
window) and my system tmux-1.9a.
2. screen, xterm and some other non-256color terminals both have the same issue
and make libvterm emit complains like `Unhandled CSI SGR 3231`.
3. screen-256color, xterm-256color and other -256color terminals make libvterm
emit complains about unhandled escapes to stderr.
4. `st-256color` does not have any of the above problems, but it may be not
present on the target system because it is installed with x11-terms/st and
not with sys-libs/ncurses.
For the given reasons decision was made: to fix tmux-1.9 tests and not make
libvterm emit any data to stderr st-256color $TERM should be used, up until
libvterm has its own terminfo database entry (if it ever will). To make sure
that relevant terminfo entry is present on the target system it should be
distributed with powerline test package. To make distribution not require
modifying anything outside of powerline test directory TERMINFO variable is set.
If somebody needs to readd it he should make better code, specifically:
- Functions and variables necessary for supporting Control-P need to be defined
in a separate initialiazation function that is only called if Control-P was
found.
- Segments that show different information must be defined as separate segments
that may be put into configuration file.
- Segment functions must not know side they are on.
- Segment functions must not emit `priority`, it must go to configuration file.
- Segment functions must have proper documentation.
- Segment functions must not emit `width` and `align` keys.
- String `Loading...` or the equivalent must be overridable from configuration,
same for other interface strings (e.g. what is shown when `regex` is true).
- Segment functions must have names that make it clear what they emit.
Closes#1244
If pyuv watcher is installed then powerline.lib.vcs tests do not pass because
pyuv is missing notify events and INotify watcher is not available.
Ref #1041
Equivalent to airline csv Christian Brabandt plugin integration, but uses Python
own facilities.
Note: filetype detection is out of the scope of the powerline responsibilities.
CSV is supported by powerline, but only as long as filetype detection is
done by Vim correctly. By default CSV files are neither detected nor
highlighted.
Some known differences between powerline code and @chrisbra plugin with
corresponding airline integration:
1. Detection work differently. I cannot say which is better because I have not
tested it much, but it is definitely different.
2. My variant is able to detect whether there is (no) header. (Of course,
relying on Python code.) Airline is using a setting. (Both do not allow
manual per-filetype setting.) Of course, user can force either variant (no
headers at all or headers always).
3. My variant makes it possible to configure header output format, including
truncating it at 15 characters (the default).
4. CSV plugin does not work with multiline CSV items (in some dialects one can
use code like `abc;"I<CR>am<CR>multiline<CR>string"`). See `:h csv-column` on
how to fix this if possible (will require also changing `<sid>WColumn`
function because currently it only works with one line).
5. AFAIK Python does not such a thing as “fixed width CSV”. Thus I do not work
with this, but CSV plugin does. Not sure whether it is different with
space-separated CSV files though.
Note: some modules (i.e wthr and bat) have their names in order to avoid the
situation when module name matches segment name:
import powerline.segments.common.weather
will import weather segment because `powerline.segments.common` contains line
`from powerline.segments.common.weather import weather`.
Fixes#1083
Consider the following script:
% powerline-daemon -s powerline-test
% powerline --socket powerline-test -p/dev/null shell left
Config file not found in search paths (/dev/null): config.json
% powerline --socket powerline-test shell left
Config file not found in search paths (/dev/null): config.json
Note the problem: second call to powerline does not use offending path, but it
still emits the error “Config file not found in search paths”.
According to the documentation and linter `'highlight_group': 'string'` was not
correct even at the current stage, but it worked. This commit fixes this
situation.
Now imports follow the following structure:
1. __future__ line: exactly one line allowed:
from __future__ import (unicode_literals, division, absolute_import, print_function)
(powerline.shell is the only exception due to problems with argparse).
2. Standard python library imports in a form `import X`.
3. Standard python library imports in a form `from X import Y`.
4. and 5. 2. and 3. for third-party (non-python and non-powerline imports).
6. 3. for powerline non-test imports.
7. and 8. 2. and 3. for powerline testing module imports.
Each list entry is separated by exactly one newline from another import. If
there is module docstring it goes between `# vim:` comment and `__future__`
import. So the structure containing all items is the following:
#!/usr/bin/env python
# vim:fileencoding=utf-8:noet
'''Powerline super module'''
import sys
from argparse import ArgumentParser
import psutil
from colormath.color_diff import delta_e_cie2000
from powerline.lib.unicode import u
import tests.vim as vim_module
from tests import TestCase
.
Four possible results of running tests (first three are errors):
- “The change to inotify/file2 was not detected” on line 84: most common
- “Spurious change detected” at line 82 (uncommon, usually fixed by sleeping
before running test in do_test_for_change)
- “The change to inotify was not detected” in tree watcher test (e.g. from line
131) (very rare)
- All OK.
Among other benefits (i.e. correct fall back to ascii theme when Vim uses
non-unicode encoding) this should also fix travis tests: apparently travis is
not setting LANG or similar environment variables to some unicode locale, so
tests are failing.
This byte is useless and can be seen in zsh output (strange that it did not
cause bugs so far, at least none I know about). It may have been needed if any
client was supposed to hold connection with daemon for a few runs, but all
current clients work in “request → output response → exit” fashion without
caring about terminating newline and definitely without preserving connection to
daemon accross runs.
- This segment displays the number of attached tmux clients to the
currently running session.
- The minimum argument is used to specify a threshold for when the
segment should be visible.
Fixes#661Closes#662
Conflicts:
docs/source/index.rst
powerline/config_files/colorschemes/shell/default.json
powerline/config_files/colorschemes/shell/solarized.json
powerline/config_files/colorschemes/tmux/default.json
powerline/config_files/colorschemes/vim/default.json
powerline/config_files/colorschemes/vim/solarized.json
powerline/config_files/colorschemes/wm/default.json
tests/test_segments.py
- Replaced two powerline objects with one powerline object utilizing
RendererProxy proxy class that holds two Renderer instances.
- Made .setup() functions do something more meaningful.
Specifically I searched for all lines that are more then one tab off compared to
the previous line with
BufGrep /\(^\t\+\)\S.*\n\1\t\t\+/
and replaced them with something more appropriate. Most of time this resulted in
a few more newlines, but there are cases when I used mixed tabs/spaces
indentation+alignment.
Note: by default this segment is disabled. Until #923 it may only be enabled by
copying the whole file and changing "enabled" to "true". After #923 it may be
enabled by having `~/.config/powerline/themes/vim/default.json` with the
following contents:
{
"segment_data": {
"trailing_whitespace": {
"display": true
}
}
}
Fixes#388