Merge branch 'master' into mode-stack
This commit is contained in:
commit
b34d469b72
|
@ -30,6 +30,12 @@ make test
|
||||||
cd src
|
cd src
|
||||||
%make_install PREFIX=/usr
|
%make_install PREFIX=/usr
|
||||||
|
|
||||||
|
%files
|
||||||
|
%doc
|
||||||
|
%{_bindir}/*
|
||||||
|
%{_datadir}/doc/kak/*
|
||||||
|
%{_datadir}/kak/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
* Sat Mar 28 2015 jkonecny <jkonecny@redhat.com> - 0-5.20150328gitd1b81c8f
|
* Sat Mar 28 2015 jkonecny <jkonecny@redhat.com> - 0-5.20150328gitd1b81c8f
|
||||||
- Automated git update by dgroc script new hash: d1b81c8f
|
- Automated git update by dgroc script new hash: d1b81c8f
|
||||||
|
@ -39,10 +45,3 @@ cd src
|
||||||
|
|
||||||
* Tue Mar 17 2015 Jiri Konecny <jkonecny@redhat.com> 0-1.12a732dgit
|
* Tue Mar 17 2015 Jiri Konecny <jkonecny@redhat.com> 0-1.12a732dgit
|
||||||
- Create first rpm for kakoune
|
- Create first rpm for kakoune
|
||||||
|
|
||||||
%files
|
|
||||||
%doc
|
|
||||||
%{_bindir}/*
|
|
||||||
%{_datadir}/doc/kak/*
|
|
||||||
%{_datadir}/kak/*
|
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ install: kak
|
||||||
mkdir -p $(sharedir)/rc
|
mkdir -p $(sharedir)/rc
|
||||||
install -m 0644 ../share/kak/kakrc $(sharedir)
|
install -m 0644 ../share/kak/kakrc $(sharedir)
|
||||||
install -m 0644 ../rc/* $(sharedir)/rc
|
install -m 0644 ../rc/* $(sharedir)/rc
|
||||||
ln -s $(sharedir)/rc $(sharedir)/autoload
|
ln -r -s $(sharedir)/rc $(sharedir)/autoload
|
||||||
mkdir -p $(docdir)
|
mkdir -p $(docdir)
|
||||||
install -m 0644 ../README.asciidoc $(docdir)
|
install -m 0644 ../README.asciidoc $(docdir)
|
||||||
install -m 0644 ../doc/* $(docdir)
|
install -m 0644 ../doc/* $(docdir)
|
||||||
|
|
|
@ -108,7 +108,7 @@ Buffer* create_fifo_buffer(String name, int fd, bool scroll)
|
||||||
watcher->close_fd();
|
watcher->close_fd();
|
||||||
buffer->run_hook_in_own_context("BufCloseFifo", "");
|
buffer->run_hook_in_own_context("BufCloseFifo", "");
|
||||||
buffer->flags() &= ~Buffer::Flags::Fifo;
|
buffer->flags() &= ~Buffer::Flags::Fifo;
|
||||||
watcher->~FDWatcher();
|
delete watcher;
|
||||||
};
|
};
|
||||||
|
|
||||||
// capture a non static one to silence a warning.
|
// capture a non static one to silence a warning.
|
||||||
|
|
|
@ -1477,7 +1477,13 @@ static Completions complete_face(const Context&, CompletionFlags flags,
|
||||||
const CommandDesc face_cmd = {
|
const CommandDesc face_cmd = {
|
||||||
"face",
|
"face",
|
||||||
nullptr,
|
nullptr,
|
||||||
"face <name> <facespec>: set face <name> to refer to <facespec>\n",
|
"face <name> <facespec>: set face <name> to refer to <facespec>\n"
|
||||||
|
"\n"
|
||||||
|
"facespec format is <fg color>[,<bg color>][+<attributes>]\n"
|
||||||
|
"colors are either a color name, or rgb:###### values.\n"
|
||||||
|
"attributes is a combination of:\n"
|
||||||
|
" u: underline, r: reverse, b: bold, B: blink, d: dim\n"
|
||||||
|
"facespec can as well just be the name of another face" ,
|
||||||
ParameterDesc{{}, ParameterDesc::Flags::None, 2, 2},
|
ParameterDesc{{}, ParameterDesc::Flags::None, 2, 2},
|
||||||
CommandFlags::None,
|
CommandFlags::None,
|
||||||
CommandHelper{},
|
CommandHelper{},
|
||||||
|
|
|
@ -149,9 +149,13 @@ public:
|
||||||
void optimize();
|
void optimize();
|
||||||
void compute_range();
|
void compute_range();
|
||||||
|
|
||||||
|
void set_default_face(const Face& face) { m_default_face = face; }
|
||||||
|
const Face& default_face() const { return m_default_face; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
LineList m_lines;
|
LineList m_lines;
|
||||||
BufferRange m_range;
|
BufferRange m_range;
|
||||||
|
Face m_default_face;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,6 +91,7 @@ CandidateList FaceRegistry::complete_alias_name(StringView prefix,
|
||||||
|
|
||||||
FaceRegistry::FaceRegistry()
|
FaceRegistry::FaceRegistry()
|
||||||
: m_aliases{
|
: m_aliases{
|
||||||
|
{ "Default", Face{ Color::Default, Color::Default } },
|
||||||
{ "PrimarySelection", Face{ Color::White, Color::Blue } },
|
{ "PrimarySelection", Face{ Color::White, Color::Blue } },
|
||||||
{ "SecondarySelection", Face{ Color::Black, Color::Blue } },
|
{ "SecondarySelection", Face{ Color::Black, Color::Blue } },
|
||||||
{ "PrimaryCursor", Face{ Color::Black, Color::White } },
|
{ "PrimaryCursor", Face{ Color::Black, Color::White } },
|
||||||
|
|
|
@ -206,13 +206,18 @@ static int get_color_pair(const Face& face)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void set_face(WINDOW* window, Face face)
|
void set_face(WINDOW* window, Face face, const Face& default_face)
|
||||||
{
|
{
|
||||||
static int current_pair = -1;
|
static int current_pair = -1;
|
||||||
|
|
||||||
if (current_pair != -1)
|
if (current_pair != -1)
|
||||||
wattroff(window, COLOR_PAIR(current_pair));
|
wattroff(window, COLOR_PAIR(current_pair));
|
||||||
|
|
||||||
|
if (face.fg == Color::Default)
|
||||||
|
face.fg = default_face.fg;
|
||||||
|
if (face.bg == Color::Default)
|
||||||
|
face.bg = default_face.bg;
|
||||||
|
|
||||||
if (face.fg != Color::Default or face.bg != Color::Default)
|
if (face.fg != Color::Default or face.bg != Color::Default)
|
||||||
{
|
{
|
||||||
current_pair = get_color_pair(face);
|
current_pair = get_color_pair(face);
|
||||||
|
@ -333,11 +338,12 @@ void NCursesUI::update_dimensions()
|
||||||
--m_dimensions.line;
|
--m_dimensions.line;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NCursesUI::draw_line(const DisplayLine& line, CharCount col_index) const
|
void NCursesUI::draw_line(const DisplayLine& line, CharCount col_index,
|
||||||
|
const Face& default_face) const
|
||||||
{
|
{
|
||||||
for (const DisplayAtom& atom : line)
|
for (const DisplayAtom& atom : line)
|
||||||
{
|
{
|
||||||
set_face(m_window, atom.face);
|
set_face(m_window, atom.face, default_face);
|
||||||
|
|
||||||
StringView content = atom.content();
|
StringView content = atom.content();
|
||||||
if (content.empty())
|
if (content.empty())
|
||||||
|
@ -365,6 +371,9 @@ void NCursesUI::draw(const DisplayBuffer& display_buffer,
|
||||||
const DisplayLine& status_line,
|
const DisplayLine& status_line,
|
||||||
const DisplayLine& mode_line)
|
const DisplayLine& mode_line)
|
||||||
{
|
{
|
||||||
|
const Face& default_face = display_buffer.default_face();
|
||||||
|
wbkgdset(m_window, COLOR_PAIR(get_color_pair(default_face)));
|
||||||
|
|
||||||
check_resize();
|
check_resize();
|
||||||
|
|
||||||
LineCount line_index = m_status_on_top ? 1 : 0;
|
LineCount line_index = m_status_on_top ? 1 : 0;
|
||||||
|
@ -372,11 +381,11 @@ void NCursesUI::draw(const DisplayBuffer& display_buffer,
|
||||||
{
|
{
|
||||||
wmove(m_window, (int)line_index, 0);
|
wmove(m_window, (int)line_index, 0);
|
||||||
wclrtoeol(m_window);
|
wclrtoeol(m_window);
|
||||||
draw_line(line, 0);
|
draw_line(line, 0, default_face);
|
||||||
++line_index;
|
++line_index;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_face(m_window, { Color::Blue, Color::Default });
|
set_face(m_window, { Color::Blue, Color::Default }, default_face);
|
||||||
while (line_index < m_dimensions.line + (m_status_on_top ? 1 : 0))
|
while (line_index < m_dimensions.line + (m_status_on_top ? 1 : 0))
|
||||||
{
|
{
|
||||||
wmove(m_window, (int)line_index++, 0);
|
wmove(m_window, (int)line_index++, 0);
|
||||||
|
@ -387,14 +396,14 @@ void NCursesUI::draw(const DisplayBuffer& display_buffer,
|
||||||
int status_line_pos = m_status_on_top ? 0 : (int)m_dimensions.line;
|
int status_line_pos = m_status_on_top ? 0 : (int)m_dimensions.line;
|
||||||
wmove(m_window, status_line_pos, 0);
|
wmove(m_window, status_line_pos, 0);
|
||||||
wclrtoeol(m_window);
|
wclrtoeol(m_window);
|
||||||
draw_line(status_line, 0);
|
draw_line(status_line, 0, default_face);
|
||||||
const auto mode_len = mode_line.length();
|
const auto mode_len = mode_line.length();
|
||||||
const auto remaining = m_dimensions.column - status_line.length();
|
const auto remaining = m_dimensions.column - status_line.length();
|
||||||
if (mode_len < remaining)
|
if (mode_len < remaining)
|
||||||
{
|
{
|
||||||
CharCount col = m_dimensions.column - mode_len;
|
CharCount col = m_dimensions.column - mode_len;
|
||||||
wmove(m_window, status_line_pos, (int)col);
|
wmove(m_window, status_line_pos, (int)col);
|
||||||
draw_line(mode_line, col);
|
draw_line(mode_line, col, default_face);
|
||||||
}
|
}
|
||||||
else if (remaining > 2)
|
else if (remaining > 2)
|
||||||
{
|
{
|
||||||
|
@ -405,7 +414,7 @@ void NCursesUI::draw(const DisplayBuffer& display_buffer,
|
||||||
|
|
||||||
CharCount col = m_dimensions.column - remaining + 1;
|
CharCount col = m_dimensions.column - remaining + 1;
|
||||||
wmove(m_window, status_line_pos, (int)col);
|
wmove(m_window, status_line_pos, (int)col);
|
||||||
draw_line(trimmed_mode_line, col);
|
draw_line(trimmed_mode_line, col, default_face);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* tsl = tigetstr((char*)"tsl");
|
const char* tsl = tigetstr((char*)"tsl");
|
||||||
|
|
|
@ -51,7 +51,8 @@ public:
|
||||||
private:
|
private:
|
||||||
void check_resize();
|
void check_resize();
|
||||||
void redraw();
|
void redraw();
|
||||||
void draw_line(const DisplayLine& line, CharCount col_index) const;
|
void draw_line(const DisplayLine& line, CharCount col_index,
|
||||||
|
const Face& default_face) const;
|
||||||
|
|
||||||
NCursesWin* m_window = nullptr;
|
NCursesWin* m_window = nullptr;
|
||||||
|
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "assert.hh"
|
#include "assert.hh"
|
||||||
#include "context.hh"
|
#include "context.hh"
|
||||||
|
#include "face_registry.hh"
|
||||||
#include "highlighter.hh"
|
#include "highlighter.hh"
|
||||||
#include "hook_manager.hh"
|
#include "hook_manager.hh"
|
||||||
#include "client.hh"
|
#include "client.hh"
|
||||||
|
@ -65,6 +66,7 @@ void Window::update_display_buffer(const Context& context)
|
||||||
kak_assert(&buffer() == &context.buffer());
|
kak_assert(&buffer() == &context.buffer());
|
||||||
scroll_to_keep_selection_visible_ifn(context);
|
scroll_to_keep_selection_visible_ifn(context);
|
||||||
|
|
||||||
|
m_display_buffer.set_default_face(get_face("Default"));
|
||||||
DisplayBuffer::LineList& lines = m_display_buffer.lines();
|
DisplayBuffer::LineList& lines = m_display_buffer.lines();
|
||||||
lines.clear();
|
lines.clear();
|
||||||
|
|
||||||
|
@ -283,6 +285,11 @@ ByteCoordAndTarget Window::offset_coord(ByteCoordAndTarget coord, LineCount offs
|
||||||
return { find_buffer_coord(lines[1], buffer(), column), column };
|
return { find_buffer_coord(lines[1], buffer(), column), column };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Window::clear_display_buffer()
|
||||||
|
{
|
||||||
|
m_display_buffer = DisplayBuffer{};
|
||||||
|
}
|
||||||
|
|
||||||
void Window::on_option_changed(const Option& option)
|
void Window::on_option_changed(const Option& option)
|
||||||
{
|
{
|
||||||
run_hook_in_own_context("WinSetOption",
|
run_hook_in_own_context("WinSetOption",
|
||||||
|
|
|
@ -44,7 +44,7 @@ public:
|
||||||
ByteCoord offset_coord(ByteCoord coord, CharCount offset);
|
ByteCoord offset_coord(ByteCoord coord, CharCount offset);
|
||||||
ByteCoordAndTarget offset_coord(ByteCoordAndTarget coord, LineCount offset);
|
ByteCoordAndTarget offset_coord(ByteCoordAndTarget coord, LineCount offset);
|
||||||
|
|
||||||
void clear_display_buffer() { m_display_buffer = DisplayBuffer{}; }
|
void clear_display_buffer();
|
||||||
private:
|
private:
|
||||||
Window(const Window&) = delete;
|
Window(const Window&) = delete;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user