pull/37/merge
Tim Stack 13 years ago
parent 9fb10d5340
commit e47e3503eb

8
configure vendored

@ -3628,7 +3628,15 @@ if test "${enable_static+set}" = set; then :
fi
if test x"${enable_static}" != x"no"; then
case "$host_os" in
darwin*)
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"static linking is not supported on $host_os\"" >&5
$as_echo "$as_me: WARNING: \"static linking is not supported on $host_os\"" >&2;}
;;
*)
STATIC_LDFLAGS="$STATIC_LDFLAGS -static"
;;
esac
fi

@ -31,7 +31,14 @@ AC_ARG_ENABLE([static],
AS_HELP_STRING([--disable-static],
[Disable static linking]))
if test x"${enable_static}" != x"no"; then
case "$host_os" in
darwin*)
AC_WARN("static linking is not supported on $host_os")
;;
*)
STATIC_LDFLAGS="$STATIC_LDFLAGS -static"
;;
esac
fi
AC_SUBST(STATIC_LDFLAGS)

@ -1,18 +1,33 @@
/**
* @file termios_guard.hh
*/
#ifndef __termios_guard_hh
#define __termios_guard_hh
/**
* RAII class that saves the current termios for a tty and then restores them
* during destruction.
*/
class guard_termios {
public:
guard_termios(int fd) : gt_fd(fd) {
/**
* Store the TTY termios settings in this object.
*
* @param fd The tty file descriptor.
*/
guard_termios(const int fd) : gt_fd(fd) {
if (isatty(this->gt_fd) &&
tcgetattr(this->gt_fd, &this->gt_termios) == -1) {
perror("tcgetattr");
}
};
/**
* Restore the TTY termios settings that were captured when this object was
* instantiated.
*/
~guard_termios() {
if (isatty(this->gt_fd) &&
tcsetattr(this->gt_fd, TCSANOW, &this->gt_termios) == -1) {
@ -21,7 +36,7 @@ public:
};
private:
int gt_fd;
const int gt_fd;
struct termios gt_termios;
};

@ -189,7 +189,7 @@ void textview_curses::listview_value_for_row(const listview_curses &lv,
vis_line_t row,
attr_line_t &value_out)
{
bookmark_vector &bv = this->tc_bookmarks[&BM_USER];
bookmark_vector &user_marks = this->tc_bookmarks[&BM_USER];
string_attrs_t &sa = value_out.get_attrs();
string &str = value_out.get_string();
highlight_map_t::iterator iter;
@ -229,14 +229,14 @@ void textview_curses::listview_value_for_row(const listview_curses &lv,
}
if (lr.lr_end > lr.lr_start) {
sa[lr].insert(make_string_attr("style", iter->second.
get_attrs(hcount)));
hcount++;
off = matches[1];
sa[lr].insert(make_string_attr("style", iter->second.
get_attrs(hcount)));
hcount++;
off = matches[1];
}
else {
off += 1;
off += 1;
}
}
else {
@ -245,9 +245,9 @@ void textview_curses::listview_value_for_row(const listview_curses &lv,
}
}
if (binary_search(bv.begin(), bv.end(), row)) {
if (binary_search(user_marks.begin(), user_marks.end(), row)) {
struct line_range lr = { 0, -1 };
string_attrs_t::iterator iter;
bool added = false;
for (iter = sa.begin(); iter != sa.end(); iter++) {
attrs_map_t &am = iter->second;
@ -256,15 +256,10 @@ void textview_curses::listview_value_for_row(const listview_curses &lv,
for (am_iter = am.begin(); am_iter != am.end(); am_iter++) {
if (am_iter->first == "style") {
am_iter->second.sa_int ^= A_REVERSE;
added = true;
break;
}
}
}
if (!added) {
struct line_range lr = { 0, -1 };
sa[lr].insert(make_string_attr("style", A_REVERSE));
}
sa[lr].insert(make_string_attr("style", A_REVERSE));
}
}

@ -1,3 +1,7 @@
/**
* @file textview_curses.hh
*/
#ifndef __textview_curses_hh
#define __textview_curses_hh
@ -32,6 +36,10 @@ public:
virtual void text_user_mark(int line, bool added) { };
};
/**
* The textview_curses class adds user bookmarks and searching to the standard
* list view interface.
*/
class textview_curses
: public listview_curses,
public list_data_source,

Loading…
Cancel
Save